Advertisement

02.01.2008 at 02:13PM PST, ID: 23131008
[x]
Attachment Details

Getting back color of derived panel to change color at Design Time when I click on it?

Asked by knowlton in Programming for ASP.NET

How do I get the back color of derived panel to change color at Design Time when I click on it?

See my comment in the code snippet below -- the method is entered, but nothing happens

[look for this comment]
//////////////////  NOTHING HAPPENS  ///////////////////
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Web.UI.Design;
using System.Web.UI.Design.WebControls;
 
 
 
 
namespace AJAXEnabledWebApplication1
{
    [DesignerAttribute(typeof(GPBoxDesigner)),
  ToolboxData("<{0}:GPBox runat=\"server\"></{0}:GPBox>")]
 
    public class GPBox : Panel
    {
        public GPBox()
        {
            this.BorderStyle = BorderStyle.Solid;
            this.BorderWidth = 1;
            this.Width = 300;
            this.Height = 300;
 
            GPBoxDesigner.WasClicked += null;
            GPBoxDesigner.WasClicked += new EventHandler(this.RespondToClick);
        }
 
        private void RespondToClick(object sender, EventArgs e)
        {
 
//////////////////  NOTHING HAPPENS  ///////////////////
            this.BackColor = System.Drawing.Color.Red;
            this.BorderStyle = BorderStyle.Groove;
        }
    }
 
    public class GPBoxDesigner : ControlDesigner
    {
        public static event EventHandler WasClicked;
 
        protected override void OnClick(DesignerRegionMouseEventArgs e)
        {
            base.OnClick(e);
 
            if (WasClicked != null)
            {
                WasClicked(null, null);
            }
            
        }
    }
}
 
 
[+][-]02.04.2008 at 11:20AM PST, ID: 20817118

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.07.2008 at 09:37AM PST, ID: 20842902

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Programming for ASP.NET
Sign Up Now!
Solution Provided By: knowlton
Participating Experts: 1
Solution Grade: B
 
 
[+][-]02.08.2008 at 06:53AM PST, ID: 20850651

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906