473,411 Members | 2,272 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,411 software developers and data experts.

Properties of Properties

I have a System.Web.UI.Control which has a property of type
System.Drawing.Font. When editing this control in an *.aspx file, how do I
assign a value to this property? If I recall correctly, the attributes in
the server tag are a combination of the property name and the property of
that property separated by a "-" or something. However, I would also like to
be able to use the Property Grid to do this. I tried using the Browsable
attribute for the property, but that did not seem to help. Here is my
current code for the property:

<System.ComponentModel.Browsable(True)WriteOnly Property Font() As
System.Drawing.Font
Set(ByVal value As System.Drawing.Font)
Me._font = value
End Set
End Property

Am I forgetting something? Any help would be appreciated. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Oct 27 '08 #1
4 1177
in general the property designer only support simple types by default
(string, numbers, enum). while the designer knows about color and size,
window fonts are not included. you will need to write your own prop designer
to support them. in the asp.net syntax, all properties must be able to be
specified as a string.

as fonts are specified to the browser via a style command, not sure why you
do not just support a style and class (CSSClass) properties.
-- bruce (sqlwork.com)
"Nathan Sokalski" wrote:
I have a System.Web.UI.Control which has a property of type
System.Drawing.Font. When editing this control in an *.aspx file, how do I
assign a value to this property? If I recall correctly, the attributes in
the server tag are a combination of the property name and the property of
that property separated by a "-" or something. However, I would also like to
be able to use the Property Grid to do this. I tried using the Browsable
attribute for the property, but that did not seem to help. Here is my
current code for the property:

<System.ComponentModel.Browsable(True)WriteOnly Property Font() As
System.Drawing.Font
Set(ByVal value As System.Drawing.Font)
Me._font = value
End Set
End Property

Am I forgetting something? Any help would be appreciated. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Oct 27 '08 #2
My reason for not using a style and class is because the control will be
generating an image, and therefore needs a System.Drawing.Font object.
Assuming you are correct in your statements, I will probably need to just
make separate properties and use the System.Drawing.Font constructor to
create the font. I was just hoping to not need to make separate properties,
but I guess that's all I can do for now since I don't know how to make
Property Designers yet (and there probably wouldn't be much point in this
case, since I only have one control that would need it). Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:28**********************************@microsof t.com...
in general the property designer only support simple types by default
(string, numbers, enum). while the designer knows about color and size,
window fonts are not included. you will need to write your own prop
designer
to support them. in the asp.net syntax, all properties must be able to
be
specified as a string.

as fonts are specified to the browser via a style command, not sure why
you
do not just support a style and class (CSSClass) properties.
-- bruce (sqlwork.com)
"Nathan Sokalski" wrote:
>I have a System.Web.UI.Control which has a property of type
System.Drawing.Font. When editing this control in an *.aspx file, how do
I
assign a value to this property? If I recall correctly, the attributes in
the server tag are a combination of the property name and the property of
that property separated by a "-" or something. However, I would also like
to
be able to use the Property Grid to do this. I tried using the Browsable
attribute for the property, but that did not seem to help. Here is my
current code for the property:

<System.ComponentModel.Browsable(True)WriteOnly Property Font() As
System.Drawing.Font
Set(ByVal value As System.Drawing.Font)
Me._font = value
End Set
End Property

Am I forgetting something? Any help would be appreciated. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Oct 27 '08 #3
You should be able to work with this property in the property grid. The
System.Drawing.Font type has an associated editor, which the property grid
should expose to you.

What happens in the property grid?
--
John Saunders | MVP - Connected System Developer

Oct 27 '08 #4
All the Property Grid shows is the name of the property and a place to enter
a value. It shows up the same way a property of type String or Integer or
would. Is there an Property Attribute I need to add to make the associated
editor available? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"John Saunders" <no@dont.do.that.comwrote in message
news:e3****************@TK2MSFTNGP05.phx.gbl...
You should be able to work with this property in the property grid. The
System.Drawing.Font type has an associated editor, which the property grid
should expose to you.

What happens in the property grid?
--
John Saunders | MVP - Connected System Developer

Oct 27 '08 #5

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

Similar topics

4
by: Lyn | last post by:
Hi, This question may seem a bit academic... To learn more about Access VBA, I have been enumerating the properties of various form controls. This was mostly successful and I have learned a lot...
10
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a...
1
by: Christophe Peillet | last post by:
I have a CompositeControl with two types of properties: 1.) Mapped Properties that map directly to a child control's properties (ex.: this.TextboxText = m_txt.Text). These properties are handled...
7
by: Anderskj | last post by:
Hi! I am developing a c# application. I have a interface (which can change therefore my problem) If i do like this: List<PropertyInfoproperties = new List<PropertyInfo>();...
0
by: =?Utf-8?B?UmljayBHbG9z?= | last post by:
For some unknown reason (user error?), I cannot get a NameValueCollection to persist in the app.config file. Unlike other settings, I cannot get the String Collection Editor GUI to allow my to...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.