how can I get the original properties of my form back?
-
hi i have a win form... and i'm changing it's properties at runtime (e.g. BackColor) at some point i want to get back the orginal BackColor.. the color i specefied at design time. when i'm creating a new instance of the form and trying to copy the BackColor from it it's not working! it's as if i changed the class not an instance of it at runtime!!! please help me
-
hi i have a win form... and i'm changing it's properties at runtime (e.g. BackColor) at some point i want to get back the orginal BackColor.. the color i specefied at design time. when i'm creating a new instance of the form and trying to copy the BackColor from it it's not working! it's as if i changed the class not an instance of it at runtime!!! please help me
-
hi i have a win form... and i'm changing it's properties at runtime (e.g. BackColor) at some point i want to get back the orginal BackColor.. the color i specefied at design time. when i'm creating a new instance of the form and trying to copy the BackColor from it it's not working! it's as if i changed the class not an instance of it at runtime!!! please help me
LOL - I just answered this on MSDN. Your form needs to call InitialiseComponent in order to have it's properties set. Create a method that sets the default properties, call it after InitialiseComponent and then call it again if you need to reset.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
hi i have a win form... and i'm changing it's properties at runtime (e.g. BackColor) at some point i want to get back the orginal BackColor.. the color i specefied at design time. when i'm creating a new instance of the form and trying to copy the BackColor from it it's not working! it's as if i changed the class not an instance of it at runtime!!! please help me
Hello, Before you change the Forms BackColor you have to save it at a global Color variable
private Color oldBackColor; private void youreMethod() { //save your color oldBackColor = this.BackColor; this.BackColor = Color.???; } private void youreothermethod() { //get back youre color if(Iwhantit()==true) this.BackColor = oldBackColor; }
Hope that helps you. All the best, Martin