MaximizeBox = false;
ShowInTaskbar = false;
FormBorderStyle = FormBorderStyle.Sizable;
+ StartPosition = FormStartPosition.CenterScreen;
}
#endregion DialogForm Constructors
#region Internal Methods
internal DialogResult RunDialog () {
- this.StartPosition = FormStartPosition.CenterScreen;
-
owner.InitFormsSize (this);
this.ShowDialog ();
#region Local Variables
internal DialogForm form;
+ private object tag;
#endregion Local Variables
#region Public Constructors
public CommonDialog() {
- form = new DialogForm(this);
}
#endregion Public Constructors
+ #region Public Properties
+ [Localizable (false)]
+ [Bindable (true)]
+ [TypeConverter (typeof (StringConverter))]
+ [DefaultValue (null)]
+ [MWFCategory ("Data")]
+ public object Tag {
+ get { return this.tag; }
+ set { this.tag = value; }
+ }
+ #endregion
+
#region Internal Methods
internal virtual void InitFormsSize(Form form) {
// Override this to set a default size for the form
#endregion Internal Methods
#region Public Instance Methods
- public abstract void Reset();
+ public abstract void Reset ();
public DialogResult ShowDialog() {
- return ShowDialog(null);
+ return ShowDialog (null);
}
- public DialogResult ShowDialog(IWin32Window ownerWin32) {
- // Prep the dialog
- RunDialog(form.Handle);
-
- // Run
- form.ShowDialog(ownerWin32);
+ public DialogResult ShowDialog (IWin32Window owner)
+ {
+ // This is an external derived CommonDialog
+ if (form == null) {
+ if (RunDialog (owner == null ? IntPtr.Zero : owner.Handle))
+ return DialogResult.OK;
+ return DialogResult.Cancel;
+ }
+
+ // This is an internal derived CommonDialog
+ if (RunDialog (form.Handle))
+ form.ShowDialog (owner);
return form.DialogResult;
}
}
protected virtual void OnHelpRequest(EventArgs e) {
- if (HelpRequest != null) {
- HelpRequest(this, e);
- }
+ EventHandler eh = (EventHandler)(Events [HelpRequestEvent]);
+ if (eh != null)
+ eh (this, e);
}
protected virtual IntPtr OwnerWndProc(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam) {
#endregion // Protected Instance Methods
#region Events
- public event EventHandler HelpRequest;
+ static object HelpRequestEvent = new object ();
+
+ public event EventHandler HelpRequest {
+ add { Events.AddHandler (HelpRequestEvent, value); }
+ remove { Events.RemoveHandler (HelpRequestEvent, value); }
+ }
#endregion // Events
}
}