Question Resistor color code

Pavle

Well-known member
Joined
Oct 4, 2016
Messages
47
Programming Experience
1-3
I made resistor app that calculates resistance from colors but I don't know how to make app that coverts resistance to color.Can you help me make this?
 
Yeah. So? Why is that a problem? If you can set the BackColor of one Label to one Color then why is it any problem at all to set the BackColor of five or six Labels to five or six different Colors?
 
For 4 bands resistor 1 ohm has brown,black,gold,gold ,for 5 band 1 ohm has brown,black,black,silver,brown!!!!
 
OK. So? I sense that you're waiting for me to write your code for you. That's not going to happen. You've been given some advice. Use it. Until I see some sort of effort in that direction, I have nothing more to add.
 
I don't understand this part very well!!!
Color.FromName(colours[res[0] - '0']);
Color.FromName(colours[res[1] - '0']);
Color.FromName(colours[third != 0 ? third : res.Count() - 2]);
 
Last edited:
I don't understand that part at all. It's your code. You explain it to me. If you just copied that code from somewhere else then go there for an explanation. I've given you several pieces of advice and they've been ignored so I'm not going to waste my time any further. If you want to use my advice then make an effort to do so and I will help you with any issues you have. If you choose to ignore my advice, which is certainly your prerogative, then you are on your own unless someone else chooses to help.
 
My 2 cents on this would be to consider having a function that builds an image object (Bitmap is what I would use) that has the appropriate color bands (however many you need when it gets called) then you can take that image and display it in a single PictureBox on the form instead of using individual labels.
 
My 2 cents on this would be to consider having a function that builds an image object (Bitmap is what I would use) that has the appropriate color bands (however many you need when it gets called) then you can take that image and display it in a single PictureBox on the form instead of using individual labels.

Certainly nothing wrong with that. There are any number of ways that you could display the output. They're all going to require some effort though, and I'm not seeing any of that so far. I figured that simply setting the BackColor of a Label would be an easy way to start but apparently that's a challenge too far.
 
Yea, I'm not going to load screenshots or navigate away from this forum either, please post the code (formatted with the xcode tag please) here in the forum.
 
Back
Top Bottom