private static COMBOBOXINFO GetComboBoxInfo(System.Windows.Forms.Control control) { COMBOBOXINFO info = new COMBOBOXINFO(); info.cbSize = Marshal.SizeOf(info); Win32API.GetComboBoxInfo(control.Handle, ref info); return(info); }
public static void SetCueText(System.Windows.Forms.Control control, String text) { if (control is ComboBox) { COMBOBOXINFO info = GetComboBoxInfo(control); Win32API.SendMessage(info.hwndItem, Win32Constants.EM_SETCUEBANNER, 0, text); } else { Win32API.SendMessage(control.Handle, Win32Constants.EM_SETCUEBANNER, 0, text); } }
public static String GetCueText(System.Windows.Forms.Control control) { StringBuilder builder = new StringBuilder(); if (control is ComboBox) { COMBOBOXINFO info = new COMBOBOXINFO(); info.cbSize = Marshal.SizeOf(info); Win32API.GetComboBoxInfo(control.Handle, ref info); Win32API.SendMessage(info.hwndItem, Win32Constants.EM_GETCUEBANNER, 0, builder); } else { Win32API.SendMessage(control.Handle, Win32Constants.EM_GETCUEBANNER, 0, builder); } return(builder.ToString()); }
public static extern Boolean GetComboBoxInfo(IntPtr hwnd, ref COMBOBOXINFO pcbi);