none
Problem when using bold line graph in Window Forms RRS feed

  • Question

  • I'm using Chart Lib in Window Forms to draw a graph line. 
    When I set graph width to 9 ( BorderWidth = 9 ) , the line is drawn over the area. ( sorry I dont know why but I can't upload the image )

    How can I fix it to draw ony in graph area

    Monday, October 30, 2017 2:49 AM

All replies

  • Hi bloodfire91,

    Thank you for posting here.

    Here is the sample code about how to draw line in form.

     protected override void OnPaint(PaintEventArgs e)
            {
                base.OnPaint(e);
                Graphics g = this.CreateGraphics();
    
                Pen p = new Pen(Brushes.Red);
                p.Width = 9;
    
                 
                Point p1 = new Point(50, 50);
                Point p2 = new Point(100, 100);
    
                g.DrawLine(p, p1, p2);
            }

    >>How can I fix it to draw ony in graph area

    What is the graph area you want to draw?

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, October 31, 2017 5:57 AM
    Moderator
  • Hi,

    Can you paste some codes here how you use Chart?

    Thanks a lot,

    Charles He


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, November 3, 2017 2:44 PM