Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-28-2009, 07:02 AM   PM User | #1
Chris4
New Coder

 
Join Date: Jun 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Chris4 is an unknown quantity at this point
Visual Basic, vb.net, help.

Hey,

I'm a beginner so be easy on me

I'm creating a t-shirt designer program for my college project.



So I've got a form with 5 different images (PictureBox) on it, the page where they choose the design of the t-shirt.

I want the user to be able to click on one of them (and only one of them), which then highlights it (change BackColor?), then click the Next button.

I can do this, which, when you click on the image Design1 it changes the BackColor to blue.

Code:
Private Sub Design1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Design1.Click
    Design1.BackColor = Color.Blue
End Sub
But then I need to be able to click it again to unhighlight it.

The only thing I could think of was..

Code:
    Private Sub Design1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Design1.Click
        Design1.BackColor = Color.Blue

        If Design1.BackColor = Color.Blue Then
            Design1.BackColor = Color.Transparent
        End If
    End Sub
But obviously that just goes round in circles. Clicking it changes it to blue, then "if it's blue - change to transparent", therefore it does nothing.

How can I do that?

Thanks.
Chris4 is offline   Reply With Quote
Old 04-01-2009, 05:56 PM   PM User | #2
DELOCH
Regular Coder

 
DELOCH's Avatar
 
Join Date: Apr 2006
Location: Canada
Posts: 537
Thanks: 4
Thanked 2 Times in 2 Posts
DELOCH is an unknown quantity at this point
add code to the images : what happens when you click on them

consider putting a shape in the background(default same as background), whenever someone clicks on the image, the shape color should change and reset others.

the rest is your work
DELOCH is offline   Reply With Quote
Old 04-02-2009, 01:47 AM   PM User | #3
Chris4
New Coder

 
Join Date: Jun 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Chris4 is an unknown quantity at this point
Hm, ok thanks.
Chris4 is offline   Reply With Quote
Old 04-02-2009, 02:54 PM   PM User | #4
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
Throw the line where you change it to blue into the else of the if statement, so it would read:
if it's blue then set it to transparent
else set it to blue

Good luck.
__________________
-Brando
Why using tables for eating is stupid!
Brandoe85 is offline   Reply With Quote
Reply

Bookmarks

Tags
basic, vb.net, visual

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:14 AM.


Advertisement
Log in to turn off these ads.