ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/NexusPowerControl/trunk/NexusPowerControl/ThemeButton.cs
(Generate patch)

Comparing trunk/NexusPowerControl/ThemeButton.cs (file contents):
Revision 10 by william, Sat Oct 22 21:35:13 2011 UTC vs.
Revision 11 by william, Sat Oct 22 22:14:15 2011 UTC

# Line 9 | Line 9 | using System.Windows.Forms;
9  
10   namespace NexusPowerControl
11   {
12 +    public delegate void Click(EventArgs e);
13      [DefaultEvent("Click")]
14      public partial class ThemeButton : UserControl
15      {
16 +        [Browsable(true)]
17 +        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
18 +        public EventHandler OnClickEvent;
19          public ThemeButton()
20          {
21              InitializeComponent();
22 +            this.OnClickEvent = null;
23              this.Image = NexusPowerControl.Properties.Resources.missing;
24              this.Text = "template";
25 +            this.ToolTip = new ToolTip();
26          }
27          [Browsable(true)]
28          [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
# Line 25 | Line 31 | namespace NexusPowerControl
31              get { return picImage.Image; }
32              set { picImage.Image = value; }
33          }
28
34          [Browsable(true)]
35          [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
36          public override string Text
# Line 33 | Line 38 | namespace NexusPowerControl
38              get { return lblText.Text; }
39              set { lblText.Text = value; }
40          }
41 <        
41 >        [Browsable(true)]
42 >        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
43 >        public ToolTip ToolTip
44 >        {
45 >            get { return toolTip1; }
46 >            protected set { toolTip1 = value; }
47 >        }
48 >        [Browsable(true)]
49 >        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
50 >        public string ToolTipText
51 >        {
52 >            get { return this.ToolTip.GetToolTip(this); }
53 >            set { this.ToolTip.SetToolTip(this, value); }
54 >        }
55 >
56 >
57 >        private void ThemeButton_Click(object sender, EventArgs e)
58 >        {
59 >            if (this.OnClickEvent != null)
60 >            {
61 >                this.OnClickEvent(this, e);
62 >            }
63 >            else
64 >            {
65 >                base.OnClick(e);
66 >            }
67 >        }
68 >
69 >        private void picImage_Click(object sender, EventArgs e)
70 >        {
71 >            ThemeButton_Click(sender, e);
72 >        }
73 >
74 >        private void lblText_Click(object sender, EventArgs e)
75 >        {
76 >            ThemeButton_Click(sender, e);
77 >        }
78      }
79   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines