|
-
Jan 29th, 2009, 09:09 PM
#1
Thread Starter
Hyperactive Member
Making styles with VB Code...
So if you remember in old VB6 days, if you wanted to change the background color of a button you would just call
Command1.backgroundcolor = vbBlack
Now what I am wondering is if I modify a simple style button, make it look the way I want, is there a way to give my users a way of changing the colors (basically making a brush and applying it), etc...
Visual Basic Rules!!!!! 
-
Jan 29th, 2009, 09:16 PM
#2
Re: Making styles with VB Code...
In WinForms it's much the same as in VB6, e.g.
vb.net Code:
Button1.BackColor = Color.Black
In WPF you would create a Brush and assign it to the Background property. If you just want a solid colour then you can use a SolidColorBrush, obtained from the Brushes class,e.g.
vb.net Code:
Button1.Background = Brushes.Black
If you want something fancier then you can create some other type of Brush.
-
Jan 29th, 2009, 09:27 PM
#3
Re: Making styles with VB Code...
With regards to letting the user choose, you could either create a list of SolidColorBrush objects and display their Color properties for selection or, more likely, you would display a list of Colors and then create a new SolidColorBrush from the selected Color.
-
Jan 29th, 2009, 10:23 PM
#4
Thread Starter
Hyperactive Member
Re: Making styles with VB Code...
So like I have a control I've been working on and it has numerous parts to it... it is based off of the simple style combobox, but I've added and tweaked it so it looks how I want it... So how can I expose fill/brush properties for objects inside the control, instead of just the control itself...
Visual Basic Rules!!!!! 
-
Jan 29th, 2009, 10:36 PM
#5
Re: Making styles with VB Code...
It's probably a good idea to actually ask the question you want answered to begin with, rather than working up to it.
As for the question itself, you pretty much answered it for yourself:
So how can I expose fill/brush properties for objects inside the control
You add a property to your parent control and you pass through the corresponding property of the child control. More than that I can't say without a more specific question.
Also, you should take into account that I've never used WPF myself, so there will be things that I'm not aware of. Others may have more information but all I've answered here came from reading the MSDN documentation after reading your question. That kinda makes me wonder, if I could look up the Button class and read about its Background property, etc., why others couldn't too.
-
Jan 29th, 2009, 10:38 PM
#6
Thread Starter
Hyperactive Member
Re: Making styles with VB Code...
Well these new questions are coming as I learn... I didn't have this question at the time of starting this thread... :/
Thanks for all the help btw
Visual Basic Rules!!!!! 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|