Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.77 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ComboBox Cue Banner not italic when DropDownStyle is DropDown
  2. using System;
  3. using System.Windows.Forms;
  4. using System.Runtime.InteropServices;
  5.  
  6. class CueComboBox : ComboBox {
  7.     private string mCue;
  8.     public string Cue {
  9.         get { return mCue; }
  10.         set {
  11.             mCue = value;
  12.             updateCue();
  13.         }
  14.     }
  15.     private void updateCue() {
  16.         if (this.IsHandleCreated && mCue != null) {
  17.             SendMessage(this.Handle, 0x1703, (IntPtr)0, mCue);
  18.         }
  19.     }
  20.     protected override void OnHandleCreated(EventArgs e) {
  21.         base.OnHandleCreated(e);
  22.         updateCue();
  23.     }
  24.     // P/Invoke
  25.     [DllImport("user32.dll", CharSet = CharSet.Unicode)]
  26.     private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, string lp);
  27. }