Solved

Custom User Control Repaint Problem in Designer View

Posted on 2007-03-30
2
281 Views
Last Modified: 2008-01-09
I'm making a custom user control where I override the paint function and do my own drawing... When I change properties of the control (Color, etc...), it doesn't repaint.  I have to actually close the designer form and reopen it to see the changes...

I tried this...

private Color m_BackgroundColor = Color.White;
public Color BackgroundColor
{
      get
      {
            return m_BackgroundColor;
      }
      set
      {
            m_BackgroundColor = value;
            Invalidate();
      }
}


But this doesn't appear to be working to redraw in designer mode.

Any suggestions?


0
Comment
Question by:collages
2 Comments
 
LVL 2

Accepted Solution

by:
ironwill96 earned 500 total points
ID: 18886455
Apparently to change how it works in design time you have to write a custom designer as well.

See references here: http://msdn.microsoft.com/msdnmag/issues/04/12/CustomFormsDesigner/default.aspx
and here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/custdsgnrdotnet.asp

Hope that helps some.  Seems like a pain but I guess the default design behavior is just generated from what is exposed but doesnt do anything fancy.

0
 
LVL 1

Author Comment

by:collages
ID: 19009310
Excellent answer.  Thank you!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now