zoukankan      html  css  js  c++  java
  • combobox只读代码

     1 public partial class Form1: Form
     2     {
     3         // combobox只读代码
     4         [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
     5         public static extern IntPtr GetWindow(IntPtr hWnd, int uCmd);
     6         int GW_CHILD = 5;
     7         [DllImport("user32.dll", CharSet = CharSet.Auto)]
     8         public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
     9         public const int EM_SETREADONLY = 0xcf; 
    10         //构造函数
    11         public Form1()
    12         {
    13             InitializeComponent();
    14             IntPtr editHandle = GetWindow(this.comboBox1.Handle, GW_CHILD);
    15             SendMessage(editHandle, EM_SETREADONLY,1,0); //第四个参数"0"代表只读,设置为"1"为可编辑
    16 } 17 }
  • 相关阅读:
    JS 对象定义
    JavaScript HTML DOM 元素(节点)
    DOM 事件
    DOM CSS
    DOM HTML
    DOM 简介
    JS 验证
    JS 错误
    JavaScript Break 和 Continue 语句
    JS While
  • 原文地址:https://www.cnblogs.com/net-study/p/3174049.html
Copyright © 2011-2022 走看看