I have a custom control (inheriting from control
; targeting .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 it's 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 l开发者_开发技巧uck.
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).
精彩评论