|
-
May 16th, 2004, 04:16 PM
#1
Color property for a usercontorl... how do you define a default value.
I have a TitleColor property declared in my usercontrol. I can't apply the DefaultValue attribute to my property however because it says the color value is not constant:
VB Code:
<DefaultValue(Color.Beige)> _
Public Property TitleColor() As Color
Get
End Get
Set(ByVal Value As Color)
End Set
End Property
how do I get around this because I know it is possible. If you change a color value of a windows form then right click on the color in the properties window, there is a Reset option available... so there must be a way to set the default value, but how
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
May 17th, 2004, 01:23 AM
#2
Hi.
You need to tell it what type of object it is.
VB Code:
<DefaultValue(GetType(Color),"Beige")> _
Public Property TitleColor() As Color
Get
End Get
Set(ByVal Value As Color)
End Set
End Property
This will cause it to look up the "Beige" name in the Color enum.
Hope it helps.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
May 18th, 2004, 02:59 PM
#3
Originally posted by pax
Hi.
You need to tell it what type of object it is.
VB Code:
<DefaultValue(GetType(Color),"Beige")> _
Public Property TitleColor() As Color
Get
End Get
Set(ByVal Value As Color)
End Set
End Property
This will cause it to look up the "Beige" name in the Color enum.
Hope it helps.
hahah I didnt think it'd be that simple  thank you thank you
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
May 18th, 2004, 03:52 PM
#4
Hi.
Any time .
The great thing is, that you can use it on your own enums as well.
VB Code:
Public Enum MyEnums
A
B
C
End Enum
<DefaultValue(GetType(MyEnums),"B")> Public Property MyProp as.....
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
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
|