TabPage.CreateGraphics throwing NotSupportedException

A

anon

I've searched this forum for similar issues, and it seems that one
popular answer is, 'CreateGraphics() is only valid for Forms and
Controls'. But isn't a TabPage a Control? So why won't it work?

The other popular answer seems to be 'create a custom control and
override the onPaint() method'. I'm a newbie to all this, but it seems
like if you do that, you lose a lot of the utility that the Form
Designer gives you. I have a TabControl with 3 TabPages on it, each
with several 'normal' controls like Labels. The FormsDesigner does all
the nice generated code for that, and it seems like if I have to create
a custom control, I'm going to lose all that generated code.

Yes I know it's already been generated and I can just copy/paste it,
but if I want to change anything via Forms Designer, I now have to
manually do all that.

Is there some compromise between the Designer and customizing controls?
 
D

Daniel Moth

popular answer is, 'CreateGraphics() is only valid for Forms and
Controls'. But isn't a TabPage a Control? So why won't it work?
It is supported on the Control class but *not* on the derived classes from
it (of which TabControl is one)
the nice generated code for that, and it seems like if I have to create
a custom control, I'm going to lose all that generated code.
That is not true if you offer designer support for you custom control (only
possible if your custom control is written in C#). For custom control info
see these:
http://msdn.microsoft.com/library/d...ngcustomcontrolforsmartdeviceapplications.asp
http://www.intelliprog.com/articles/index.html

Cheers
Daniel
 

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

Top