   [.net] ASP.NET + Shadow on a custom control
  Hi!I've finally managed to create a custom web control. I'm trying to write a custom GUI that can be used in browsers. My base class for this (at this time) is the standard Panel control. You can set its width,height, set its position in the browser, set its transpareny, each displayed correctly in the VS Designer. Now I'm trying to make the control cast a shadow onto controls, laying under it. I found two ways, but only one of them works, more or less:1.: create an empty control with the same size, offset it with a few pixels (the "width" of the shadow), set its Z value 1 less than the cotnrol's, and add it to the page. this would be an easy job, but i don't know how to add this new control to the visible controls. I try this:class myBaseControl : Panel{void setShadow(){this.Page.Controls.Add(theShadowObject); //at this point, a get an exception}}2.: In the control i create 2 child controls. One for the shadow, one for the client area. After setting them properly, i make the parent control invisible.This one works quite well, until i try to add some controls in the VS Designer. Unfortunately it cannot see and render the child controls in design view, and i cannot even copy its contents into the newly created client area, so this solution seems to be a dead end.Could anyone help me? /i hope i could make myself clear, you know my english is ... i lack practice :)/Here is a sample. I hope you can load it (its a home server in Hungary)http://193.226.245.177/Default.aspxorhttp://werike.dyndns.hu/Default.aspx(IE required, or browsers that support transparency (filter: transparent(opacity=***)))[Edited by - orbano on May 25, 2006 4:57:12 AM]
Quote:Original post by orbanoHi!I've finally managed to create a custom web control. I'm trying to write a custom GUI that can be used in browsers. My base class for this (at this time) is the standard Panel control. You can set its width,height, set its position in the browser, set its transpareny, each displayed correctly in the VS Designer. Now I'm trying to make the control cast a shadow onto controls, laying under it. I found two ways, but only one of them works, more or less:1.: create an empty control with the same size, offset it with a few pixels (the "width" of the shadow), set its Z value 1 less than the cotnrol's, and add it to the page. this would be an easy job, but i don't know how to add this new control to the visible controls. I try this:class myBaseControl : Panel{void setShadow(){this.Page.Controls.Add(theShadowObject); //at this point, a get an exception}}Umm, what's the exception you get. Kind of hard to help if we don't know what the problem is. [grin];  Okay, i will find that one out. Unfortunately i have a german OS on my temporary developer machine, and it upgraded my native framework with the grman language pack... that one really sucks if your german is really poor :)Ohh yeah i managed to find out what the exception is: its a nullreference exception for the Control.Page property. So the Page, containing my control is not set. how can it be, and how could i set that?The main problem is i dont know any way to create and display a "global" control at runtime   ;  From where are you calling setShadow?   ;  Actually this is the correct call hierarchy:class myControl : Panel{public bool Shadow{  get  {   return hasShadow_  }  set  {   if(value)   {    this.shadow_ = new myControl();    this.Page.Controls.Add(this.shadow_);   }  }}}   ;  That doesn't answer the question - from where are you setting the shadow for the panel? What's the code that calls the set and where is it?   ;  In the VS Designer (see my last post, the DM:dmWebControl tag, the Shadow property is set there). nowere else i call the Shadow's set function   