123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- @using System.Windows.Forms
- @inherits ButtonBaseComponent<ButtonControl>
- <input type="button"
- name="@Control.Name"
- value="@Control.Text"
- style="@GetStyle"
- title="@Control.Text"
- disabled="@IsDisabled"
- @onclick="Click" />
- @code {
- private void Click()
- {
- ButtonClick(Control);
- // After
- WebReport.OnUpdate(true);
- }
- private void ButtonClick(ButtonControl button)
- {
- if (button.DialogResult == DialogResult.OK)
- {
- if (FormClose(button, CloseReason.None))
- WebReport.Dialog.CurrentForm++;
- }
- else if (button.DialogResult == DialogResult.Cancel)
- {
- if (FormClose(button, CloseReason.UserClosing))
- WebReport.Canceled = true;
- }
- button.OnClick(null);
- }
- private bool FormClose(ButtonControl button, CloseReason reason)
- {
- DialogPage dialog = button.Report.Pages[WebReport.Dialog.CurrentForm] as DialogPage;
- dialog.Form.DialogResult = button.DialogResult;
- FormClosingEventArgs closingArgs = new FormClosingEventArgs(reason, false);
- dialog.OnFormClosing(closingArgs);
- if (closingArgs.Cancel)
- return false;
- FormClosedEventArgs closedArgs = new FormClosedEventArgs(reason);
- dialog.OnFormClosed(closedArgs);
- dialog.ActiveInWeb = false;
- return true;
- }
- protected override string GetStyle
- => base.GetStyle + $"{GetControlAlign()} padding:0;margin:0;";
- }
|