Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

OnPaint never called on derived control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruce - 20 Feb 2006 07:57 GMT
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
Bruce - 21 Feb 2006 02:36 GMT
Never mind.  Seems that the error was in my client code and not in the
derived control itself!
-- Bruce

> I created a control called ThumbPanel which derives from the
> Forms.FlowLayoutPanel control.  The ThumbPanel in turn holds and displays
[quoted text clipped - 30 lines]
> Thanks,
> -- Bruce
"Jeffrey Tan[MSFT]" - 21 Feb 2006 02:54 GMT
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
Signature

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Bruce - 25 Feb 2006 21:37 GMT
Thanks Jeffrey

> Hi Bruce,
>
[quoted text clipped - 11 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.