1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
protected override void OnPaint(PaintEventArgs e)
{
int i;
int x = 1;
int y = 1;
int MiniX = 0;
int MiniY = 0;
string LigneCourante;
...
//System.Drawing.Graphics formGraphics = this.CreateGraphics();
System.Drawing.Graphics formGraphics = e.Graphics;
System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 8);
System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
System.Drawing.StringFormat drawFormat = new System.Drawing.StringFormat(System.Drawing.StringFormat.GenericDefault);
System.Drawing.Pen MyPen = new System.Drawing.Pen(System.Drawing.Color.Red);
for (i = 0; i < MonBlocDeTexte.GetNbLines(); i++)
{
formGraphics.DrawString(MonBlocDeTexte.GetLine(), drawFont, drawBrush, x, y, drawFormat);
//formGraphics.DrawLine(MyPen, x, y, 20, y);
y += 10;
//LigneCourante = MonBlocDeTexte.GetLine();
//string[] words = LigneCourante.Split(' ');
//if (words[0] == "S")
//{
// formGraphics.DrawRectangle(MyPen, Convert.ToInt32(words[1]) - MiniX, Convert.ToInt32(words[2]) - MiniY, Convert.ToInt32(words[3]) - Convert.ToInt32(words[1]) - MiniX, Convert.ToInt32(words[4]) - Convert.ToInt32(words[2]) - MiniY);
//}
}
drawFont.Dispose();
drawBrush.Dispose();
//formGraphics.Dispose();
} |
Partager