OnPaint never called on derived control

B

Bruce

I created a control called ThumbPanel which derives from the
Forms.FlowLayoutPanel control. The ThumbPanel in turn holds and displays a
collection of ThumbNail controls (which is another custom control which
displays an image thumbnail and some metadata via text.)

Up until a couple days ago it all worked fine, but back then the ThumbPanel
derived simply from Forms.Control. I rearchitected it for several reasons,
but largely because I wanted to have the FlowLayoutPanel handle all the
layout for me, rather than having my code do a bunch of layout calculations
and deal with scrolling, etc.

But after my re-architecting to derive from FlowLayoutPanel the results are
broken. The ThumbPanel is never redrawn after I make calls on it that add
ThumbNails (images.) I set a breakpoint in ThumbPanel.OnPaint(), but it is
never called!?

The main form (in which the ThumbPanel is placed) does the following calls:

// This line assigns a new set of thumbnail images to be shown in
the ThumbPanel....
thumbPanel.AssetsSource = m_Model.CurrentDirAssets;
thumbPanel.Refresh();

After this line, I would have expected ThumbPanel.OnPaint() to be called,
but it is not.

Any recommendations how to debug this?

(I have not included code, since there it is more code than seems feasible
to include in this kind of posting.)

Thanks,
-- Bruce
 
B

Bruce

Never mind. Seems that the error was in my client code and not in the
derived control itself!
-- Bruce
 
J

Jeffrey Tan[MSFT]

Hi Bruce,

I am glad you resolved the problem yourself. Yes, based on the test on my
side, FlowLayoutPanel.OnPaint method is called everytime the control needs
refresh.

Anyway, if you need any further help, please feel free to post, I will work
with you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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