Solved

Custom User Control Repaint Problem in Designer View

Posted on 2007-03-30
2
288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

630 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