Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Usercontrol rendering on wrong control?
 

Usercontrol rendering on wrong control?

I've built my first usercontrol for use in a GPS Mapping forms app.

pic1 shows "panel1" containing some picturebox "tools" with a map(another panel containing a picturebox) underneath.

pic2 shows that I dragged the map and the "tool" have not moved with the drag.

"panel1" also contains my usercontrol( this will show a transparent map scale). My usercontrol and all the "tools" definately have the same parent - ie "panel1".

If I resize the form to cause a re-paint of all the controls I getpic3 - the red T bar (my usercontrol) will be the map scale.

Everything looks OK until I drag the map - the user control goes with the drag.pic4 shows that the usercontrol image has been erased as it passed under the "tools".

I don't understand why the "tools" stay put and on top of the map and the usercontrol does not - even though they all have the same parent.

Guys - I'm sorry if I have not explained the problem very well or I've illustrasted it in an inappropriate manner. In this case I didn't think a clutter of code would help much.
bullstreetboy  Thursday, January 22, 2009 12:33 PM
Hi Bullstreetboy,

It seems that the UserControl isactually addedto the panel that contains the map. Go to the from's code file and navigate to the InitializeComponent method. Check whether the UserControl is added to the Controls collection of that panel. If it is, delete the line of code andthen add the UserControl to the Controls collection of panel1.

Please try my suggestion to see if it works.

Sincerely,
Linda Liu

Linda Liu  Wednesday, January 28, 2009 10:14 AM

We are changing the issue type to “General Discussion�because you have not followed up with the necessary information.

If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by opening the Options list at the top of the post window, and changing the type.

If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

Linda Liu  Friday, January 30, 2009 2:09 AM

You can use google to search for other answers

Custom Search

More Threads

• Invalid cast from CustomAttribute to Attribute at Design Time
• Best Practices Question
• Strange error after each time I change anything on the design
• Simulate key pressing
• How to use EnableDesignMode in VS 2005 ??
• Alter GridSize for DesignSurface
• C# 2005 Express: How til select a User Control
• Resizing of Rows and Columns
• email validation control
• How to add and read the data in a ListBox of MDI Windows Form project with 1 "Parent" & 2 "Child" Forms with 2 Classes?