473,499 Members | 1,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create OwnerDraw CheckBox

Hi.

Does anybody have a sample, how does I can make a checkBox ownerdrawn? I
need to change the color inside of the box.

Can anyone help me, how does I have to do this?

Thanks
Thomas
Nov 15 '05 #1
3 8987
I'm not I understand what exactly you want to do..but, you can change both
the foreground and background color of the standard
System.Windows.Forms.CheckBox usinng the ForeColor & BackColor Properties.

Thanks,
Mohamed
--------------------
From: "Thomas Kehl" <t.kehl (at) heeb.com>
Subject: Create OwnerDraw CheckBox
Date: Tue, 16 Dec 2003 18:56:54 +0100
Lines: 11
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <e5**************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: 147.124.203.62.dial.bluewin.ch 62.203.124.147
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!TK2MSFTNGP09.
phx.gblXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.csharp:205998
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Hi.

Does anybody have a sample, how does I can make a checkBox ownerdrawn? I
need to change the color inside of the box.

Can anyone help me, how does I have to do this?

Thanks
Thomas


Nov 15 '05 #2
Hi Mohamed,

thanks for your answer. I want to change the color inside of the box where
the hook is in it (this is always white), not of the textarea.

Can you help me?

Thanks, Thomas

"Mohamed Enein (MSFT)" <Mo***********@online.microsoft.com> schrieb im
Newsbeitrag news:oL****************@cpmsftngxa07.phx.gbl...
I'm not I understand what exactly you want to do..but, you can change both
the foreground and background color of the standard
System.Windows.Forms.CheckBox usinng the ForeColor & BackColor Properties.

Thanks,
Mohamed
--------------------
From: "Thomas Kehl" <t.kehl (at) heeb.com>
Subject: Create OwnerDraw CheckBox
Date: Tue, 16 Dec 2003 18:56:54 +0100
Lines: 11
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <e5**************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: 147.124.203.62.dial.bluewin.ch 62.203.124.147
Path:

cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!TK2MSFTNGP09. phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.csharp:205998X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Hi.

Does anybody have a sample, how does I can make a checkBox ownerdrawn? I
need to change the color inside of the box.

Can anyone help me, how does I have to do this?

Thanks
Thomas

Nov 15 '05 #3
Thomas,

I going to assume you ment a WinForm CheckBox.
With that said here is how I would do it.

Add an ImageList Control to the Form. To hold the 16x16 images used as
the check box area of the control.
Image 1: Image of an Unchecked box
Image 2: Image of a box with a check in it
Image 3: Image of a Indeterminate Box with a check in it (Only if 3
state)

Add a Paint Event to the check box the the following code.
private void CheckBox1_Paint(object sender, PaintEventArgs e)
{
if( CheckBox1.Checked )
e.Graphics.DrawImageUnscaled( ImageList1.Images[1],
0, // X start point
0 ); // Y start point
else
e.Graphics.DrawImageUnscaled( ImageList1.Images[0],
0, // X start point
0 ); // Y start point
}

Note: Forms will be slowed during load the more check boxes you have
to draw.

Hopes this helps.

Glen Jones MCSD
From: "Thomas Kehl" <t.kehl (at) heeb.com>
Subject: Create OwnerDraw CheckBox
Date: Tue, 16 Dec 2003 18:56:54 +0100
Lines: 11

Hi.

Does anybody have a sample, how does I can make a checkBox ownerdrawn? Ineed to change the color inside of the box.

Can anyone help me, how does I have to do this?

Thanks
Thomas

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2945
by: anand | last post by:
Hi All, Are ownerdraw buttons supported in C# ? I have an active X control which I would like to use in CSharp. Buttons have a style BS_OWNERDRAW, and to do custom drawing you have to...
0
1080
by: Apollo440 | last post by:
If MenuItem.OwnerDraw Property is true,.NET framework does not recognize the overlapped accelerator keys. Is there a workaround? eg) +------+ |&Test | <- |&Tea | <- MenuItems has...
2
2821
by: Stuart Norris | last post by:
Dear Group, I am new to c# and windows form designer - coming from a Motif background. I am attempting to develop an application for a touch screen and I need to have a menu system with a...
2
1713
by: jm | last post by:
There are properties for OwnerDraw on ContextMenu items. I know it can be done with regular menus. I cannot find anyone doing it with the systray icon contextmenu (notifyicon.) Is it possible to...
0
970
by: Michel | last post by:
I come back with a new question regarding my OwnerDraw menu. That is a classical ownerDraw menu to add icon and some other color properties. My feature is to color all the menu bar with the...
0
1062
by: Peter Proost | last post by:
Hi group, I was wondering if anyone has ever done this before, I've got a working ownerdrawn menu the only thing I can't get to work is to ownerdraw the items the get automaticaly created in a...
2
1242
by: Peter Proost | last post by:
Hi group, I've got this ownerdraw menu module which I got from a site and modified to my personal needs, but the only problem I'm having is with the lines in a menu, when you type - as text, it...
0
1032
by: genojoe | last post by:
This code is derived from: ms-help://MS.VSCC.2003/MS.MSDNQTR.2005JUL.1033/cpref/html/frlrfSystemWindowsFormsMenuItemClassOwnerDrawTopic.htm The sample works as presented but does not contain a...
1
5050
by: tmda | last post by:
I'm using OwnerDraw for some customization in my ListView - adding color to item backgrounds. I'm using the ListView specifically for it's OwnerDraw capability. I originally was using the...
0
7130
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7386
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5468
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4918
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
664
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
295
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.