Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - How to get the value item to font....
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to get the value item to font....

 Post Reply Post Reply
Author
Message
wizzy View Drop Down
Newbie
Newbie


Joined: 17 May 2006
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote wizzy Quote  Post ReplyReply Direct Link To This Post Topic: How to get the value item to font....
    Posted: 17 May 2006 at 9:03pm

Hi,

On my PropertyGrid I have added a item of type font , with the following code:

PropertyGridItemFont ItemFont = (PropertyGridItemFont)Category.AddChildItem(PropertyItemType .PropertyItemFont "FontItem", this.Font.ToHfont().ToInt32());

ItemFont.Color = 0xFF0000;

But at time to retrieve the value with the event ValueChanged, It will generate an exception. The code that I am using to get the value is as follow:

Font result= (Font)e.item.Value;

 

Can you tell me the correct way to get the value using C#?

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2006 at 9:30am

e.item.Value is ActiveX STDFont object - you can't change it's type to managed Font.

Here code you can try:

if (e.item.Type == PropertyItemType.PropertyItemFont)

{

   PropertyGridItemFont FontItem = e.item as PropertyGridItemFont;

   Font fnt = new Font(FontItem.FontFaceName, FontItem.FontSize);

   chkCustomColors.Font = fnt;

}

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.137 seconds.