zoukankan      html  css  js  c++  java
  • WPF 通过Win32SDK修改窗口样式

    使用函数为

    SetWindowLong

    GetWindowLong

    注册函数

           
            [DllImport("user32.dll", EntryPoint = "GetWindowLong")]
            public static extern int GetWindowLong(IntPtr hwnd, int nIndex);
    
            [DllImport("user32.dll", EntryPoint = "SetWindowLong")]
            public static extern int SetWindowLong(IntPtr hMenu, int nIndex, int dwNewLong);

    使用函数

    private void DisableSizebox()
            {
                int GWL_STYLE = -16;
                int WS_THICKFRAME = 0x00040000;
                IntPtr handle = new WindowInteropHelper(this).Handle;
                int  nStyle = GetWindowLong(handle, GWL_STYLE);
    //禁用调整窗口大小 nStyle
    &= ~WS_THICKFRAME; SetWindowLong(handle, GWL_STYLE,nStyle); }

    注意 启用窗口样式为

    nStyle|=WS_THICKFRAME

    如果是多个样式启用或者禁止为

    //禁用
    nStyle &= ~WS_CAPTION&~WS_MINIMIZEBOX;
    //启用
    nStyle |= WS_MAXIMIZEBOX| WS_CAPTION;

    具体样式请参考具体Windows Style

    注意:msdn中均为Long型,去掉L即可为int,

    本函数均为32位,对应64位请参考网页的GetWindowLongPtrASetWindowLongPtrA使用方法不变

  • 相关阅读:
    软件测试:Homework 3
    软件测试:Lab 1
    软件测试:Homework 2
    软件测试:Homework 1
    JAVA的回忆
    Java 操作符
    Java 笔录
    经典C#编程理解,概要,经典
    网络精灵
    签到计时
  • 原文地址:https://www.cnblogs.com/T-ARF/p/11386907.html
Copyright © 2011-2022 走看看