Click here to Skip to main content
15,886,840 members
Home / Discussions / C#
   

C#

 
GeneralRe: Implementing IDisposable Pin
Gilbert Consellado9-May-14 1:11
professionalGilbert Consellado9-May-14 1:11 
GeneralRe: Implementing IDisposable Pin
Dave Kreskowiak9-May-14 1:26
mveDave Kreskowiak9-May-14 1:26 
GeneralRe: Implementing IDisposable Pin
Gilbert Consellado9-May-14 1:38
professionalGilbert Consellado9-May-14 1:38 
Questionpolling call to a url Pin
nitin_ion8-May-14 20:38
nitin_ion8-May-14 20:38 
AnswerRe: polling call to a url Pin
Pete O'Hanlon8-May-14 20:52
mvePete O'Hanlon8-May-14 20:52 
QuestionDrawing a rectangle using GraphicsPath in C# doesn't complete the drawing (GDI+) Pin
jesuraj.pradeep8-May-14 20:05
jesuraj.pradeep8-May-14 20:05 
AnswerRe: Drawing a rectangle using GraphicsPath in C# doesn't complete the drawing (GDI+) Pin
Bernhard Hiller8-May-14 21:36
Bernhard Hiller8-May-14 21:36 
AnswerRe: Drawing a rectangle using GraphicsPath in C# doesn't complete the drawing (GDI+) Pin
OriginalGriff8-May-14 21:41
mveOriginalGriff8-May-14 21:41 
You are creating a GraphicsPath, but that doesn't draw it, or indeed anything, until you use one of the Graphics.DrawXXX methods.
In your case, add this:
C#
path.CloseFigure();
g.DrawPath(redPen, path);  // And draw it.
}
But do note that CloseFigure draws between teh first and last points - so you will get a diagonal as well!
Me? I'd draw your rectangle like this:
C#
private void OnPaint(object sender, PaintEventArgs e)
    {
    using (Pen redPen = new Pen(Color.Red, 2))
        {
        Graphics g = e.Graphics;
        g.DrawLine(redPen, 20, 20, 20, 400); // left
        g.DrawLine(redPen, 20, 20, 400, 20); //top
        g.DrawLine(redPen, 400, 20, 400, 400); // right
        g.DrawLine(redPen, 20, 400, 400, 400); // bottom
        }
    }
And save Paths and Regions for the more complex shapes!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

QuestionSearch and Retrieving String Pin
ASPnoob8-May-14 20:01
ASPnoob8-May-14 20:01 
AnswerRe: Search and Retrieving String Pin
Mycroft Holmes8-May-14 21:21
professionalMycroft Holmes8-May-14 21:21 
AnswerRe: Search and Retrieving String Pin
V.8-May-14 23:27
professionalV.8-May-14 23:27 
AnswerRe: Search and Retrieving String Pin
Emre Ataseven11-May-14 5:50
professionalEmre Ataseven11-May-14 5:50 
QuestionHandle Task Exception In Main Thread Pin
Kevin Marois8-May-14 14:31
professionalKevin Marois8-May-14 14:31 
QuestionDeveloping a .NET obfuscator. Need feedback. Pin
ianderf8-May-14 9:17
ianderf8-May-14 9:17 
AnswerRe: Developing a .NET obfuscator. Need feedback. Pin
Richard Andrew x648-May-14 11:05
professionalRichard Andrew x648-May-14 11:05 
GeneralRe: Developing a .NET obfuscator. Need feedback. Pin
ianderf8-May-14 11:10
ianderf8-May-14 11:10 
GeneralRe: Developing a .NET obfuscator. Need feedback. Pin
Richard MacCutchan8-May-14 22:46
mveRichard MacCutchan8-May-14 22:46 
QuestionBufferedGraphics object will AutoScroll position Pin
Chris Copeland8-May-14 7:23
mveChris Copeland8-May-14 7:23 
AnswerRe: BufferedGraphics object will AutoScroll position Pin
Chris Copeland8-May-14 9:20
mveChris Copeland8-May-14 9:20 
QuestionNUnit- Custom Property Attribute display in Test Explorer window Pin
ercharu228-May-14 6:37
ercharu228-May-14 6:37 
QuestionTextTransformation with VS Packages Pin
Kani Mozhi7-May-14 23:47
Kani Mozhi7-May-14 23:47 
QuestionCustom reporting solution with SSRS Pin
Tridip Bhattacharjee7-May-14 21:03
professionalTridip Bhattacharjee7-May-14 21:03 
AnswerRe: Custom reporting solution with SSRS Pin
Mycroft Holmes7-May-14 23:21
professionalMycroft Holmes7-May-14 23:21 
GeneralRe: Custom reporting solution with SSRS Pin
Tridip Bhattacharjee8-May-14 21:24
professionalTridip Bhattacharjee8-May-14 21:24 
AnswerRe: Custom reporting solution with SSRS Pin
ZurdoDev8-May-14 7:53
professionalZurdoDev8-May-14 7:53 

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.