国产97色在线|亚洲-欧美人妻另类制服丝袜-欧美人成国产91视频-殷素素一女战二夫|www.ycjrc.net

Winform 加載時各事件的順序(二)

發(fā)布時間:2020-08-06 21:34 作者:獨孤劍 閱讀:1755

Winform 加載時各事件的順序

using System;
using System.Windows.Forms;

namespace WindowsFormsApp13
{
    /*
        public Form1 before InitializeComponent
        OnResize before base.OnResize
        OnResize after base.OnResize
        OnClientSizeChanged before base.OnClientSizeChanged
        OnClientSizeChanged after base.OnClientSizeChanged
        OnClientSizeChanged before base.OnClientSizeChanged
        OnClientSizeChanged after base.OnClientSizeChanged
        public Form1 after InitializeComponent
        OnCreateControl before base.OnCreateControl
        OnLoad before base.OnLoad
        OnLoad after base.OnLoad
        OnCreateControl after base.OnCreateControl
        OnGotFocus before base.OnGotFocus
        OnGotFocus after base.OnGotFocus
        OnActivated before base.OnActivated
        OnActivated after base.OnActivated
        OnShown before base.OnShown
        OnShown after base.OnShown
     */
    public partial class Form1 : Form
    {
        public Form1()
        {
            Console.WriteLine("public Form1 before InitializeComponent");
            InitializeComponent();
            Console.WriteLine("public Form1 after InitializeComponent");
        }
        protected override void OnActivated(EventArgs e)
        {
            Console.WriteLine("OnActivated before base.OnActivated");
            base.OnActivated(e);
            Console.WriteLine("OnActivated after base.OnActivated");
        }
        protected override void OnClientSizeChanged(EventArgs e)
        {
            Console.WriteLine("OnClientSizeChanged before base.OnClientSizeChanged");
            base.OnClientSizeChanged(e);
            Console.WriteLine("OnClientSizeChanged after base.OnClientSizeChanged");
        }
        protected override void OnCreateControl()
        {
            Console.WriteLine("OnCreateControl before base.OnCreateControl");
            base.OnCreateControl();
            Console.WriteLine("OnCreateControl after base.OnCreateControl");
        }
        protected override void OnGotFocus(EventArgs e)
        {
            Console.WriteLine("OnGotFocus before base.OnGotFocus");
            base.OnGotFocus(e);
            Console.WriteLine("OnGotFocus after base.OnGotFocus");
        }
        protected override void OnLoad(EventArgs e)
        {
            Console.WriteLine("OnLoad before base.OnLoad");
            base.OnLoad(e);
            Console.WriteLine("OnLoad after base.OnLoad");
        }
        protected override void OnResize(EventArgs e)
        {
            Console.WriteLine("OnResize before base.OnResize");
            base.OnResize(e);
            Console.WriteLine("OnResize after base.OnResize");
        }
        protected override void OnShown(EventArgs e)
        {
            Console.WriteLine("OnShown before base.OnShown");
            base.OnShown(e);
            Console.WriteLine("OnShown after base.OnShown");
        }
    }
}


微信打賞, 微信掃一掃

支付寶打賞, 支付寶掃一掃

如果文章對您有幫助,歡迎給作者打賞

作者最新文章
開發(fā)過程中解決360兼容模式瀏覽器的方法
云南象群向西南方向遷移,云南離群獨象距離象群約12公里
吉林做網(wǎng)站最低價格,吉林企業(yè)網(wǎng)站建設(shè)價格低至500元起
守象人直擊云南象群最新動向
網(wǎng)站影響百度蜘蛛抓取量的因素有哪些?為什么我的網(wǎng)站Baidu蜘蛛來的次數(shù)少?
企業(yè)名片
在線客服