473,799 Members | 3,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 14715
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.co m

<jo************ @comcast.net> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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 DrawImageUnscal ed() with the same arguments.

I hope this does what you are looking for,
Brendan

public class PictureRadioBut ton : RadioButton
{
Image checkedImage;
Image uncheckedImage;

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

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

public PictureRadioBut ton()
{
this.SetStyle(C ontrolStyles.Do ubleBuffer |
ControlStyles.U serPaint |
ControlStyles.A llPaintingInWmP aint,
true);
}
protected override void OnPaint(PaintEv entArgs e)
{
Image paintingImage;

if(this.Checked )
{
paintingImage = this.checkedIma ge;
}
else
{
paintingImage = this.uncheckedI mage;
}

e.Graphics.Draw Image(paintingI mage, 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.goo glegroups.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
3137
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, the text will change to lowercase. I added the following event, but still won't able to change the text to uppercase. Private Sub RadioButton1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles...
0
1810
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 conversion). When the user enters a text in >text field, the user can click the radio button for case conversion. I set >the property of radio button to AutoPostBack=True, the
3
2074
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 (trick, custom RadioButton, or javascript) to make radio button (radio1) belong to 2 independent radio button groups instead of one? This would be an equivalent of sayting something like radio1.GroupName1 = "GroupA"; radio1.GroupName2 = "GroupB";
9
2254
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 type="text/javascript"> function setCheckedValue(radioObj, newValue) { if(!radioObj)
1
3232
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 button with this link of code: echo 'SCRIPT language=JavaScript setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //? <snip of code>
10
6106
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 button with this link of code: echo 'SCRIPT language=JavaScript setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //? <snip of code>
0
2300
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 = button.DataBindings.Add("Checked", exclusionBindingSource, propertyName,
8
4617
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) that need to be validated when the submit button is clicked. Instead of the standard alert window popping up (which I have now), I want the radio button background color to change from the table color (E2E2E2) to red (FF0000) for both buttons...
8
11758
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? I'm guessing that I just need an event that triggers before it actually changes the value of the button. Private Sub radSound_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radSound.Click If radSound.Checked = True...
0
10482
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10225
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9072
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.