Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Exposing Font Name Property for Custom Control

Reply
Thread Tools

Exposing Font Name Property for Custom Control

 
 
Deep S.
Guest
Posts: n/a
 
      08-04-2003
Hi,

I've created a custom web control for using in my web application.
I want to expose some Font-Name Properties of the control
like i did for the Color and Boolean values, so that in the properties
pane, a proper list is displayed for user selection.
Like for picking up the color i've declared a property with data type
as System.Drawing.Color. This shows the Color Picker in the
Property Window.
For Font Name Picker with which data type should i declare the
property with ??

Thanks for your help in advance.
Regards
Deep S.


 
Reply With Quote
 
 
 
 
Karsten Lundsgaard
Guest
Posts: n/a
 
      08-04-2003
Hi You should use FontInfo, see the sourcecode below :


[
Category("TextBox"),
Description("Font of the textbox.")
]
public FontInfo TextBoxFont
{
get
{
object savedState = this.ViewState["TextBoxFont"];
if ( savedState == null )
{
return myTextBox.Font;
}
return (FontInfo)savedState;
}
set
{
myTextBox.Font.CopyFrom(value);
this.ViewState["TextBoxFont"] = value;
}
}





>-----Original Message-----
>Hi,
>
> I've created a custom web control for using in my web

application.
> I want to expose some Font-Name Properties of the

control
> like i did for the Color and Boolean values, so that

in the properties
> pane, a proper list is displayed for user selection.
> Like for picking up the color i've declared a property

with data type
> as System.Drawing.Color. This shows the Color Picker

in the
> Property Window.
> For Font Name Picker with which data type should i

declare the
> property with ??
>
>Thanks for your help in advance.
>Regards
>Deep S.
>
>
>.
>

 
Reply With Quote
 
 
 
 
Deep S.
Guest
Posts: n/a
 
      08-04-2003
Hi Karsten,
Thanks for your reply, but i tried something like this by figuring out
the approach to be taken in my code.
But the property that is coming at the design time for the control
is coming with just one text box. I want to make it something
like we get when we edit the font properties for any other
control like textbox etc through which the user can select
Font Name, Bold, Italic etc properties for my control.

Dim _sysItemFontInfo As System.Web.UI.WebControls.FontInfo

<Bindable(True), Description("Font properties of the list items."),
Category ("ListOptions"), DefaultValue("")> Property [ItemFont]() As
System.Web.UI.WebControls.FontInfo
Get
Return _sysItemFontInfo
End Get
Set(ByVal Value As System.Web.UI.WebControls.FontInfo)
_sysItemFontInfo = Value
End Set
End Property

Maybe there is some problem with my code. But i got no sample/
help related to this issue on MSDN as well as some other sites i know.
Is there anything else i need to do apart from this code?

Thanks for your reply.

Regards
Deep S.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Swing Font, it's Java Font? ot native? how install new font? mttc Java 2 07-03-2009 07:29 PM
Exposing an event handler as a control property paul.hester@gmail.com ASP .Net Building Controls 3 09-30-2006 02:03 AM
Exposing an event handler as a control property Paul ASP .Net 1 08-28-2006 05:33 AM
Exposing an event handler as a control property paul.hester@gmail.com ASP .Net Web Controls 0 08-28-2006 05:27 AM
Problem w Font property in Custom Control silverprox ASP .Net 0 05-21-2005 11:26 PM



Advertisments