• C# winform 中的Form 源码


      1 [DefaultEvent("Load"), InitializationEvent("Load"), ComVisible(true), ClassInterface(ClassInterfaceType.AutoDispatch), ToolboxItemFilter("System.Windows.Forms.Control.TopLevel"), ToolboxItem(false), DesignTimeVisible(false), Designer("System.Windows.Forms.Design.FormDocumentDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(IRootDesigner)), DesignerCategory("Form")]
      2 public class Form : ContainerControl
      3 {
      4     // Fields
      5     private Size autoScaleBaseSize;
      6     private CloseReason closeReason;
      7     private MdiClient ctlClient;
      8     private static Icon defaultIcon;
      9     private static Icon defaultRestrictedIcon;
     10     private DialogResult dialogResult;
     11     private static readonly object EVENT_ACTIVATED;
     12     private static readonly object EVENT_CLOSED;
     13     private static readonly object EVENT_CLOSING;
     14     private static readonly object EVENT_DEACTIVATE;
     15     private static readonly object EVENT_FORMCLOSED;
     16     private static readonly object EVENT_FORMCLOSING;
     17     private static readonly object EVENT_HELPBUTTONCLICKED;
     18     private static readonly object EVENT_INPUTLANGCHANGE;
     19     private static readonly object EVENT_INPUTLANGCHANGEREQUEST;
     20     private static readonly object EVENT_LOAD;
     21     private static readonly object EVENT_MAXIMIZEDBOUNDSCHANGED;
     22     private static readonly object EVENT_MAXIMUMSIZECHANGED;
     23     private static readonly object EVENT_MDI_CHILD_ACTIVATE;
     24     private static readonly object EVENT_MENUCOMPLETE;
     25     private static readonly object EVENT_MENUSTART;
     26     private static readonly object EVENT_MINIMUMSIZECHANGED;
     27     private static readonly object EVENT_RESIZEBEGIN;
     28     private static readonly object EVENT_RESIZEEND;
     29     private static readonly object EVENT_RIGHTTOLEFTLAYOUTCHANGED;
     30     private static readonly object EVENT_SHOWN;
     31     private static Padding FormPadding;
     32     private BitVector32 formState;
     33     private static readonly BitVector32.Section FormStateAllowTransparency;
     34     private static readonly BitVector32.Section FormStateAutoScaling;
     35     private static readonly BitVector32.Section FormStateBorderStyle;
     36     private static readonly BitVector32.Section FormStateControlBox;
     37     private BitVector32 formStateEx;
     38     private static readonly BitVector32.Section FormStateExAutoSize;
     39     private static readonly BitVector32.Section FormStateExCalledClosing;
     40     private static readonly BitVector32.Section FormStateExCalledCreateControl;
     41     private static readonly BitVector32.Section FormStateExCalledMakeVisible;
     42     private static readonly BitVector32.Section FormStateExCalledOnLoad;
     43     private static readonly BitVector32.Section FormStateExInModalSizingLoop;
     44     private static readonly BitVector32.Section FormStateExInScale;
     45     private static readonly BitVector32.Section FormStateExInUpdateMdiControlStrip;
     46     private static readonly BitVector32.Section FormStateExMnemonicProcessed;
     47     private static readonly BitVector32.Section FormStateExSettingAutoScale;
     48     private static readonly BitVector32.Section FormStateExShowIcon;
     49     private static readonly BitVector32.Section FormStateExUpdateMenuHandlesDeferred;
     50     private static readonly BitVector32.Section FormStateExUpdateMenuHandlesSuspendCount;
     51     private static readonly BitVector32.Section FormStateExUseMdiChildProc;
     52     private static readonly BitVector32.Section FormStateExWindowBoundsHeightIsClientSize;
     53     private static readonly BitVector32.Section FormStateExWindowBoundsWidthIsClientSize;
     54     private static readonly BitVector32.Section FormStateExWindowClosing;
     55     private static readonly BitVector32.Section FormStateHelpButton;
     56     private static readonly BitVector32.Section FormStateIconSet;
     57     private static readonly BitVector32.Section FormStateIsActive;
     58     private static readonly BitVector32.Section FormStateIsRestrictedWindow;
     59     private static readonly BitVector32.Section FormStateIsRestrictedWindowChecked;
     60     private static readonly BitVector32.Section FormStateIsTextEmpty;
     61     private static readonly BitVector32.Section FormStateIsWindowActivated;
     62     private static readonly BitVector32.Section FormStateKeyPreview;
     63     private static readonly BitVector32.Section FormStateLayered;
     64     private static readonly BitVector32.Section FormStateMaximizeBox;
     65     private static readonly BitVector32.Section FormStateMdiChildMax;
     66     private static readonly BitVector32.Section FormStateMinimizeBox;
     67     private static readonly BitVector32.Section FormStateRenderSizeGrip;
     68     private static readonly BitVector32.Section FormStateSetClientSize;
     69     private static readonly BitVector32.Section FormStateShowWindowOnCreate;
     70     private static readonly BitVector32.Section FormStateSizeGripStyle;
     71     private static readonly BitVector32.Section FormStateStartPos;
     72     private static readonly BitVector32.Section FormStateSWCalled;
     73     private static readonly BitVector32.Section FormStateTaskBar;
     74     private static readonly BitVector32.Section FormStateTopMost;
     75     private static readonly BitVector32.Section FormStateWindowState;
     76     private Icon icon;
     77     private static object internalSyncObject;
     78     private Size minAutoSize;
     79     private NativeWindow ownerWindow;
     80     private static readonly int PropAcceptButton;
     81     private static readonly int PropActiveMdiChild;
     82     private static readonly int PropCancelButton;
     83     private static readonly int PropCurMenu;
     84     private static readonly int PropDefaultButton;
     85     private static readonly int PropDialogOwner;
     86     private static readonly int PropDummyMenu;
     87     private static readonly int PropFormerlyActiveMdiChild;
     88     private static readonly int PropFormMdiParent;
     89     private static readonly int PropMainMenu;
     90     private static readonly int PropMainMenuStrip;
     91     private static readonly int PropMaximizedBounds;
     92     private static readonly int PropMaxTrackSizeHeight;
     93     private static readonly int PropMaxTrackSizeWidth;
     94     private static readonly int PropMdiChildFocusable;
     95     private static readonly int PropMdiControlStrip;
     96     private static readonly int PropMdiWindowListStrip;
     97     private static readonly int PropMergedMenu;
     98     private static readonly int PropMinTrackSizeHeight;
     99     private static readonly int PropMinTrackSizeWidth;
    100     private static readonly int PropOpacity;
    101     private static readonly int PropOwnedForms;
    102     private static readonly int PropOwnedFormsCount;
    103     private static readonly int PropOwner;
    104     private static readonly int PropSecurityTip;
    105     private static readonly int PropTransparencyKey;
    106     private Rectangle restoreBounds;
    107     private Rectangle restoredWindowBounds;
    108     private BoundsSpecified restoredWindowBoundsSpecified;
    109     private bool rightToLeftLayout;
    110     private string securitySite;
    111     private string securityZone;
    112     private VisualStyleRenderer sizeGripRenderer;
    113     private const int SizeGripSize = 0x10;
    114     private Icon smallIcon;
    115     private string userWindowText;
    116 
    117     // Events
    118     [SRCategory("CatFocus"), SRDescription("FormOnActivateDescr")]
    119     public event EventHandler Activated;
    120     [EditorBrowsable(EditorBrowsableState.Always), SRDescription("ControlOnAutoSizeChangedDescr"), Browsable(true), SRCategory("CatPropertyChanged")]
    121     public event EventHandler AutoSizeChanged;
    122     [EditorBrowsable(EditorBrowsableState.Always), Browsable(true)]
    123     public event EventHandler AutoValidateChanged;
    124     [SRCategory("CatBehavior"), EditorBrowsable(EditorBrowsableState.Never), SRDescription("FormOnClosedDescr"), Browsable(false)]
    125     public event EventHandler Closed;
    126     [SRCategory("CatBehavior"), EditorBrowsable(EditorBrowsableState.Never), SRDescription("FormOnClosingDescr"), Browsable(false)]
    127     public event CancelEventHandler Closing;
    128     [SRDescription("FormOnDeactivateDescr"), SRCategory("CatFocus")]
    129     public event EventHandler Deactivate;
    130     [SRCategory("CatBehavior"), SRDescription("FormOnFormClosedDescr")]
    131     public event FormClosedEventHandler FormClosed;
    132     [SRDescription("FormOnFormClosingDescr"), SRCategory("CatBehavior")]
    133     public event FormClosingEventHandler FormClosing;
    134     [SRDescription("FormHelpButtonClickedDescr"), EditorBrowsable(EditorBrowsableState.Always), Browsable(true), SRCategory("CatBehavior")]
    135     public event CancelEventHandler HelpButtonClicked;
    136     [SRDescription("FormOnInputLangChangeDescr"), SRCategory("CatBehavior")]
    137     public event InputLanguageChangedEventHandler InputLanguageChanged;
    138     [SRCategory("CatBehavior"), SRDescription("FormOnInputLangChangeRequestDescr")]
    139     public event InputLanguageChangingEventHandler InputLanguageChanging;
    140     [SRDescription("FormOnLoadDescr"), SRCategory("CatBehavior")]
    141     public event EventHandler Load;
    142     [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
    143     public event EventHandler MarginChanged;
    144     [SRCategory("CatPropertyChanged"), SRDescription("FormOnMaximizedBoundsChangedDescr")]
    145     public event EventHandler MaximizedBoundsChanged;
    146     [SRCategory("CatPropertyChanged"), SRDescription("FormOnMaximumSizeChangedDescr")]
    147     public event EventHandler MaximumSizeChanged;
    148     [SRDescription("FormOnMDIChildActivateDescr"), SRCategory("CatLayout")]
    149     public event EventHandler MdiChildActivate;
    150     [Browsable(false), SRCategory("CatBehavior"), SRDescription("FormOnMenuCompleteDescr")]
    151     public event EventHandler MenuComplete;
    152     [Browsable(false), SRDescription("FormOnMenuStartDescr"), SRCategory("CatBehavior")]
    153     public event EventHandler MenuStart;
    154     [SRCategory("CatPropertyChanged"), SRDescription("FormOnMinimumSizeChangedDescr")]
    155     public event EventHandler MinimumSizeChanged;
    156     [SRDescription("FormOnResizeBeginDescr"), SRCategory("CatAction")]
    157     public event EventHandler ResizeBegin;
    158     [SRCategory("CatAction"), SRDescription("FormOnResizeEndDescr")]
    159     public event EventHandler ResizeEnd;
    160     [SRCategory("CatPropertyChanged"), SRDescription("ControlOnRightToLeftLayoutChangedDescr")]
    161     public event EventHandler RightToLeftLayoutChanged;
    162     [SRCategory("CatBehavior"), SRDescription("FormOnShownDescr")]
    163     public event EventHandler Shown;
    164     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
    165     public event EventHandler TabIndexChanged;
    166     [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
    167     public event EventHandler TabStopChanged;
    168 
    169     // Methods
    170     static Form();
    171     public Form();
    172     public void Activate();
    173     protected void ActivateMdiChild(Form form);
    174     private void ActivateMdiChildInternal(Form form);
    175     public void AddOwnedForm(Form ownedForm);
    176     [EditorBrowsable(EditorBrowsableState.Advanced)]
    177     protected override void AdjustFormScrollbars(bool displayScrollbars);
    178     private float AdjustScale(float scale);
    179     private void AdjustSystemMenu();
    180     private void AdjustSystemMenu(IntPtr hmenu);
    181     internal override void AfterControlRemoved(Control control, Control oldParent);
    182     [EditorBrowsable(EditorBrowsableState.Never), Obsolete("This method has been deprecated. Use the ApplyAutoScaling method instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
    183     protected void ApplyAutoScaling();
    184     internal override Rectangle ApplyBoundsConstraints(int suggestedX, int suggestedY, int proposedWidth, int proposedHeight);
    185     private void ApplyClientSize();
    186     internal override void AssignParent(Control value);
    187     private void CallShownEvent();
    188     internal override bool CanProcessMnemonic();
    189     internal bool CanRecreateHandle();
    190     internal override bool CanSelectCore();
    191     protected void CenterToParent();
    192     protected void CenterToScreen();
    193     internal bool CheckCloseDialog(bool closingOnly);
    194     public void Close();
    195     private Size ComputeWindowSize(Size clientSize);
    196     private Size ComputeWindowSize(Size clientSize, int style, int exStyle);
    197     [EditorBrowsable(EditorBrowsableState.Advanced)]
    198     protected override Control.ControlCollection CreateControlsInstance();
    199     [EditorBrowsable(EditorBrowsableState.Advanced)]
    200     protected override void CreateHandle();
    201     private void DeactivateMdiChild();
    202     [EditorBrowsable(EditorBrowsableState.Advanced), SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
    203     protected override void DefWndProc(ref Message m);
    204     protected override void Dispose(bool disposing);
    205     private void EnsureSecurityInformation();
    206     private void FillInCreateParamsBorderIcons(CreateParams cp);
    207     private void FillInCreateParamsBorderStyles(CreateParams cp);
    208     private void FillInCreateParamsStartPosition(CreateParams cp);
    209     private void FillInCreateParamsWindowState(CreateParams cp);
    210     private static Type FindClosestStockType(Type type);
    211     internal override bool FocusInternal();
    212     [Obsolete("This method has been deprecated. Use the AutoScaleDimensions property instead.  http://go.microsoft.com/fwlink/?linkid=14202"), EditorBrowsable(EditorBrowsableState.Never)]
    213     public static SizeF GetAutoScaleSize(Font font);
    214     internal override Size GetPreferredSizeCore(Size proposedSize);
    215     [EditorBrowsable(EditorBrowsableState.Advanced)]
    216     protected override Rectangle GetScaledBounds(Rectangle bounds, SizeF factor, BoundsSpecified specified);
    217     private void InvalidateMergedMenu();
    218     public void LayoutMdi(MdiLayout value);
    219     internal void MenuChanged(int change, Menu menu);
    220     [EditorBrowsable(EditorBrowsableState.Advanced)]
    221     protected virtual void OnActivated(EventArgs e);
    222     internal override void OnAutoScaleModeChanged();
    223     protected override void OnBackgroundImageChanged(EventArgs e);
    224     protected override void OnBackgroundImageLayoutChanged(EventArgs e);
    225     [EditorBrowsable(EditorBrowsableState.Advanced)]
    226     protected virtual void OnClosed(EventArgs e);
    227     [EditorBrowsable(EditorBrowsableState.Advanced)]
    228     protected virtual void OnClosing(CancelEventArgs e);
    229     [EditorBrowsable(EditorBrowsableState.Advanced)]
    230     protected override void OnCreateControl();
    231     [EditorBrowsable(EditorBrowsableState.Advanced)]
    232     protected virtual void OnDeactivate(EventArgs e);
    233     [EditorBrowsable(EditorBrowsableState.Advanced)]
    234     protected override void OnEnabledChanged(EventArgs e);
    235     [EditorBrowsable(EditorBrowsableState.Advanced)]
    236     protected override void OnEnter(EventArgs e);
    237     [EditorBrowsable(EditorBrowsableState.Advanced)]
    238     protected override void OnFontChanged(EventArgs e);
    239     [EditorBrowsable(EditorBrowsableState.Advanced)]
    240     protected virtual void OnFormClosed(FormClosedEventArgs e);
    241     [EditorBrowsable(EditorBrowsableState.Advanced)]
    242     protected virtual void OnFormClosing(FormClosingEventArgs e);
    243     [EditorBrowsable(EditorBrowsableState.Advanced)]
    244     protected override void OnHandleCreated(EventArgs e);
    245     [EditorBrowsable(EditorBrowsableState.Advanced)]
    246     protected override void OnHandleDestroyed(EventArgs e);
    247     [EditorBrowsable(EditorBrowsableState.Advanced)]
    248     protected virtual void OnHelpButtonClicked(CancelEventArgs e);
    249     [EditorBrowsable(EditorBrowsableState.Advanced)]
    250     protected virtual void OnInputLanguageChanged(InputLanguageChangedEventArgs e);
    251     [EditorBrowsable(EditorBrowsableState.Advanced)]
    252     protected virtual void OnInputLanguageChanging(InputLanguageChangingEventArgs e);
    253     protected override void OnLayout(LayoutEventArgs levent);
    254     [EditorBrowsable(EditorBrowsableState.Advanced)]
    255     protected virtual void OnLoad(EventArgs e);
    256     [EditorBrowsable(EditorBrowsableState.Advanced)]
    257     protected virtual void OnMaximizedBoundsChanged(EventArgs e);
    258     [EditorBrowsable(EditorBrowsableState.Advanced)]
    259     protected virtual void OnMaximumSizeChanged(EventArgs e);
    260     [EditorBrowsable(EditorBrowsableState.Advanced)]
    261     protected virtual void OnMdiChildActivate(EventArgs e);
    262     [EditorBrowsable(EditorBrowsableState.Advanced)]
    263     protected virtual void OnMenuComplete(EventArgs e);
    264     [EditorBrowsable(EditorBrowsableState.Advanced)]
    265     protected virtual void OnMenuStart(EventArgs e);
    266     [EditorBrowsable(EditorBrowsableState.Advanced)]
    267     protected virtual void OnMinimumSizeChanged(EventArgs e);
    268     [EditorBrowsable(EditorBrowsableState.Advanced)]
    269     protected override void OnPaint(PaintEventArgs e);
    270     [EditorBrowsable(EditorBrowsableState.Advanced)]
    271     protected override void OnResize(EventArgs e);
    272     [EditorBrowsable(EditorBrowsableState.Advanced)]
    273     protected virtual void OnResizeBegin(EventArgs e);
    274     [EditorBrowsable(EditorBrowsableState.Advanced)]
    275     protected virtual void OnResizeEnd(EventArgs e);
    276     [EditorBrowsable(EditorBrowsableState.Advanced)]
    277     protected virtual void OnRightToLeftLayoutChanged(EventArgs e);
    278     [EditorBrowsable(EditorBrowsableState.Advanced)]
    279     protected virtual void OnShown(EventArgs e);
    280     [EditorBrowsable(EditorBrowsableState.Advanced)]
    281     protected override void OnStyleChanged(EventArgs e);
    282     [EditorBrowsable(EditorBrowsableState.Advanced)]
    283     protected override void OnTextChanged(EventArgs e);
    284     [EditorBrowsable(EditorBrowsableState.Advanced)]
    285     protected override void OnVisibleChanged(EventArgs e);
    286     internal void PerformOnInputLanguageChanged(InputLanguageChangedEventArgs iplevent);
    287     internal void PerformOnInputLanguageChanging(InputLanguageChangingEventArgs iplcevent);
    288     [SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
    289     protected override bool ProcessCmdKey(ref Message msg, Keys keyData);
    290     [EditorBrowsable(EditorBrowsableState.Advanced), UIPermission(SecurityAction.LinkDemand, Window=UIPermissionWindow.AllWindows)]
    291     protected override bool ProcessDialogChar(char charCode);
    292     [UIPermission(SecurityAction.LinkDemand, Window=UIPermissionWindow.AllWindows)]
    293     protected override bool ProcessDialogKey(Keys keyData);
    294     [SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
    295     protected override bool ProcessKeyPreview(ref Message m);
    296     [UIPermission(SecurityAction.LinkDemand, Window=UIPermissionWindow.AllWindows)]
    297     protected internal override bool ProcessMnemonic(char charCode);
    298     [UIPermission(SecurityAction.LinkDemand, Window=UIPermissionWindow.AllWindows)]
    299     protected override bool ProcessTabKey(bool forward);
    300     internal void RaiseFormClosedOnAppExit();
    301     internal bool RaiseFormClosingOnAppExit();
    302     internal override void RecreateHandleCore();
    303     public void RemoveOwnedForm(Form ownedForm);
    304     private void ResetIcon();
    305     private void ResetSecurityTip(bool modalOnly);
    306     private void ResetTransparencyKey();
    307     private void ResolveZoneAndSiteNames(ArrayList sites, ref string securityZone, ref string securitySite);
    308     private void RestoreWindowBoundsIfNecessary();
    309     private void RestrictedProcessNcActivate();
    310     private string RestrictedWindowText(string original);
    311     private void ResumeLayoutFromMinimize();
    312     private void ResumeUpdateMenuHandles();
    313     [EditorBrowsable(EditorBrowsableState.Advanced)]
    314     protected override void ScaleControl(SizeF factor, BoundsSpecified specified);
    315     [EditorBrowsable(EditorBrowsableState.Never)]
    316     protected override void ScaleCore(float x, float y);
    317     protected override void Select(bool directed, bool forward);
    318     private void SelectInternal(bool directed, bool forward);
    319     [EditorBrowsable(EditorBrowsableState.Advanced)]
    320     protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified);
    321     [EditorBrowsable(EditorBrowsableState.Advanced)]
    322     protected override void SetClientSizeCore(int x, int y);
    323     private void SetDefaultButton(IButtonControl button);
    324     public void SetDesktopBounds(int x, int y, int width, int height);
    325     public void SetDesktopLocation(int x, int y);
    326     [EditorBrowsable(EditorBrowsableState.Advanced)]
    327     protected override void SetVisibleCore(bool value);
    328     [EditorBrowsable(EditorBrowsableState.Never)]
    329     internal virtual bool ShouldSerializeAutoScaleBaseSize();
    330     private bool ShouldSerializeClientSize();
    331     private bool ShouldSerializeIcon();
    332     [EditorBrowsable(EditorBrowsableState.Never)]
    333     private bool ShouldSerializeLocation();
    334     [EditorBrowsable(EditorBrowsableState.Never)]
    335     internal override bool ShouldSerializeSize();
    336     [EditorBrowsable(EditorBrowsableState.Never)]
    337     internal bool ShouldSerializeTransparencyKey();
    338     public void Show(IWin32Window owner);
    339     public DialogResult ShowDialog();
    340     public DialogResult ShowDialog(IWin32Window owner);
    341     private void SuspendLayoutForMinimize();
    342     private void SuspendUpdateMenuHandles();
    343     public override string ToString();
    344     private void UpdateAutoScaleBaseSize();
    345     protected override void UpdateDefaultButton();
    346     internal void UpdateFormStyles();
    347     private void UpdateHandleWithOwner();
    348     private void UpdateLayered();
    349     private void UpdateMdiControlStrip(bool maximized);
    350     internal void UpdateMdiWindowListStrip();
    351     private void UpdateMenuHandles();
    352     private void UpdateMenuHandles(MainMenu menu, bool forceRedraw);
    353     private void UpdateRenderSizeGrip();
    354     private void UpdateToolStrip();
    355     private void UpdateWindowIcon(bool redrawFrame);
    356     private void UpdateWindowState();
    357     [EditorBrowsable(EditorBrowsableState.Always), Browsable(true)]
    358     public override bool ValidateChildren();
    359     [EditorBrowsable(EditorBrowsableState.Always), Browsable(true)]
    360     public override bool ValidateChildren(ValidationConstraints validationConstraints);
    361     private void WmActivate(ref Message m);
    362     private void WmClose(ref Message m);
    363     private void WmCreate(ref Message m);
    364     private void WmEnterMenuLoop(ref Message m);
    365     private void WmEnterSizeMove(ref Message m);
    366     private void WmEraseBkgnd(ref Message m);
    367     private void WmExitMenuLoop(ref Message m);
    368     private void WmExitSizeMove(ref Message m);
    369     private void WmGetMinMaxInfo(ref Message m);
    370     private void WmGetMinMaxInfoHelper(ref Message m, Size minTrack, Size maxTrack, Rectangle maximizedBounds);
    371     private void WmInitMenuPopup(ref Message m);
    372     private void WmMdiActivate(ref Message m);
    373     private void WmMenuChar(ref Message m);
    374     private void WmNcButtonDown(ref Message m);
    375     private void WmNCDestroy(ref Message m);
    376     private void WmNCHitTest(ref Message m);
    377     private void WmShowWindow(ref Message m);
    378     private void WmSize(ref Message m);
    379     private void WmSysCommand(ref Message m);
    380     private void WmUnInitMenuPopup(ref Message m);
    381     private void WmWindowPosChanged(ref Message m);
    382     [EditorBrowsable(EditorBrowsableState.Advanced), SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
    383     protected override void WndProc(ref Message m);
    384 
    385     // Properties
    386     [DefaultValue((string) null), SRDescription("FormAcceptButtonDescr")]
    387     public IButtonControl AcceptButton { get; set; }
    388     internal bool Active { get; set; }
    389     public static Form ActiveForm { get; }
    390     [SRDescription("FormActiveMDIChildDescr"), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    391     public Form ActiveMdiChild { get; }
    392     internal Form ActiveMdiChildInternal { get; set; }
    393     [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), SRDescription("ControlAllowTransparencyDescr"), Browsable(false)]
    394     public bool AllowTransparency { get; set; }
    395     [SRDescription("FormAutoScaleDescr"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Obsolete("This property has been deprecated. Use the AutoScaleMode property instead.  http://go.microsoft.com/fwlink/?linkid=14202"), EditorBrowsable(EditorBrowsableState.Never), SRCategory("CatLayout"), Browsable(false)]
    396     public bool AutoScale { get; set; }
    397     [EditorBrowsable(EditorBrowsableState.Never), Localizable(true), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    398     public virtual Size AutoScaleBaseSize { get; set; }
    399     [Localizable(true)]
    400     public override bool AutoScroll { get; set; }
    401     [Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), EditorBrowsable(EditorBrowsableState.Always)]
    402     public override bool AutoSize { get; set; }
    403     [SRDescription("ControlAutoSizeModeDescr"), Localizable(true), SRCategory("CatLayout"), Browsable(true), DefaultValue(1)]
    404     public AutoSizeMode AutoSizeMode { get; set; }
    405     [Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
    406     public override AutoValidate AutoValidate { get; set; }
    407     public override Color BackColor { get; set; }
    408     private bool CalledClosing { get; set; }
    409     private bool CalledCreateControl { get; set; }
    410     private bool CalledMakeVisible { get; set; }
    411     private bool CalledOnLoad { get; set; }
    412     [DefaultValue((string) null), SRDescription("FormCancelButtonDescr")]
    413     public IButtonControl CancelButton { get; set; }
    414     [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), Localizable(true)]
    415     public Size ClientSize { get; set; }
    416     internal CloseReason CloseReason { get; set; }
    417     [DefaultValue(true), SRCategory("CatWindowStyle"), SRDescription("FormControlBoxDescr")]
    418     public bool ControlBox { get; set; }
    419     protected override CreateParams CreateParams { [SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)] get; }
    420     internal static Icon DefaultIcon { get; }
    421     protected override ImeMode DefaultImeMode { get; }
    422     private static Icon DefaultRestrictedIcon { get; }
    423     protected override Size DefaultSize { get; }
    424     [Browsable(false), SRCategory("CatLayout"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), SRDescription("FormDesktopBoundsDescr")]
    425     public Rectangle DesktopBounds { get; set; }
    426     [SRDescription("FormDesktopLocationDescr"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false), SRCategory("CatLayout")]
    427     public Point DesktopLocation { get; set; }
    428     [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), SRDescription("FormDialogResultDescr"), SRCategory("CatBehavior")]
    429     public DialogResult DialogResult { get; set; }
    430     [SRDescription("FormBorderStyleDescr"), SRCategory("CatAppearance"), DefaultValue(4), DispId(-504)]
    431     public FormBorderStyle FormBorderStyle { get; set; }
    432     private Form FormerlyActiveMdiChild { get; set; }
    433     internal override bool HasMenu { get; }
    434     [DefaultValue(false), SRDescription("FormHelpButtonDescr"), SRCategory("CatWindowStyle")]
    435     public bool HelpButton { get; set; }
    436     [SRDescription("FormIconDescr"), Localizable(true), AmbientValue((string) null), SRCategory("CatWindowStyle")]
    437     public Icon Icon { get; set; }
    438     private bool IsClosing { get; set; }
    439     private bool IsMaximized { get; }
    440     [SRCategory("CatWindowStyle"), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), SRDescription("FormIsMDIChildDescr")]
    441     public bool IsMdiChild { get; }
    442     internal bool IsMdiChildFocusable { get; set; }
    443     [SRCategory("CatWindowStyle"), SRDescription("FormIsMDIContainerDescr"), DefaultValue(false)]
    444     public bool IsMdiContainer { get; set; }
    445     [Browsable(false), EditorBrowsable(EditorBrowsableState.Advanced)]
    446     public bool IsRestrictedWindow { get; }
    447     [SRDescription("FormKeyPreviewDescr"), DefaultValue(false)]
    448     public bool KeyPreview { get; set; }
    449     [SettingsBindable(true)]
    450     public Point Location { get; set; }
    451     [SRCategory("CatWindowStyle"), TypeConverter(typeof(ReferenceConverter)), DefaultValue((string) null), SRDescription("FormMenuStripDescr")]
    452     public MenuStrip MainMenuStrip { get; set; }
    453     [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
    454     public Padding Margin { get; set; }
    455     [DefaultValue(true), SRDescription("FormMaximizeBoxDescr"), SRCategory("CatWindowStyle")]
    456     public bool MaximizeBox { get; set; }
    457     protected Rectangle MaximizedBounds { get; set; }
    458     [SRCategory("CatLayout"), Localizable(true), SRDescription("FormMaximumSizeDescr"), RefreshProperties(RefreshProperties.Repaint), DefaultValue(typeof(Size), "0, 0")]
    459     public override Size MaximumSize { get; set; }
    460     [SRDescription("FormMDIChildrenDescr"), SRCategory("CatWindowStyle"), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    461     public Form[] MdiChildren { get; }
    462     internal MdiClient MdiClient { get; }
    463     private MdiControlStrip MdiControlStrip { get; set; }
    464     [SRCategory("CatWindowStyle"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), SRDescription("FormMDIParentDescr"), Browsable(false)]
    465     public Form MdiParent { get; set; }
    466     private Form MdiParentInternal { get; set; }
    467     private MdiWindowListStrip MdiWindowListStrip { get; set; }
    468     [DefaultValue((string) null), Browsable(false), SRCategory("CatWindowStyle"), SRDescription("FormMenuDescr"), TypeConverter(typeof(ReferenceConverter))]
    469     public MainMenu Menu { get; set; }
    470     [SRDescription("FormMergedMenuDescr"), EditorBrowsable(EditorBrowsableState.Advanced), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), SRCategory("CatWindowStyle"), Browsable(false)]
    471     public MainMenu MergedMenu { [UIPermission(SecurityAction.Demand, Window=UIPermissionWindow.AllWindows)] get; }
    472     private MainMenu MergedMenuPrivate { get; }
    473     [DefaultValue(true), SRDescription("FormMinimizeBoxDescr"), SRCategory("CatWindowStyle")]
    474     public bool MinimizeBox { get; set; }
    475     [SRCategory("CatLayout"), RefreshProperties(RefreshProperties.Repaint), SRDescription("FormMinimumSizeDescr"), Localizable(true)]
    476     public override Size MinimumSize { get; set; }
    477     [SRDescription("FormModalDescr"), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), SRCategory("CatWindowStyle")]
    478     public bool Modal { get; }
    479     [SRCategory("CatWindowStyle"), TypeConverter(typeof(OpacityConverter)), SRDescription("FormOpacityDescr"), DefaultValue((double) 1.0)]
    480     public double Opacity { get; set; }
    481     private byte OpacityAsByte { get; }
    482     [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), SRCategory("CatWindowStyle"), SRDescription("FormOwnedFormsDescr"), Browsable(false)]
    483     public Form[] OwnedForms { get; }
    484     [SRCategory("CatWindowStyle"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false), SRDescription("FormOwnerDescr")]
    485     public Form Owner { get; set; }
    486     internal Form OwnerInternal { get; }
    487     internal override Control ParentInternal { get; set; }
    488     [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
    489     public Rectangle RestoreBounds { get; }
    490     [SRDescription("ControlRightToLeftLayoutDescr"), SRCategory("CatAppearance"), Localizable(true), DefaultValue(false)]
    491     public virtual bool RightToLeftLayout { get; set; }
    492     [SRCategory("CatWindowStyle"), SRDescription("FormShowIconDescr"), DefaultValue(true)]
    493     public bool ShowIcon { get; set; }
    494     [DefaultValue(true), SRCategory("CatWindowStyle"), SRDescription("FormShowInTaskbarDescr")]
    495     public bool ShowInTaskbar { get; set; }
    496     internal override int ShowParams { get; }
    497     [Browsable(false)]
    498     protected virtual bool ShowWithoutActivation { get; }
    499     [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Localizable(false)]
    500     public Size Size { get; set; }
    501     [SRCategory("CatWindowStyle"), SRDescription("FormSizeGripStyleDescr"), DefaultValue(0)]
    502     public SizeGripStyle SizeGripStyle { get; set; }
    503     [SRCategory("CatLayout"), SRDescription("FormStartPositionDescr"), Localizable(true), DefaultValue(2)]
    504     public FormStartPosition StartPosition { get; set; }
    505     [EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
    506     public int TabIndex { get; set; }
    507     [DispId(-516), SRCategory("CatBehavior"), Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DefaultValue(true), SRDescription("ControlTabStopDescr")]
    508     public bool TabStop { get; set; }
    509     private HandleRef TaskbarOwner { get; }
    510     [SettingsBindable(true)]
    511     public override string Text { get; set; }
    512     [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false), EditorBrowsable(EditorBrowsableState.Advanced)]
    513     public bool TopLevel { get; set; }
    514     [SRDescription("FormTopMostDescr"), SRCategory("CatWindowStyle"), DefaultValue(false)]
    515     public bool TopMost { get; set; }
    516     [SRCategory("CatWindowStyle"), SRDescription("FormTransparencyKeyDescr")]
    517     public Color TransparencyKey { get; set; }
    518     [DefaultValue(0), SRCategory("CatLayout"), SRDescription("FormWindowStateDescr")]
    519     public FormWindowState WindowState { get; set; }
    520     internal override string WindowText { get; set; }
    521 
    522     // Nested Types
    523     [ComVisible(false)]
    524     public class ControlCollection : Control.ControlCollection
    525     {
    526         // Fields
    527         private Form owner;
    528 
    529         // Methods
    530         public ControlCollection(Form owner);
    531         public override void Add(Control value);
    532         public override void Remove(Control value);
    533     }
    534 
    535     private class EnumThreadWindowsCallback
    536     {
    537         // Fields
    538         private List<HandleRef> ownedWindows;
    539 
    540         // Methods
    541         internal EnumThreadWindowsCallback();
    542         internal bool Callback(IntPtr hWnd, IntPtr lParam);
    543         internal void ResetOwners();
    544         internal void SetOwners(HandleRef hRefOwner);
    545     }
    546 
    547     private class SecurityToolTip : IDisposable
    548     {
    549         // Fields
    550         private bool first;
    551         private Form owner;
    552         private string toolTipText;
    553         private ToolTipNativeWindow window;
    554 
    555         // Methods
    556         internal SecurityToolTip(Form owner);
    557         public void Dispose();
    558         private void FormHandleCreated(object sender, EventArgs e);
    559         private void FormLocationChanged(object sender, EventArgs e);
    560         private NativeMethods.TOOLINFO_T GetTOOLINFO();
    561         internal void Pop(bool noLongerFirst);
    562         private void RecreateHandle();
    563         private void SetupText();
    564         private void SetupToolTip();
    565         internal void Show();
    566         private void WndProc(ref Message msg);
    567 
    568         // Properties
    569         private CreateParams CreateParams { get; }
    570         internal bool Modal { get; }
    571 
    572         // Nested Types
    573         private sealed class ToolTipNativeWindow : NativeWindow
    574         {
    575             // Fields
    576             private Form.SecurityToolTip control;
    577 
    578             // Methods
    579             internal ToolTipNativeWindow(Form.SecurityToolTip control);
    580             protected override void WndProc(ref Message m);
    581         }
    582     }
    583 }
    View Code
    Expand Methods
  • 相关阅读:
    .NET基础示例系列之十二:DLLImport
    .NET基础示例系列之二:Socket
    Qt之msvcversion.conf loaded but QMAKE_MSC_VER isn‘t set
    Ubuntu安装sshd
    Quick工程设置exe图标
    git修改文件之后上传
    VS里打开Qt的pro工程
    QtQWebEngineView显示百度网页
    在gitte建立新仓库并上传本地工程
    Qt的qDebug打印加颜色
  • 原文地址:https://www.cnblogs.com/qingtianhua/p/3480070.html
Copyright © 2020-2023  润新知