Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Container control refresh issue
 

Container control refresh issue

I have a container control that I have written that does custom drawing of it's background.

If I resize the control in any way, it redraws correctly, but if I so much as select a control that is in the container while in design time, it doesn't redraw properly in that it will leave black areas around where the focus box and grab handles were. If you move the child control it will leave a black spot where it was. Resizing refreshes it correctly though.

Any ideas how to force the control to refresh itself when a child control is moved around at design time?
MigrationUser 1  Friday, May 02, 2003 9:28 PM
hrm... Well, one option would be to create a designer for your class derived from ScrollableControlDesigner and use HookChildControls along with GetHitTest.  You can find an example <a href="http://www.dotnet247.com/247reference/msgs/5/27224.aspx">here</a>.


MigrationUser 1  Tuesday, May 06, 2003 10:12 AM
Thanks for the sample!

I have one problem:

System.Windows.Forms.Design.ControlDesigner doesn't exist according to the compiler and it isn't there in intellisense either.

(VS.net 2003)

The help says it should be there but it just isn't no matter what I do.

Any ideas?
MigrationUser 1  Tuesday, May 06, 2003 10:41 AM
Do you have a reference to System.Design.dll ?
MigrationUser 1  Tuesday, May 06, 2003 10:46 AM
Ah!!! thanks! That was it. I thought it would be in the System.Windows.Forms namespace...
MigrationUser 1  Tuesday, May 06, 2003 10:56 AM
Well, it is, kind of... It's just in a different dll.  In the future, though, you can find out which DLL you need to reference by pulling up the help and navigating to the About page for a given class (in this instance, the index entry would be ControlDesigner -> About Control Designer Class).  At the bottom of that page will be a requirements section that looks like this:

<b>Namespace:</b> System.Windows.Forms.Design

<b>Platforms:</b> Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server family

<b>Assembly:</b> System.Design (in System.Design.dll)

The last line tells you what DLL you need to have a reference to.
MigrationUser 1  Tuesday, May 06, 2003 11:26 AM
Ya, I just noticed... didn't look, stupid me.... oh well, thanks for your help!  I've almost got all of the draw issues out except for the last move. On the last move, it leaves the focus rect without redrawing it from where the control was before it was moved.

It does clear out all past moves now though.

Any ideas?
MigrationUser 1  Tuesday, May 06, 2003 11:37 AM

You can use google to search for other answers

Custom Search

More Threads

• Using VS Designer in 2005-B2
• Using DataGrid with VS2005 Designer
• OnPaintEvent Issue(help please)
• sorting Datagridview
• VSNET 2005 FINAL release can't open a form
• How to put a pop-up box control into Toolbox?
• CodeDomDesignerLoader crashes in Flush() method when a component is deleted
• how to implement mousedrag event in c#
• How do you persist and restore forms with the CodeDomDesignerLoader
• Printout Image from PictureBox