/[NexusPowerControl]/trunk/NexusPowerControl/ThemeButton.cs
ViewVC logotype

Diff of /trunk/NexusPowerControl/ThemeButton.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/NexusPowerControl/ThemeButton.cs	2011/10/22 21:35:13	10
+++ trunk/NexusPowerControl/ThemeButton.cs	2011/10/22 22:14:15	11
@@ -9,14 +9,20 @@
 
 namespace NexusPowerControl
 {
+    public delegate void Click(EventArgs e);
     [DefaultEvent("Click")]
     public partial class ThemeButton : UserControl
     {
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+        public EventHandler OnClickEvent;
         public ThemeButton()
         {
             InitializeComponent();
+            this.OnClickEvent = null;
             this.Image = NexusPowerControl.Properties.Resources.missing;
             this.Text = "template";
+            this.ToolTip = new ToolTip();
         }
         [Browsable(true)]
         [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
@@ -25,7 +31,6 @@
             get { return picImage.Image; }
             set { picImage.Image = value; }
         }
-
         [Browsable(true)]
         [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
         public override string Text
@@ -33,6 +38,42 @@
             get { return lblText.Text; }
             set { lblText.Text = value; }
         }
-        
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+        public ToolTip ToolTip
+        {
+            get { return toolTip1; }
+            protected set { toolTip1 = value; }
+        }
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+        public string ToolTipText
+        {
+            get { return this.ToolTip.GetToolTip(this); }
+            set { this.ToolTip.SetToolTip(this, value); }
+        }
+
+
+        private void ThemeButton_Click(object sender, EventArgs e)
+        {
+            if (this.OnClickEvent != null)
+            {
+                this.OnClickEvent(this, e);
+            }
+            else
+            {
+                base.OnClick(e);
+            }
+        }
+
+        private void picImage_Click(object sender, EventArgs e)
+        {
+            ThemeButton_Click(sender, e);
+        }
+
+        private void lblText_Click(object sender, EventArgs e)
+        {
+            ThemeButton_Click(sender, e);
+        }
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22