views:

10

answers:

1

I have a custom control (inheriting from control; targetting .net compact framework v2) that has a bitmap property.

currently an instance of the control on the form designer will only paint the selected background color and writes the namespace.control.name overtop.

How can I have the image be rendered by the form designer after its selected in the property editor?

edit: The control is fairly basic but I am overriding onpaint and onpaintbackground

edit2: In an effort to determine the cause I wrote a much simpler control. It's just a bitmap property and a call to graphics.drawimage in onpaint (so a cheap imagebutton). This too fails to render. I even included a check to make sure it wasn't trying to render a null image and never refreshing or anything, but no luck

A: 

Are you manually painting (i.e. overriding OnPaint and drawing that Bitmap out)? Generally speaking rendering in the designer for a very basic control should work.

You'll get the box with the control name if the designer hits something that it can't handle (a P/Invoke fore example) and so often you have to "protect" the device specific code from being called by the designer.

Try backing out functionality until it starts rendering properly to figure out where it's failing (becasue you can't really debug this stuff any other way).

ctacke
I am overriding onpaint and drawing the bitmap - that's about as 'crazy' as it gets though, no p/invokes, or anything that shouldnt be in a control
fatbeard the pirate