チャートコントロールを使わないで描画する例を考えているが、チャートコントロールで描画と消去でやった方がいいかな。もう半日以上費やしている・・・。
Formに直接ラインで書くと色々と大変だ。描画した線を消すのもレクトアングルで塗り消すなどしか方法がない。
pictureBoxはどうなのか。トライしている最中です。
private void Form1_Load(object sender, EventArgs e)
{
pictureBox1.Image = new Bitmap(pictureBox1.ClientRectangle.Width, pictureBox1.ClientRectangle.Height);
byouga();
}
private void byouga()
{
// PictureBoxのImageを描画対象にします。
using(var g = Graphics.FromImage(pictureBox1.Image))
using(Pen greenPen = new Pen(Color.Green, 5))
{
// lineの始点と終点を設定
Point Start_point5 = new Point(50, 200);
Point End_point5 = new Point(250, 200);
// lineを描画
g.DrawLine(greenPen, Start_point5, End_point5);
}
// コントロールを再描画させます。
pictureBox1.Invalidate();
}
No tags for this post.

