Click here to Skip to main content
15,923,909 members
Home / Discussions / C#
   

C#

 
QuestionWhy C# (and .NET) does not support multiple-class-inheritance? Pin
Salil Khedkar19-Oct-04 22:43
Salil Khedkar19-Oct-04 22:43 
AnswerRe: Why C# (and .NET) does not support multiple-class-inheritance? Pin
Steve Maier20-Oct-04 5:37
professionalSteve Maier20-Oct-04 5:37 
GeneralRe: Why C# (and .NET) does not support multiple-class-inheritance? Pin
Salil Khedkar20-Oct-04 20:47
Salil Khedkar20-Oct-04 20:47 
GeneralRe: Why C# (and .NET) does not support multiple-class-inheritance? Pin
Steve Maier21-Oct-04 3:43
professionalSteve Maier21-Oct-04 3:43 
GeneralRe: Why C# (and .NET) does not support multiple-class-inheritance? Pin
Salil Khedkar24-Oct-04 22:59
Salil Khedkar24-Oct-04 22:59 
QuestionCan any one help me? Pin
MoustafaS19-Oct-04 22:18
MoustafaS19-Oct-04 22:18 
AnswerRe: Can any one help me? Pin
J4amieC19-Oct-04 22:42
J4amieC19-Oct-04 22:42 
GeneralRe: Can any one help me? Pin
Anonymous19-Oct-04 22:56
Anonymous19-Oct-04 22:56 
ok that is the whole code
i think that would help



using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Data;
using System.Windows.Forms;


namespace MyCustomControls
{
///

///

public class custom1:System.Windows.Forms.Button
{
private Point p1 ;
private Point p2 ;
private Point p3;
private Point p4;
private Point p5;
private Point p6;
private Point p7;
private Point p8;
private Point p9;
private Point p10;
private Point p11;
private Point p12;
private Point[] points;
int x;
int y;
int z;
int a;
private System.Drawing.Drawing2D.LinearGradientBrush lgb ;
private System.Drawing.Drawing2D.GraphicsPath gb;
private System.Drawing.Color color1;
private Color color2 ;
private Color color3;
private Graphics g;
private Rectangle rec;


private Pen pen;


public custom1()
{
Init();
}
public void Init()
{

x = this.Width ;
y = this.Height;

z = x / 2;
a = y / 2;
color1 = Color.Silver;
color2 = Color.White;
color3 = Color.Navy;

p1 = new Point(1, 0);
p2 = new Point(x-1, 0);
p3 = new Point(x-1,1);
p4 = new Point(x, 1);
p5 = new Point(x, y-1);
p6 = new Point(x-1, y-1);
p7 = new Point(x-1, y);
p8 = new Point(1, y);
p9 = new Point(1, y-1);
p10 = new Point(0, y-1);
p11 = new Point(0, 1);
p12 = new Point(1, 1);
points = new Point[12]{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12};


lgb = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height),Color.FromArgb(253,253,253),Color.FromArgb(201,200,220),90.0f);
gb = new GraphicsPath();

float[] relativeIntensities = {0.0f, 0.008f, 1.0f};
float[] relativePositions = {0.0f, 0.32f, 1.0f};


Blend blend = new Blend();
blend.Factors = relativeIntensities;
blend.Positions = relativePositions;
lgb.Blend = blend;
rec = new Rectangle(0, 0, this.Width, this.Height);
//events
// this.Click+=new EventHandler(custom1_Click);
// this.MouseEnter+=new EventHandler(custom1_MouseEnter);
// this.MouseLeave+=new EventHandler(custom1_MouseLeave);
// this.MouseDown+=new MouseEventHandler(custom1_MouseDown);
// this.MouseUp+=new MouseEventHandler(custom1_MouseUp);
//


}




protected override void OnPaint(PaintEventArgs e)
{
g = e.Graphics;


g.FillPolygon(lgb, points);

gb.AddLines(points);




this.Region = new Region(gb);
//base.OnPaint (e);
}



public enum States
{
Normal,
MouseOver,
Pushed
}
States state;
protected override void OnMouseEnter(EventArgs e)
{
state = States.MouseOver;
this.Invalidate(rec);
base.OnMouseEnter(e);
}


protected override void OnMouseLeave(System.EventArgs e)
{
state = States.Normal;
this.Invalidate(rec);
base.OnMouseLeave(e);
}

protected override void OnMouseDown
(System.Windows.Forms.MouseEventArgs e)
{
// do nothing if pressed not the left button of mouse
if ((e.Button & MouseButtons.Left) != MouseButtons.Left) return;
if (rec.Contains(e.X, e.Y))
{
state = States.Pushed;
// button receives an imput focus
this.Focus();
}
else state = States.Normal;
this.Invalidate(rec);
base.OnMouseDown(e);
}

protected override void OnMouseUp
(System.Windows.Forms.MouseEventArgs e)
{
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
state = States.Normal;
this.Invalidate(rec);
base.OnMouseUp(e);
}





}
}
GeneralAny One Help plz Pin
Anonymous19-Oct-04 22:10
Anonymous19-Oct-04 22:10 
General,Any One Help plz Pin
Anonymous19-Oct-04 22:08
Anonymous19-Oct-04 22:08 
Generalsync Pin
hagay_ar19-Oct-04 21:30
hagay_ar19-Oct-04 21:30 
GeneralRe: sync Pin
yoaz19-Oct-04 23:38
yoaz19-Oct-04 23:38 
Generalon timer Pin
ppp00119-Oct-04 21:12
ppp00119-Oct-04 21:12 
GeneralRe: on timer Pin
Stefan Troschuetz19-Oct-04 21:19
Stefan Troschuetz19-Oct-04 21:19 
GeneralRe: on timer Pin
Salil Khedkar19-Oct-04 22:52
Salil Khedkar19-Oct-04 22:52 
Questionhow to Add history to menu...? Pin
Kiran Satish19-Oct-04 20:39
Kiran Satish19-Oct-04 20:39 
AnswerRe: how to Add history to menu...? Pin
Stefan Troschuetz19-Oct-04 21:58
Stefan Troschuetz19-Oct-04 21:58 
AnswerRe: how to Add history to menu...? Pin
benjymous19-Oct-04 22:00
benjymous19-Oct-04 22:00 
GeneralRe: how to Add history to menu...? Pin
Kiran Satish20-Oct-04 12:30
Kiran Satish20-Oct-04 12:30 
GeneralListView Column Header Font Change Pin
Tony D. Abel19-Oct-04 13:44
Tony D. Abel19-Oct-04 13:44 
GeneralRe: ListView Column Header Font Change Pin
Nick Parker19-Oct-04 15:39
protectorNick Parker19-Oct-04 15:39 
General.net Variable Naming Conventions Pin
Jayman91119-Oct-04 13:18
Jayman91119-Oct-04 13:18 
GeneralRe: .net Variable Naming Conventions Pin
Steven Campbell19-Oct-04 13:22
Steven Campbell19-Oct-04 13:22 
GeneralRe: .net Variable Naming Conventions Pin
Jayman91119-Oct-04 13:28
Jayman91119-Oct-04 13:28 
GeneralAccessing form controls in code Pin
isittheweekendyet19-Oct-04 12:59
isittheweekendyet19-Oct-04 12:59 

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.