How to get the value item to font.... |
Post Reply |
Author | |
wizzy
Newbie Joined: 17 May 2006 Status: Offline Points: 1 |
Post Options
Thanks(0)
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#? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |