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

C#

 
Generalpanel round corners... Pin
FreJa2-Nov-03 0:28
FreJa2-Nov-03 0:28 
GeneralRe: panel round corners... Pin
Heath Stewart2-Nov-03 11:01
protectorHeath Stewart2-Nov-03 11:01 
GeneralRe: panel round corners... Pin
Douglas Troy4-Nov-03 6:40
Douglas Troy4-Nov-03 6:40 
GeneralFor a inherent class, why its events can not be inherented Pin
chq121-Nov-03 13:42
chq121-Nov-03 13:42 
GeneralRe: For a inherent class, why its events can not be inherented Pin
leppie1-Nov-03 20:43
leppie1-Nov-03 20:43 
GeneralRe: For a inherent class, why its events can not be inherented Pin
chq122-Nov-03 4:31
chq122-Nov-03 4:31 
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 
I override some method, such as OnMouseUp, OnMouseLeave, OnMouseEnter and OnMouseDown, following is the code. Someone told me I should call base method, But how can i call it? or it is from other problem.

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: 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 
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 

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.