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();
            }

  • 相关阅读:
    iOS开发——keychain的使用
    iOS开发——策略模式
    iOS开发——MVC模式
    iOS开发——代理模式
    ExtjsCode_Test02Panel.js
    网站收藏
    关于ExtJs Form表单的赋值、获取、重置
    ExtJS分页start,limit,pageSize的研究
    使Grid可编辑
    如何禁用Grid中的ToolBar中的Button
  • 原文地址:https://www.cnblogs.com/yinhaosln/p/1504482.html
Copyright © 2011-2022 走看看