zoukankan      html  css  js  c++  java
  • C#调用API 实现窗体总在最上

    class Win32
            {
                [DllImport("user32.dll", EntryPoint = "SetWindowPos")]
                public static extern bool SetWindowPos(
                    int hWnd,               // window handle     
                    int hWndInsertAfter,    // placement-order handle     
                    int X,                  // horizontal position     
                    int Y,                  // vertical position     
                    int cx,                 // width     
                    int cy,                 // height     
                    uint uFlags);           // window positioning flags  
                public const int HWND_BOTTOM = 0x1;
                public const uint SWP_NOSIZE = 0x1;
                public const uint SWP_NOMOVE = 0x2;
                public const uint SWP_SHOWWINDOW = 0x40;
            }

            private void ShoveToBackground()
            {
                Win32.SetWindowPos((int)this.Handle, -1, this.Location.X, this.Location.Y, this.Size.Width, this.Size.Height, 1);

                //Win32.SetWindowPos(
                //    (int)this.Handle,
                //    (int),
                //    0, 0, 0, 0,
                //    Win32.SWP_NOMOVE | Win32.SWP_NOSIZE | Win32.HWND_BOTTOM);
            }

            private void Bar_Activated(object sender, EventArgs e)
            {
                //总在最上
                ShoveToBackground();
            }
            private void Bar_Leave(object sender, EventArgs e)
            {
                //总在最上
                ShoveToBackground();
            }

  • 相关阅读:
    学习GlusterFS(二)
    并不对劲的莫比乌斯反演
    并不对劲的WC2019
    并不对劲的loj2134:uoj132:p2304:[NOI2015]小园丁与老司机
    并不对劲的bzoj3626:loj2558:p4211:[LNOI2014]LCA
    并不对劲的bzoj3214:p3333:[ZJOI2013]丽洁体
    并不对劲的bzoj4827:loj2020:p3723:[AHOI/HNOI2017]礼物
    并不对劲的bzoj4560:p3269:[JLOI2016]字符串覆盖
    并不对劲的p2664树上游戏
    并不对劲的p3709:大爷的字符串题
  • 原文地址:https://www.cnblogs.com/yinhaosln/p/1504482.html
Copyright © 2011-2022 走看看