Draw Line - CSharp System.Drawing

CSharp examples for System.Drawing:Graphics

Description

Draw Line

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Collections.Generic;
using System;/*from   ww  w.  j a  va2  s  . com*/

public class Main{
        public static void DrawLine(Graphics grahic, int x1, int y1, int x2, int y2,int num)
        {
            grahic.DrawLine(myPen, x1, y1, x2, y2);
            grahic.DrawString(num.ToString(), new Font(FontFamily.GenericSerif, 8), Brushes.Beige, (x1 + x2) / 2, (y1 + y2) / 2);
        }
        public static void DrawLine(Graphics grahic,int x1,int y1,int x2,int y2)
        {
            grahic.DrawLine(myPen, x1,y1,x2,y2);
        }
}

Related Tutorials