Click here to Skip to main content
15,904,652 members
Home / Discussions / C#
   

C#

 
AnswerRe: fixed-Length formatting of String PinPopular
Luc Pattyn11-Apr-11 0:48
sitebuilderLuc Pattyn11-Apr-11 0:48 
QuestionEnable & Disable Dual Monitors Pin
Kevin Marois9-Apr-11 9:20
professionalKevin Marois9-Apr-11 9:20 
AnswerRe: Enable & Disable Dual Monitors Pin
GlobX10-Apr-11 18:29
GlobX10-Apr-11 18:29 
QuestionSetup problem Pin
milenalukic9-Apr-11 4:56
milenalukic9-Apr-11 4:56 
AnswerRe: Setup problem Pin
Not Active9-Apr-11 6:54
mentorNot Active9-Apr-11 6:54 
GeneralRe: Setup problem Pin
Wendelius9-Apr-11 8:08
mentorWendelius9-Apr-11 8:08 
QuestionPolyGon To Shift Right Pin
Anubhava Dimri8-Apr-11 20:22
Anubhava Dimri8-Apr-11 20:22 
AnswerRe: PolyGon To Shift Right Pin
OriginalGriff8-Apr-11 20:39
mveOriginalGriff8-Apr-11 20:39 
GeneralRe: PolyGon To Shift Right Pin
Anubhava Dimri8-Apr-11 20:49
Anubhava Dimri8-Apr-11 20:49 
GeneralRe: PolyGon To Shift Right Pin
OriginalGriff8-Apr-11 21:02
mveOriginalGriff8-Apr-11 21:02 
GeneralRe: PolyGon To Shift Right Pin
Anubhava Dimri8-Apr-11 22:44
Anubhava Dimri8-Apr-11 22:44 
AnswerRe: PolyGon To Shift Right Pin
Richard MacCutchan8-Apr-11 23:22
mveRichard MacCutchan8-Apr-11 23:22 
AnswerRe: PolyGon To Shift Right Pin
OriginalGriff8-Apr-11 23:29
mveOriginalGriff8-Apr-11 23:29 
Good - you are drawing it in the Paint event.

The simplest way is to just add an offset into your curve constructor:
private void panel1_Paint(object sender, PaintEventArgs e)
    {
    DrawPolygonPoint(e);
    DrawPolygonPoint(e, -10, -20);
    DrawPolygonPoint(e, -20, 10);
    }

Point point1 = new Point(50, 50);
Point point2 = new Point(100, 25);
Point point3 = new Point(200, 5);
Point point4 = new Point(250, 50);
Point point5 = new Point(300, 100);
Point point6 = new Point(350, 200);
Point point7 = new Point(250, 250);

public void DrawPolygonPoint(PaintEventArgs e)
    {
    DrawPolygonPoint(e, 0, 0);
    }
public void DrawPolygonPoint(PaintEventArgs e, int xOffset, int yOffset)
    {
    // Create pen.
    Pen blackPen = new Pen(Color.Black, 3);
    // Create points that define polygon.
    Point[] curvePoints =
     {
         AddOffset(point1, xOffset, yOffset),
         AddOffset(point2, xOffset, yOffset),
         AddOffset(point3, xOffset, yOffset),
         AddOffset(point4, xOffset, yOffset),
         AddOffset(point5, xOffset, yOffset),
         AddOffset(point6, xOffset, yOffset),
         AddOffset(point7, xOffset, yOffset)
     };

    // Draw polygon to screen.
    e.Graphics.DrawPolygon(blackPen, curvePoints);
    blackPen.Dispose();
    }
private Point AddOffset(Point p, int xOffset, int yOffset)
    {
    return new Point(p.X + xOffset, p.Y + yOffset);
    }
(NOTE: If you construct a graphics item, such as a pen, you should dispose of it when you are finished)
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

Manfred R. Bihy: "Looks as if OP is learning resistant."

GeneralRe: PolyGon To Shift Right Pin
Anubhava Dimri8-Apr-11 23:51
Anubhava Dimri8-Apr-11 23:51 
AnswerRe: PolyGon To Shift Right Pin
OriginalGriff9-Apr-11 0:04
mveOriginalGriff9-Apr-11 0:04 
GeneralRe: PolyGon To Shift Right Pin
Anubhava Dimri9-Apr-11 0:39
Anubhava Dimri9-Apr-11 0:39 
GeneralRe: PolyGon To Shift Right Pin
dan!sh 9-Apr-11 1:03
professional dan!sh 9-Apr-11 1:03 
AnswerRe: PolyGon To Shift Right Pin
OriginalGriff9-Apr-11 1:07
mveOriginalGriff9-Apr-11 1:07 
GeneralRe: PolyGon To Shift Right Pin
Anubhava Dimri9-Apr-11 1:10
Anubhava Dimri9-Apr-11 1:10 
GeneralRe: PolyGon To Shift Right Pin
OriginalGriff9-Apr-11 1:15
mveOriginalGriff9-Apr-11 1:15 
GeneralRe: PolyGon To Shift Right Pin
Luc Pattyn9-Apr-11 5:52
sitebuilderLuc Pattyn9-Apr-11 5:52 
GeneralRe: PolyGon To Shift Right Pin
OriginalGriff9-Apr-11 5:55
mveOriginalGriff9-Apr-11 5:55 
GeneralRe: PolyGon To Shift Right Pin
Anubhava Dimri10-Apr-11 18:17
Anubhava Dimri10-Apr-11 18:17 
GeneralRe: PolyGon To Shift Right [modified] Pin
GlobX10-Apr-11 18:32
GlobX10-Apr-11 18:32 
GeneralRe: PolyGon To Shift Right Pin
David198710-Apr-11 20:26
David198710-Apr-11 20:26 

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.