subproperties

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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 ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
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
 
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!
 
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 ([email protected], 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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top