GDI and User Control related
-
Good day, I have a user control. My user control is customize Panel which can be minimize or maximize. I use Transparent as background of my control. I tried to test my new control under a form that has a background picture. When I run my test program, i've tried to minimize my user control Panel but the area that was left behind by my panel is NOT the background image picture of the form where i put my user control instead the trasparent color appear. Is there a way that we could get the background of the Area what was overlapped by my user control ? How can I make my user control aware of the background area that it overlapped at design time so that I could restore that area when my control is minimize? Any suggestions would be appreciated. Thanks,
-
Good day, I have a user control. My user control is customize Panel which can be minimize or maximize. I use Transparent as background of my control. I tried to test my new control under a form that has a background picture. When I run my test program, i've tried to minimize my user control Panel but the area that was left behind by my panel is NOT the background image picture of the form where i put my user control instead the trasparent color appear. Is there a way that we could get the background of the Area what was overlapped by my user control ? How can I make my user control aware of the background area that it overlapped at design time so that I could restore that area when my control is minimize? Any suggestions would be appreciated. Thanks,
The simplest thing to do is to invalidate or refresh the form when the customize Panel is minimized/maximized. You can let the customize Panel trigger a minimized/maximized event back to the parent control or just use the 'this.Parent.Refresh()' but that's not a very neet way of handling the problem. Another way of solving the problem is to calculate the area that should be invalidated and then repaint only that small area. I hope that might give you some idé to solve the problem. :)
-
The simplest thing to do is to invalidate or refresh the form when the customize Panel is minimized/maximized. You can let the customize Panel trigger a minimized/maximized event back to the parent control or just use the 'this.Parent.Refresh()' but that's not a very neet way of handling the problem. Another way of solving the problem is to calculate the area that should be invalidated and then repaint only that small area. I hope that might give you some idé to solve the problem. :)
Hi SNews Thanks for your feedback, however, I already tried to add a handler to my panel. so that in the forms code : mypanel.SetParentControl(myparentcontrolorparentform); and on my panel code: private Control m_parentcontrol=null; public void SetParentControl(Control e) { m_parentcontrol=e; } [Browsable(true)] [TypeConverter(typeof(boolValueConverter))] [DisplayName("Collapse"), Category("Panel Information"), Description("Minimize/Maximize Panel")] public bool Collapse { get { return m_isminimized; } set { m_isminimized = value; if(m_parent!=null) m_parentcontrol.Refresh(); Refresh(); } } However the when my panel is minimized, the area that was left behind displays the transparent color. If its okay with you, can i ask for your email address so that I could email you the output sample of my program. Perhaps I'll to follow your second suggestion, however how can my user control aware or get the area only that it has overlapped? Thanks
-
Hi SNews Thanks for your feedback, however, I already tried to add a handler to my panel. so that in the forms code : mypanel.SetParentControl(myparentcontrolorparentform); and on my panel code: private Control m_parentcontrol=null; public void SetParentControl(Control e) { m_parentcontrol=e; } [Browsable(true)] [TypeConverter(typeof(boolValueConverter))] [DisplayName("Collapse"), Category("Panel Information"), Description("Minimize/Maximize Panel")] public bool Collapse { get { return m_isminimized; } set { m_isminimized = value; if(m_parent!=null) m_parentcontrol.Refresh(); Refresh(); } } However the when my panel is minimized, the area that was left behind displays the transparent color. If its okay with you, can i ask for your email address so that I could email you the output sample of my program. Perhaps I'll to follow your second suggestion, however how can my user control aware or get the area only that it has overlapped? Thanks