Click here to Skip to main content
15,893,381 members
Home / Discussions / C#
   

C#

 
GeneralRe: For a inherent class, why its events can not be inherented Pin
Heath Stewart2-Nov-03 11:05
protectorHeath Stewart2-Nov-03 11:05 
GeneralRe: For a inherent class, why its events can not be inherented Pin
chq122-Nov-03 14:34
chq122-Nov-03 14:34 
GeneralRe: For a inherent class, why its events can not be inherented Pin
Heath Stewart3-Nov-03 2:37
protectorHeath Stewart3-Nov-03 2:37 
GeneralRe: For a inherent class, why its events can not be inherented Pin
chq124-Nov-03 5:39
chq124-Nov-03 5:39 
GeneralStatus Bars Pin
hammackj1-Nov-03 13:07
hammackj1-Nov-03 13:07 
GeneralRe: Status Bars Pin
Daniel M. Edwards1-Nov-03 13:35
Daniel M. Edwards1-Nov-03 13:35 
GeneralRe: Status Bars Pin
hammackj1-Nov-03 14:16
hammackj1-Nov-03 14:16 
GeneralUrgent help, about a inherit button class Pin
chq121-Nov-03 13:06
chq121-Nov-03 13:06 
I wrote a inherit button, myButton, when I used click event for myButton, I found it did not work, no event response. if I changed it to button, it work very well, then what's wrong is it? should i override onclick method or anything else I need to do?
myButton testbutton = new myButton("test", new Rectangle(0,0, 45, 45));
this.testbutton.Click += new System.EventHandler(testbutton_click);


class myButton : System.Windows.Forms.Button{
int ShowType;
Brush backBrush;
Brush textBrush;
Font myFont;
public myButton(String title, Rectangle rect){
backBrush = System.Drawing.Brushes.Violet;
textBrush = System.Drawing.Brushes.Green;
myFont = new Font(FontFamily.GenericSerif, 18, FontStyle.Bold | FontStyle.Italic, GraphicsUnit.Pixel);

this.Bounds = rect;
this.Text = title;
GraphicsPath myPath = new GraphicsPath();
Rectangle rect1 = new Rectangle(0, 0, this.Bounds.Width, this.Bounds.Height);
myPath.StartFigure();
myPath.AddArc(rect1, 0, 360);
myPath.CloseFigure();
this.Region = new Region(myPath);
ShowType = 0;
}
protected override void OnMouseEnter(EventArgs e){
backBrush = System.Drawing.Brushes.Orange;
textBrush = System.Drawing.Brushes.Green;
ShowType = 0;
Invalidate();
}
protected override void OnMouseLeave(EventArgs e){
backBrush = System.Drawing.Brushes.Violet;
textBrush = System.Drawing.Brushes.Blue;
ShowType = 0;
Invalidate();
}
protected override void OnMouseDown(MouseEventArgs e){
backBrush = System.Drawing.Brushes.Orange;
textBrush = System.Drawing.Brushes.Blue;
ShowType = 1;
Invalidate();
}
protected override void OnMouseUp(MouseEventArgs e){
backBrush = System.Drawing.Brushes.Orange;
textBrush = System.Drawing.Brushes.Red;
ShowType = 0;
Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
SizeF mySizeF = e.Graphics.MeasureString(this.Text, myFont);
e.Graphics.FillRectangle(backBrush, new Rectangle(0, 0, this.Width, this.Height));
if(ShowType==1)
e.Graphics.DrawEllipse(System.Drawing.Pens.Red, new Rectangle(0, 0, this.Width, this.Height));
int offwidth = (int) ((this.Width - mySizeF.Width)/2);
int offheight = (int) ((this.Height-mySizeF.Height)/2);
e.Graphics.DrawString(this.Text, myFont, textBrush, offwidth, offheight);
}

}

GeneralRe: Urgent help, about a inherit button class Pin
Alex Korchemniy1-Nov-03 15:30
Alex Korchemniy1-Nov-03 15:30 
GeneralRe: Urgent help, about a inherit button class Pin
chq122-Nov-03 4:26
chq122-Nov-03 4:26 
GeneralRe: Urgent help, about a inherit button class Pin
Steve S3-Nov-03 2:57
Steve S3-Nov-03 2:57 
GeneralSynchronization Pin
peter27131-Nov-03 12:23
peter27131-Nov-03 12:23 
GeneralRe: Synchronization Pin
Jeff Varszegi1-Nov-03 20:42
professionalJeff Varszegi1-Nov-03 20:42 
GeneralRe: Synchronization Pin
peter27131-Nov-03 23:42
peter27131-Nov-03 23:42 
GeneralRe: Synchronization Pin
jparsons3-Nov-03 10:31
jparsons3-Nov-03 10:31 
QuestionDisplay MIME parts of e-mails? Pin
trungbkvn1-Nov-03 5:21
trungbkvn1-Nov-03 5:21 
AnswerRe: Display MIME parts of e-mails? Pin
Heath Stewart2-Nov-03 11:13
protectorHeath Stewart2-Nov-03 11:13 
GeneralRe: Display MIME parts of e-mails? Pin
trungbkvn4-Nov-03 1:13
trungbkvn4-Nov-03 1:13 
GeneralRe: Display MIME parts of e-mails? Pin
Heath Stewart4-Nov-03 2:29
protectorHeath Stewart4-Nov-03 2:29 
GeneralRe: Display MIME parts of e-mails? Pin
trungbkvn4-Nov-03 2:35
trungbkvn4-Nov-03 2:35 
GeneralImages on Listview SubItems Pin
Mahesh Varma1-Nov-03 0:47
Mahesh Varma1-Nov-03 0:47 
GeneralRe: Images on Listview SubItems Pin
FocusedWolf14-Jan-04 13:09
FocusedWolf14-Jan-04 13:09 
GeneralRegularExpressions Pin
Rohde31-Oct-03 22:41
Rohde31-Oct-03 22:41 
GeneralRe: RegularExpressions Pin
Rohde31-Oct-03 23:58
Rohde31-Oct-03 23:58 
GeneralRe: RegularExpressions Pin
Blake Coverett1-Nov-03 15:56
Blake Coverett1-Nov-03 15:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.