473,387 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Chaning the Apperance of a Radio Button

Hi All,

I am creating a Kiosk frontend that has tons and tons of radio buttons.
(402 to be exact.) Anyhow, because this is a touch screen
application, I have added an image to each radio button that looks like
a giant oversized check mark for people with large fingers and shaky
hands. I have already added the logic that changes the image once its
radio button has been selected.

However, I need to remove the pre-existing radio button image, you
know, the little circle with the dot. Can this be done? Does anyone
have any ideas? Thanks in advance.

- Josh

Nov 17 '05 #1
5 14676
Josh,

You could override the WndProc method and handle the WM_PAINT message.
This way, you can control the painting of the control completely on your
own.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<jo************@comcast.net> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi All,

I am creating a Kiosk frontend that has tons and tons of radio buttons.
(402 to be exact.) Anyhow, because this is a touch screen
application, I have added an image to each radio button that looks like
a giant oversized check mark for people with large fingers and shaky
hands. I have already added the logic that changes the image once its
radio button has been selected.

However, I need to remove the pre-existing radio button image, you
know, the little circle with the dot. Can this be done? Does anyone
have any ideas? Thanks in advance.

- Josh

Nov 17 '05 #2
I’d suggest creating your own RadioButton class that inherits from
RadioButton and that overrides its OnPaint function, causing your code to
draw it as you see fit rather than let it draw itself in the standard manor.

Brendan
"jo************@comcast.net" wrote:
Hi All,

I am creating a Kiosk frontend that has tons and tons of radio buttons.
(402 to be exact.) Anyhow, because this is a touch screen
application, I have added an image to each radio button that looks like
a giant oversized check mark for people with large fingers and shaky
hands. I have already added the logic that changes the image once its
radio button has been selected.

However, I need to remove the pre-existing radio button image, you
know, the little circle with the dot. Can this be done? Does anyone
have any ideas? Thanks in advance.

- Josh

Nov 17 '05 #3
Thank you for the quick responses. To be quite honest though, I'm a
fairly inexperienced programmer and wouldn't even know where to start
with this.

Nov 17 '05 #4
The following class is a simple replacement for your use of the RadioButton
class from the sounds of it. As you see, it inherits the RadioButton class,
adds two extra properties (CheckedImage and UncheckedImage), as well as
overriding the OnPaint eventhandler.

To use it, simply set the before mentioned properties to those images you
want to be used and leave the rest to it, when the RadioButton is checked, it
will display the CheckedImage, when not, the UncheckedImage is drawn.

One little note about this code, the painting does scale the image to the
shape and size of the available area, if you do not want that, simply change
the call to DrawImage() to DrawImageUnscaled() with the same arguments.

I hope this does what you are looking for,
Brendan

public class PictureRadioButton : RadioButton
{
Image checkedImage;
Image uncheckedImage;

public Image CheckedImage
{
get
{
return checkedImage;
}
set
{
checkedImage = value;
}
}

public Image UncheckedImage
{
get
{
return uncheckedImage;
}
set
{
uncheckedImage = value;
}
}

public PictureRadioButton()
{
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
}
protected override void OnPaint(PaintEventArgs e)
{
Image paintingImage;

if(this.Checked)
{
paintingImage = this.checkedImage;
}
else
{
paintingImage = this.uncheckedImage;
}

e.Graphics.DrawImage(paintingImage, 0, 0, this.Width, this.Height);

}
"jo************@comcast.net" wrote:
Thank you for the quick responses. To be quite honest though, I'm a
fairly inexperienced programmer and wouldn't even know where to start
with this.

Nov 17 '05 #5
Hi,

In addition to the other post read this article, it explain how to create
your own drawed crontrol.

http://www.opennetcf.org/PermaLink.a...8-94ab3c124f63
it's mean to be used in the CF , but the idea works the same in the desktop

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<jo************@comcast.net> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Thank you for the quick responses. To be quite honest though, I'm a
fairly inexperienced programmer and wouldn't even know where to start
with this.

Nov 17 '05 #6

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

Similar topics

3
by: John Davis | last post by:
I created a ASP.NET Web Form using VB.NET with a text box, 2 radio buttons. When the user click the first radio button, the text will change to uppercase. If the user clicks the other radio button,...
0
by: vinay | last post by:
why are u not using the radiobutton list??? vinay >-----Original Message----- >I created a simple ASP.NET application with a text field, and 2 radio >buttons (uppercase and lowercase...
3
by: Amelyan | last post by:
When we want radio button to belong to a group name we say, radio1.GroupName="GroupA". In this case, radio1 will be unselected if another radio button is selected in "GroupA". Is there a way...
9
by: IchBin | last post by:
I can not see what the problem is with this script. I am just trying to set a radio button by calling setCheckedValue('abbr_letter', 'V'). Sorry I am new to javascript. <html> <head> <script...
1
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
0
by: jehugaleahsa | last post by:
Hello: I have radio buttons bound to boolean properties in a business object. private void bindRadioButton(RadioButton button, string propertyName) { Binding binding =...
8
by: photoboy | last post by:
I have racked by brain long enough on this, so now I need the help of someone who knows what they are doing. Here is what I am trying to achieve: First, I have two radio buttons (both unchecked)...
8
by: Jeff Ciaccio | last post by:
I would like to create a toggle button, so I chose a radio and set its apperance to button. Is seems my method always makes this .checked = false. Can somebody help me to see the error in my ways?...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.