BaseWizardForm.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.ComponentModel;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. using FastReport.Utils;
  6. namespace FastReport.Forms
  7. {
  8. internal partial class BaseWizardForm : BaseDialogForm
  9. {
  10. [Browsable(false)]
  11. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  12. public virtual int VisiblePanelIndex
  13. {
  14. get { return pcPages.ActivePageIndex; }
  15. set
  16. {
  17. pcPages.ActivePageIndex = value;
  18. btnPrevious.Enabled = value > 0;
  19. btnNext.Enabled = value < pcPages.Pages.Count - 1;
  20. btnFinish.Enabled = value == pcPages.Pages.Count - 1;
  21. lblCaption.Text = pcPages.Pages[value].Text;
  22. lblCaption.Location = new Point(RightToLeft == RightToLeft.Yes ? ClientSize.Width - lblCaption.Width - 12 : 12, (pnTop.Height - lblCaption.Height) / 2);
  23. }
  24. }
  25. private void btnPrevious_Click(object sender, EventArgs e)
  26. {
  27. VisiblePanelIndex--;
  28. }
  29. private void btnNext_Click(object sender, EventArgs e)
  30. {
  31. VisiblePanelIndex++;
  32. }
  33. private void pnTop_Paint(object sender, PaintEventArgs e)
  34. {
  35. e.Graphics.DrawLine(Pens.Silver, 0, pnTop.Height - 1, pnTop.Width, pnTop.Height - 1);
  36. }
  37. private void pnBottom_Paint(object sender, PaintEventArgs e)
  38. {
  39. e.Graphics.DrawLine(Pens.Silver, 0, 0, pnBottom.Width, 0);
  40. }
  41. public override void Localize()
  42. {
  43. base.Localize();
  44. btnPrevious.Text = Res.Get("Buttons,Previous");
  45. btnNext.Text = Res.Get("Buttons,Next");
  46. btnFinish.Text = Res.Get("Buttons,Finish");
  47. btnCancel1.Text = Res.Get("Buttons,Cancel");
  48. }
  49. public override void UpdateDpiDependencies()
  50. {
  51. base.UpdateDpiDependencies();
  52. lblCaption.Font = this.LogicalToDevice(new Font(DrawUtils.DefaultFont.Name, 10, FontStyle.Bold), true);
  53. MinimumSize = this.LogicalToDevice(new Size(481, 453));
  54. }
  55. public BaseWizardForm()
  56. {
  57. InitializeComponent();
  58. }
  59. }
  60. }