Click here to Skip to main content
15,912,400 members
Home / Discussions / C#
   

C#

 
GeneralRe: SendMessage issue Pin
Heath Stewart27-Dec-04 10:12
protectorHeath Stewart27-Dec-04 10:12 
GeneralRe: SendMessage issue Pin
Aviv Halperin27-Dec-04 20:41
Aviv Halperin27-Dec-04 20:41 
GeneralRe: SendMessage issue Pin
Heath Stewart28-Dec-04 5:01
protectorHeath Stewart28-Dec-04 5:01 
GeneralPrinting RichText text and image Pin
srunion23-Dec-04 9:53
srunion23-Dec-04 9:53 
GeneralRe: Printing RichText text and image Pin
Jay Shankar23-Dec-04 14:20
Jay Shankar23-Dec-04 14:20 
General.NET CF and SendMessage Pin
Aviv Halperin23-Dec-04 9:18
Aviv Halperin23-Dec-04 9:18 
GeneralXP Style problem Pin
Stanciu Vlad23-Dec-04 8:31
Stanciu Vlad23-Dec-04 8:31 
GeneralRe: XP Style problem Pin
Heath Stewart23-Dec-04 9:08
protectorHeath Stewart23-Dec-04 9:08 
The CheckedListBox does use the ComboBox control - it draws checkboxes using ControlPaint.DrawCheckBox, which doesn't take advantage of the Theme API.

To accomplish what you want you'll have to extend the CheckedListBox and override OnDrawItem, using the DrawItemEventArgs.Graphics to get an HDC (handle to a device context), draw the checkbox you want using the Theme API, then release the HDC:
public XPCheckedListBox : CheckedListBox
{
  // ...
  protected override void OnDrawItem(DrawItemEventArgs e)
  {
    IntPtr hdc = e.Graphics.GetHdc();
    // Draw checkbox.
    e.Graphics.ReleaseHdc(hdc);
    // Do NOT call base.OnDrawItem
  }
}
To draw a themed checkbox you'll need to P/Invoke the Theme APIs, which you can read about at http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/userex/refentry.asp[^]. For help with P/Invoke signatures, see http://pinvoke.net[^].

Be sure to read about the Theme API because it's not a simple set of APIs.

Also note that in .NET 2.0 themes should be (it's still beta, so nothing's set in stone till release) encapsulates. For documentation about these set of classes in .NET 2.0 Beta1, see http://msdn2.microsoft.com/library/System.Windows.Forms.VisualStyles.aspx[^].

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralSpellcheck in C#.NET Pin
saptarishi200123-Dec-04 8:26
saptarishi200123-Dec-04 8:26 
GeneralRegex problem Pin
Yaakov Davis23-Dec-04 7:09
Yaakov Davis23-Dec-04 7:09 
GeneralRe: Regex problem Pin
leppie23-Dec-04 7:41
leppie23-Dec-04 7:41 
GeneralRe: Regex problem Pin
Yaakov Davis23-Dec-04 7:56
Yaakov Davis23-Dec-04 7:56 
GeneralRe: Regex problem Pin
TyronX23-Dec-04 8:09
TyronX23-Dec-04 8:09 
GeneralRe: Regex problem Pin
leppie23-Dec-04 8:10
leppie23-Dec-04 8:10 
GeneralRe: Regex problem Pin
Yaakov Davis23-Dec-04 8:50
Yaakov Davis23-Dec-04 8:50 
GeneralQuestion about efficiency - Hashtable key types Pin
Tristan Rhodes23-Dec-04 6:28
Tristan Rhodes23-Dec-04 6:28 
GeneralRe: Question about efficiency - Hashtable key types Pin
leppie23-Dec-04 7:42
leppie23-Dec-04 7:42 
GeneralRe: Question about efficiency - Hashtable key types Pin
Tristan Rhodes23-Dec-04 9:57
Tristan Rhodes23-Dec-04 9:57 
GeneralRe: Question about efficiency - Hashtable key types Pin
Matt Gerrans23-Dec-04 11:47
Matt Gerrans23-Dec-04 11:47 
Questionhow to get mirror printing using c# Pin
bigmega23-Dec-04 5:32
bigmega23-Dec-04 5:32 
AnswerRe: how to get mirror printing using c# Pin
Heath Stewart23-Dec-04 8:16
protectorHeath Stewart23-Dec-04 8:16 
GeneralWindows Installer Problem Pin
Asad Hussain23-Dec-04 5:13
Asad Hussain23-Dec-04 5:13 
GeneralRe: Windows Installer Problem Pin
Heath Stewart23-Dec-04 5:19
protectorHeath Stewart23-Dec-04 5:19 
GeneralRe: Windows Installer Problem Pin
leppie23-Dec-04 7:49
leppie23-Dec-04 7:49 
GeneralRe: Windows Installer Problem Pin
Heath Stewart23-Dec-04 7:54
protectorHeath Stewart23-Dec-04 7:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.