私の質問はスタックオーバーフローの質問Draw lines on a picturebox using mouse clicks in C#に関連していますが、マウスボタンが上になると描画された線が消えます。これをどうやって解決するのですか?ピクチャボックスに線を描画する
private void GainBox_MouseDn(object sender, MouseEventArgs e)
{
mouse_dn = true;
}
private void GainBox_MouseMv(object sender, MouseEventArgs e)
{
//Line drawn from lookup table
if (mouse_dn)
{
img = new Bitmap(256, 256);
//Get the coordinates (x, y) for line from lookup table.
for (x = x1; x < x2; x++)
img.SetPixel(x, y, Color.Red);
//Same for y coordinate
}
GainBox.Refresh();
}
private void GainBox_MouseUp(object sender, MouseEventArgs e)
{
mouse_dn = false;
}
質問タイトルに使用されている言語についての情報が含まれていないと意味がない限り、その情報は含めないでください。タグはこの目的に役立ちます。 –