473,385 Members | 1,312 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,385 software developers and data experts.

Automatic Brush Selection ( by int i )

djp
hi
I have int i = 0 that changes to max 20

I need to select different brushes depending on this 'i'.
How to do this?
I cannot do something like this: Brushes[i]... :/

Thanks for any help
PK
Mar 26 '07 #1
3 2352
"djp" <pi*************@gmail.comwrote in message
news:20**************************@news.chello.pl.. .
I have int i = 0 that changes to max 20

I need to select different brushes depending on this 'i'.
How to do this?
I cannot do something like this: Brushes[i]... :/
First prepare your brushes:

List<BrushmyBrushes = new List<Brush>;
myBrushes.Add(Brushes.Black);
myBrushes.Add(Brushes.Aqua);
... (Add your 20 brushes)

Then, when you want to select one of your bruses, just extract it from
the List:

Brush selectedBrush = myBrushes.Item(i);

Mar 26 '07 #2
PK,

Why can't you do it? Just create an array of 21 elements (0 to 20) and
then associate brushes with each element. You just have to make sure that
you are populating the brush array before you try and use an index to access
it.

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

"djp" <pi*************@gmail.comwrote in message
news:20**************************@news.chello.pl.. .
hi
I have int i = 0 that changes to max 20

I need to select different brushes depending on this 'i'.
How to do this?
I cannot do something like this: Brushes[i]... :/

Thanks for any help
PK

Mar 26 '07 #3
djp
Thanks. I just tought that there is an easier way.
>
Why can't you do it? Just create an array of 21 elements (0 to 20) and
then associate brushes with each element. You just have to make sure that
you are populating the brush array before you try and use an index to
access it.

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

"djp" <pi*************@gmail.comwrote in message
news:20**************************@news.chello.pl.. .
>hi
I have int i = 0 that changes to max 20

I need to select different brushes depending on this 'i'.
How to do this?
I cannot do something like this: Brushes[i]... :/

Thanks for any help
PK


Mar 27 '07 #4

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

Similar topics

1
by: Rene | last post by:
I would like to get a reference to a Brush using the color name of the brush. For example, right now if I want a brush with a certain color, I would hard code something like Brushes.PeachPuff, this...
2
by: boxim | last post by:
having a moment, cant you just Brush br = new Brush(Color.Black);??? saying you cant cos it's an abstract class need to get to a brush from a color tia sam martin
5
by: Dennis | last post by:
When I instantiate a Brush resource such as a solidbrush, do I need to dispose the resource when I'm finished or will it automatically be disposed when the function/sub it's used in ends? Thank...
1
by: petermichaux | last post by:
Hi, I have been experimenting with some textarea automatic resize scripts. Most that I have found count the number of characters in the textarea and divide by the number of columns. This works...
0
by: robert | last post by:
I'm looking for an efficient optimizer on a noisy high-dimensional and costly function. My own GA hack seems to be somewhat stiff and I find me trying too much around with different cooling speeds...
2
by: Johnny J. | last post by:
I've got an inherited control where I want the user to be able to specify a color property. Using that color, I'm drawing a line private m_UserDefinedColor as Color ..... Dim g as...
4
by: Slickuser | last post by:
How do I automatic move the X & Y to create a ellipse function as below, DrawCircle? Or there any sample source code out there? I want it move down by user input. How can I achieve this?...
9
by: Brett_A | last post by:
I have a form where the first field is a dynamic drop-down that pulls from a db (Access). The fields associated with the query are task_id, task_name and task_rate. The field has the value of...
31
by: Tom P. | last post by:
I am doing quite a bit of custom painting and it means I have to create a lot of brushes (think one for every file system object in a directory) per paint. How expensive is this? Should I find a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.