Click here to Skip to main content
16,012,611 members
Home / Discussions / C#
   

C#

 
GeneralKey Event Pin
don7cry22-Jul-03 0:43
don7cry22-Jul-03 0:43 
GeneralGDI+ FillPolygon Pin
r921-Jul-03 23:43
r921-Jul-03 23:43 
GeneralRe: GDI+ FillPolygon Pin
Valeria Bogdevich22-Jul-03 3:24
Valeria Bogdevich22-Jul-03 3:24 
GeneralRe: GDI+ FillPolygon Pin
r922-Jul-03 3:33
r922-Jul-03 3:33 
GeneralRe: GDI+ FillPolygon Pin
Valeria Bogdevich22-Jul-03 3:49
Valeria Bogdevich22-Jul-03 3:49 
GeneralRe: GDI+ FillPolygon Pin
r922-Jul-03 6:22
r922-Jul-03 6:22 
GeneralRe: GDI+ FillPolygon Pin
r922-Jul-03 21:54
r922-Jul-03 21:54 
GeneralRe: GDI+ FillPolygon Pin
Valeria Bogdevich23-Jul-03 7:57
Valeria Bogdevich23-Jul-03 7:57 
1). In OnPaint:

Point[] points = {
new Point(4, 4),
new Point(50, 4),
new Point(50, 100),
new Point(27, 120),
new Point(4, 100),
new Point(4, 4)};

GraphicsPath path = new GraphicsPath();
path.AddLines(points);
Region reg = new Region(path);
bounds = reg.GetBounds(e.Graphics);

2). Override OnMouseMove method as follow:
protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
{
if (bounds.Contains(e.X, e.Y))
this.Cursor = Cursors.Hand;
else this.Cursor = Cursors.Default;
base.OnMouseEnter(e);
}

RectangleF bounds is global

This is if you want to draw a shape on a form.
If your shape is a control on the form, you should do it by another way.

PS: Because variable bounds you inisialize only once, you should do it, for example, in constructor or you may keep it in OnPaint but make sure that you initialize it once (performance!).


"...hasn't really been well accepted ... as the ratings tell us so far Smile | :) " - Nishant S
GeneralHiding a property in the Property Window Pin
Nick Seng21-Jul-03 20:59
Nick Seng21-Jul-03 20:59 
GeneralRe: Hiding a property in the Property Window Pin
J. Dunlap21-Jul-03 21:15
J. Dunlap21-Jul-03 21:15 
GeneralRe: Hiding a property in the Property Window Pin
Nick Seng21-Jul-03 21:27
Nick Seng21-Jul-03 21:27 
GeneralMultithreading Pin
Alberto Bencivenni21-Jul-03 20:53
Alberto Bencivenni21-Jul-03 20:53 
GeneralRe: Multithreading Pin
Julian Bucknall [MSFT]22-Jul-03 7:04
Julian Bucknall [MSFT]22-Jul-03 7:04 
GeneralRe: Multithreading Pin
Alberto Bencivenni22-Jul-03 21:24
Alberto Bencivenni22-Jul-03 21:24 
GeneralRe: Multithreading Pin
Julian Bucknall [MSFT]23-Jul-03 13:56
Julian Bucknall [MSFT]23-Jul-03 13:56 
GeneralRe: Multithreading Pin
Joe Woodbury22-Jul-03 8:28
professionalJoe Woodbury22-Jul-03 8:28 
GeneralRe: Multithreading Pin
Arun Bhalla22-Jul-03 12:40
Arun Bhalla22-Jul-03 12:40 
GeneralRe: Multithreading Pin
Alberto Bencivenni22-Jul-03 21:39
Alberto Bencivenni22-Jul-03 21:39 
GeneralRe: Multithreading Pin
Joe Woodbury23-Jul-03 6:27
professionalJoe Woodbury23-Jul-03 6:27 
QuestionHow to read data in excel file Pin
Hoang Dung21-Jul-03 18:38
Hoang Dung21-Jul-03 18:38 
AnswerRe: How to read data in excel file Pin
Mazdak21-Jul-03 20:01
Mazdak21-Jul-03 20:01 
AnswerRe: How to read data in excel file Pin
Kannan Kalyanaraman21-Jul-03 20:14
Kannan Kalyanaraman21-Jul-03 20:14 
GeneralRe: How to read data in excel file Pin
Ista24-Jul-03 5:57
Ista24-Jul-03 5:57 
AnswerRe: How to read data in excel file Pin
Ista24-Jul-03 6:48
Ista24-Jul-03 6:48 
QuestionHow do i find a type of the object Pin
Ista21-Jul-03 17:03
Ista21-Jul-03 17:03 

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.