public partial class Form1 : Form {
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern IntPtr GetWindow(IntPtr hWnd, int uCmd); int GW_CHILD = 5;
[DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, int lParam); public const int EM_SETREADONLY = 0xcf;
public Form1() { InitializeComponent();
IntPtr editHandle = GetWindow(comboBox1.Handle, GW_CHILD); SendMessage(editHandle, EM_SETREADONLY, 1, 0);
} }