Groups | Blog | Home
all groups > dotnet windows forms designtime > august 2004 >

dotnet windows forms designtime : Designer uses wrong ctor on CF



Roland Dick
8/16/2004 3:34:35 PM
Hi,

I'm currently writing an own control for the .net compact framework. It
overrides the Font property:

public override Font Font {get..set}

That works pretty well - except if I select a font with regular style,
because the Designer persists the property value to code like that:

this.myControl.Font = new System.Drawing.Font("Tahoma", 14F);

That's perfect for Windows applications, but Compact Framework does not
support this constructor. It explicitely wants the FontStyle.Regular as
third parameter.

My first idea was to derive from Font and extend with that constructor.
Unfortunately, the Font class is sealed and can not be inherited.

So, does anybody know how I can convince the designer to use this
specific ctor? Or any ideas what I'm doing wrong?

Thank you,

Regards,

Roland Dick
8/17/2004 2:22:26 PM
Ouch - I compiled the design dll against the wrong DLL (System.Drawing
instead of System.CF.Drawing).

Cheers,

AddThis Social Bookmark Button