[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to add a 'light' to my .Net Form Application -> does the toolbox provide simple lights i.e. red/green

Posted on 2006-03-22
8
Medium Priority
?
242 Views
Last Modified: 2010-04-24
Greetings,

I have a .Net Form App and I want to add two lights which will signify a GO/NO-GO status.

After looking through all the options on the toolbox, I didn't see anything that seemed to fit the bill.

How can I incorporate such a thing and what is the exact code to turn such lights on with the appropriate color ?

Thanks
0
Comment
Question by:John500
8 Comments
 
LVL 12

Expert Comment

by:OnegaZhang
ID: 16265693
There is a article talking about VB.NET. Wish it is helpful to you as well.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet08142002.asp
Creating Visual Basic .NET Controls from Scratch
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 16266233
and also a LED control in C# here may help :http://www.codeguru.com/csharp/csharp/cs_controls/custom/article.php/c4793/

MAHESH
0
 

Author Comment

by:John500
ID: 16269550
Thanks to both of you, but this won't work for me.  I'm looking for direct references to Visual C++ .Net toolbox objects and some sample code C++ code
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 45

Expert Comment

by:AndyAinscow
ID: 16272197
Two icons - one red, one green.
Use two times picture control, one for each icon.
For go hide the red picture and show the green, you get the idea.
0
 

Author Comment

by:John500
ID: 16275553
AndyAinscow,

>> Two icons - one red, one green.

I'm not as versed in such things as you might expect.  How would I create an icon from scratch?  After that I'm guessing the properties of the icon would allow me to set a default color.  If so, I'd need to know how to change that color during run-time.  Lastly, I would prefer the icon to be round rather than square.  The more I think about it, I don't need two, just one that can change from red to green.

Thanks !
0
 

Author Comment

by:John500
ID: 16276188
AndyAinscow,

I guess I'm not as bad as I thought I was.  I created a round red icon and a green one also from 'Paint'.  I saved them as icons and then imported them into my project's GroupBox as pictureBoxes.  

What did you mean by 'two times picture control' ?  Are you saying I should put one picture on top of the other and then show which ever one I want depending upon the status?  In any event, these objects are called pictureBox1 and pictureBox2.  What would the code look like to display them ?

Thanks
0
 
LVL 4

Accepted Solution

by:
SmithJW earned 500 total points
ID: 16277934
You're on the right lines so far with the 2 picture boxes.
Assuming PictureBox 1 is 'green', and ValidInput is  a bool, set by a Validation function:

if ( ValidInput == true )
{
   PictureBox1.visible = true;
   PictureBox2.visible = false;
}
else
{
   PictureBox1.visible = false;
   PictureBox2.visible = true;
}


obviously replace ValidInput with whatever condition you want to check, but this will get you going for now.
0
 
LVL 45

Assisted Solution

by:AndyAinscow
AndyAinscow earned 500 total points
ID: 16278053
In the resource editor of visual studio you can create icons.
Put a picture box control onto your form and you should be able to select the type of picture as icon and the ID (of the icon you just created).  Now you have one picture control with for instance a red circle in it.  Do the same to create a second, green, icon.  Add a second picture control and link the picture control to the icon.
Now all you need to do is toggle the visible state of the control depending on which icon you want to display.


You need two picture controls because each contains one image.  (You could do it with one control and swap the images but using two controls and visibility is simpler to code).
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question