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

Annotation of /trunk/NexusPowerControl/ThemeButton.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (hide annotations) (download)
Sat Oct 22 22:14:15 2011 UTC (8 years, 1 month ago) by william
File size: 2409 byte(s)
implement theme button clicking

1 william 10 using System;
2     using System.Collections.Generic;
3     using System.ComponentModel;
4     using System.Drawing;
5     using System.Data;
6     using System.Linq;
7     using System.Text;
8     using System.Windows.Forms;
9    
10     namespace NexusPowerControl
11     {
12 william 11 public delegate void Click(EventArgs e);
13 william 10 [DefaultEvent("Click")]
14     public partial class ThemeButton : UserControl
15     {
16 william 11 [Browsable(true)]
17     [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
18     public EventHandler OnClickEvent;
19 william 10 public ThemeButton()
20     {
21     InitializeComponent();
22 william 11 this.OnClickEvent = null;
23 william 10 this.Image = NexusPowerControl.Properties.Resources.missing;
24     this.Text = "template";
25 william 11 this.ToolTip = new ToolTip();
26 william 10 }
27     [Browsable(true)]
28     [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
29     public Image Image
30     {
31     get { return picImage.Image; }
32     set { picImage.Image = value; }
33     }
34     [Browsable(true)]
35     [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
36     public override string Text
37     {
38     get { return lblText.Text; }
39     set { lblText.Text = value; }
40     }
41 william 11 [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 william 10 }
79     }

  ViewVC Help
Powered by ViewVC 1.1.22