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

subproperties

Hi.
I`m creating a composite web control that has two lables, an image control
and a link.

What I would like to do is to give the developer using my control, the
option of changing all the font properties for the lables.
My problem is, how do I create some nifty nested font properties like the
built-in lable control has?
I was thinking of using ExpandableObjectConverter, but I`m hoping there is a
better way.

My bigest issue is, how do I get an enum of all the font names like in the
original
name subproperty?

I`m a little lost. Any help will be very appreciated.
Thank you.
Oct 15 '06 #1
5 2049
Hi,

I think following MSDN documentation can help:

#Typed Styles for Child Controls Example
http://msdn2.microsoft.com/en-us/library/ms178656.aspx

Basically you need to create a Style object internally and apply it to both
of your labels. Also you need to follow some guidelines to maintain the
state of the style. Please let me know if you need further information on
this post. Thank you.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 16 '06 #2
you can add option in property window of control to take input, like
that!
add these lines of code inside the class

System.Drawing.Fontr _defaultFont
[System.ComponentModel.Browsable(true)]
public System.Drawing.Color DefaultFont
{
get { return (_defaultFont); }
set { _defaultFont = value;
}
}

Salman

Oct 16 '06 #3
I ended up doing it the simple way:

[Bindable(true)]

[Category("Item Name")]

[DefaultValue("")]

[Description("The font style of the Item name")]

public FontInfo TextStyle

{

get

{

EnsureChildControls();

return ItemName.Font;

}

set

{

EnsureChildControls();

ItemName.Font.Name = value.Name;

}

}

And so on...for each property of fontinfo...
Thanks for the input!
Oct 16 '06 #4
Hi,

Thanks for your update.

I think your solution should work if you only need to change the font name.
In other cases, the documentation I mentioned is recommended to let the
user of your control have full control of the style.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 18 '06 #5
Not just the find name...
I do this for every sub property in the fontinfo type.

sidenote: You can also do this for a datagrid...just have the property
get/set the datagrid object itself and magicaly all properties are
exported...I`m guessing this works for any object that holds properties.
Oct 18 '06 #6

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

Similar topics

7
by: Fabian Neumann | last post by:
Hi! I got a problem with font-family inheritance. Let's say I have CSS definitions like: p { font:normal 10pt Verdana; } strong { font:normal 14pt inherit;
16
by: Coder Droid | last post by:
I'm trying my first table-less site, and I've bumped my head up against a wall. I can't change the font size within a div. Real quick, my style sheet has: -------------------------------------...
2
by: Codex Twin | last post by:
Hi I am designing a class (Q) which will contain provision for dynamic complex properties. For example, these properties could be any or all of the following complex properties: a)...
0
by: Pawe³ | last post by:
Hi! Within my class (say class A) I have read-only property returning reference to object of type B (since I do not want other to assign another reference to this property). I have created a ...
0
by: Ravikanth[MVP] | last post by:
Hi Use the Font property to specify the font properties of the Web Server control. This property includes subproperties that can be accessed declaratively in the form of Property-Subproperty...
0
by: Spam Catcher | last post by:
Is it possible to assign DAtaGridView Columns to subproperties, for example: MyObject.SomeProperty.ValueToBind I can only assign 1st level properties, but not child ones?
3
by: nicolasr | last post by:
Hi, I'm writing a custom control that has several class type properties, f.e. ImageList, List<string>, StringFormat. None of these classes seems to provide a 'Change' event. The result of this...
1
by: --== Alain ==-- | last post by:
Hi, I've created a simple class "GridLines" having 3 properties (Prop1, Prop2, and Prop3). in my custom control, i've created a property based on this class "GridLines". To show the...
2
by: Marco Segurini | last post by:
Hi All, I have a form containing only a PropertyGrid that I use to modify an instance of the following class: class MyClass { Point _point = new Point();
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.