Dear all,
I have a code to draw an arc which works fine, but when I am using a conditional statement like IF with that , there is no error but I cannot see the Arc on the form
please look at these two codes , one of them with "If " statement and another without:
PowerShell
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace _1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen pn = new Pen(Color.Blue);
Rectangle rect = new Rectangle(50, 50, 200, 100);
g.DrawArc(pn, rect, 12, 84);
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace _1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public int m;
private void Form1_Paint(object sender, PaintEventArgs e)
{
if (m == 1)
{
Graphics g = e.Graphics;
Pen pn = new Pen(Color.Blue);
Rectangle rect = new Rectangle(50, 50, 200, 100);
g.DrawArc(pn, rect, 12, 84);
}
}
}
}
1 short reply
yamid88 pointsPosted Sep 1, 2008, 7:38 AM EDT