| ■103798 / ) |
Re[9]: Visual Basicで簡易CADを作成 |
□投稿者/ kiku (484回)-(2025/08/01(Fri) 08:47:54)
|
■No103797 (shiro さん) に返信 > Private Sub PictureBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseUp > > isDragging = False > > pointList.Clear() > pointList.Add(startPoint) > pointList.Add(endPoint) > > PictureBox1.Invalidate() > > End Sub pointListを毎回クリアしているので、 保持している線は1本のみで、 過去の線は保持していないのではないでしょうか?
> Private Sub PictureBox1_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox1.Paint > > Dim pen7 As New Pen(Color.Blue, 5) > > If isDragging Then > e.Graphics.DrawLine(Pens.Blue, startPoint, endPoint) > ElseIf pointList.Count = 2 Then > e.Graphics.DrawLine(Pen7, pointList(0), pointList(1)) > End If > > End Sub
ドラック中は、ドラック中の線のみを描画し、 ドラックしていないときは、保持した1本のみを描画しています。 やはり、過去の線を描画するようにはなっていないようです。
|
|