的颜色对话框颜色
'我看了一个YouTube视频,该视频认为我如何制作油漆软件。它在大多数情况下做得很好,但是它教会了我如何每次尺寸添加一种颜色,我想学习如何使用尺寸的颜色对话框,这是一个链接。(https://www。youtube.com/watch?v=hj5pgzrup_0(``我尝试昏暗的adcolour作为新笔(刷(
'This is Colour blue for example and for other colours that i manually added in
Dim penBlS As New Pen(Brushes.Blue, 2)
Dim penBl As New Pen(Brushes.Blue, 5)
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
Dim g As Graphics = Graphics.FromImage(b)
Static coord As New Point
' If e.Button = Windows.Forms.MouseButtons.Left And tool = "pencil" Then
g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
each button on the software sets colour to the string set
If colour = "blue" And size = "2" Then
penBlS.StartCap = Drawing2D.LineCap.Round
penBlS.EndCap = Drawing2D.LineCap.Round
g.DrawLine(penBlS, coord.X, coord.Y, e.X, e.Y)
ElseIf Colour = "blue" And size = "5" Then
penBl.StartCap = Drawing2D.LineCap.Round
penBl.EndCap = Drawing2D.LineCap.Round
Else
If size = "2" Then
penS.StartCap = Drawing2D.LineCap.Round
penS.EndCap = Drawing2D.LineCap.Round
g.DrawLine(penS, coord.X, coord.Y, e.X, e.Y)
ElseIf size = "5" Then
pen.StartCap = Drawing2D.LineCap.Round
pen.EndCap = Drawing2D.LineCap.Round
g.DrawLine(pen, coord.X, coord.Y, e.X, e.Y)
End If
End If
g.Dispose()
PictureBox1.BackgroundImage = b
Me.Refresh()
end if
coord = e.location
endsub
'我想获得2和5
您在您的表格中添加一个颜色的颜色和一个新的按钮colourdialog和一个新的变量mycolor来存储颜色的颜色
Private myColor As Color = Color.Black
Private Sub colourdialog_Click(sender As Object, e As EventArgs) Handles colourdialog.Click
myColor = If(ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK, ColorDialog1.Color, myColor)
End Sub
den你可以在picturebox1_mousemove中定义
Dim newp As New Pen(myColoren)
并使用它代替笔或句子