BaseWizardForm.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. // ava issue with clipped text, need async call
  23. Throttle.Execute(() =>
  24. {
  25. lblCaption.Location = new Point(RightToLeft == RightToLeft.Yes ? ClientSize.Width - lblCaption.Width - 12 : 12, (pnTop.Height - lblCaption.Height) / 2);
  26. });
  27. }
  28. }
  29. private void btnPrevious_Click(object sender, EventArgs e)
  30. {
  31. VisiblePanelIndex--;
  32. }
  33. private void btnNext_Click(object sender, EventArgs e)
  34. {
  35. VisiblePanelIndex++;
  36. }
  37. private void pnTop_Paint(object sender, PaintEventArgs e)
  38. {
  39. e.Graphics.DrawLine(Pens.Silver, 0, pnTop.Height - 1, pnTop.Width, pnTop.Height - 1);
  40. }
  41. private void pnBottom_Paint(object sender, PaintEventArgs e)
  42. {
  43. e.Graphics.DrawLine(Pens.Silver, 0, 0, pnBottom.Width, 0);
  44. }
  45. public override void Localize()
  46. {
  47. base.Localize();
  48. btnPrevious.Text = Res.Get("Buttons,Previous");
  49. btnNext.Text = Res.Get("Buttons,Next");
  50. btnFinish.Text = Res.Get("Buttons,Finish");
  51. btnCancel1.Text = Res.Get("Buttons,Cancel");
  52. }
  53. public override void UpdateDpiDependencies()
  54. {
  55. base.UpdateDpiDependencies();
  56. lblCaption.Font = this.LogicalToDevice(new Font(DrawUtils.DefaultFont.Name, 10, FontStyle.Bold), true);
  57. MinimumSize = this.LogicalToDevice(new Size(481, 453));
  58. }
  59. public BaseWizardForm()
  60. {
  61. InitializeComponent();
  62. }
  63. }
  64. }