zoukankan      html  css  js  c++  java
  • 搜集一些控件底层参数控制的代码

            ////private const int CS_DROPSHADOW = 0x00020000;
            /////// <summary>
            /////// 窗口显示阴影
            /////// </summary>
            ////protected override CreateParams CreateParams
            ////{
            ////    get
            ////    {
            ////        CreateParams cp = base.CreateParams;
            ////        cp.ClassStyle |= CS_DROPSHADOW;
            ////        return cp;
            ////    }
            ////}

            ////private const int CP_NOCLOSE_BUTTON = 0x200;
            /////// <summary>
            /////// 禁止关闭按钮,Alt F4也无效
            /////// </summary>
            ////protected override CreateParams CreateParams
            ////{
            ////    get
            ////    {
            ////        CreateParams myCp = base.CreateParams;
            ////        myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;
            ////        return myCp;
            ////    }
            ////}

            ////protected override CreateParams CreateParams
            ////{
            ////    get
            ////    {
            ////        int WS_EX_TOOLWINDOW = 0x80;
            ////        CreateParams CP = base.CreateParams;

            ////        CP.ExStyle = CP.ExStyle | WS_EX_TOOLWINDOW;
            ////        return CP;
            ////    }
            ////}

            ////protected override CreateParams CreateParams
            ////{
            ////    get
            ////    {
            ////        const int WS_EX_APPWINDOW = 0x00040000;
            ////        const int WS_EX_TOOLWINDOW = 0x00000080;

            ////        CreateParams result = base.CreateParams;
            ////        result.ExStyle = result.ExStyle & (~WS_EX_APPWINDOW);
            ////        result.ExStyle = result.ExStyle | WS_EX_TOOLWINDOW;
            ////        return result;
            ////    }
            ////}

            /////// <summary>
            /////// 设为没有焦点
            /////// </summary>
            ////protected override CreateParams CreateParams
            ////{
            ////    get
            ////    {
            ////        CreateParams cp = base.CreateParams;
            ////        cp.ExStyle |= (int)0x08000000L;      //把窗体设置成WS_EX_NOACTIVATE样式
            ////        return cp;
            ////    }
            ////}


            //使控制不接受焦点--------------------
            ////[System.Runtime.InteropServices.DllImport("user32.dll")]
            ////private extern static IntPtr SetActiveWindow(IntPtr handle);

            ////private const int WM_ACTIVATE = 0x006;
            ////private const int WM_ACTIVATEAPP = 0x01C;
            ////private const int WM_NCACTIVATE = 0x086;
            ////private const int WA_INACTIVE = 0;
            ////private const int WM_MOUSEACTIVATE = 0x21;
            ////private const int MA_NOACTIVATE = 3;
           
            ////protected override void WndProc(ref Message m)
            ////{
            ////    if (m.Msg == WM_MOUSEACTIVATE)
            ////    {
            ////        m.Result = new IntPtr(MA_NOACTIVATE);
            ////        return;
            ////    }
            ////    else if (m.Msg == WM_NCACTIVATE)
            ////    {
            ////        if (((int)m.WParam & 0xFFFF) != WA_INACTIVE)
            ////        {
            ////            if (m.LParam != IntPtr.Zero)
            ////            {
            ////                SetActiveWindow(m.LParam);
            ////            }
            ////            else
            ////            {
            ////                SetActiveWindow(IntPtr.Zero);
            ////            }
            ////        }
            ////    }
            ////    base.WndProc(ref m);
            ////}
            //--------------------------------------------------
    public class RichEdit50 : RichTextBox
        {
            [DllImport(
    "kernel32.dll", CharSet = CharSet.Auto)]
           
    static extern IntPtr LoadLibrary(string lpFileName);

           
    protected override CreateParams CreateParams
            {
               
    get
                {
                    CreateParams prams
    = base.CreateParams;
                   
    if (LoadLibrary("msftedit.dll") != IntPtr.Zero)
                    {
                        prams.ExStyle
    |= 0x020; // transparent
                        prams.ClassName = "RICHEDIT50W";
                    }
                   
    return prams;
                }
            }
        }
    public class MyTextBox : TextBox
    {
        public MyTextBox()
        {
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
        }
    }

  • 相关阅读:
    常量池 栈 堆
    函数的调用
    字符、数组
    整理
    JavaScript深入之——原型与原型链
    虚拟机(VMware)中文破解版,及创建虚拟机
    小程序之mpvue使用
    报错整理及解决办法
    js 关于时间方面的通用函数
    iview Cascader级联选择省市区问题
  • 原文地址:https://www.cnblogs.com/Yjianyong/p/1648024.html
Copyright © 2011-2022 走看看