【发布时间】:2020-05-18 07:08:02
【问题描述】:
我正在尝试制作两条参考线,以显示 Visual Basic.net 2019 中图片框的确切中心位置。你能帮忙吗?我正在附上示例图片它的样子。
保存图像时,这些行不应包含在最终图像中。
有可能吗?!如果是,请帮助我。提前致谢。
【问题讨论】:
标签: gridview picturebox vb.net-to-c#
我正在尝试制作两条参考线,以显示 Visual Basic.net 2019 中图片框的确切中心位置。你能帮忙吗?我正在附上示例图片它的样子。
保存图像时,这些行不应包含在最终图像中。
有可能吗?!如果是,请帮助我。提前致谢。
【问题讨论】:
标签: gridview picturebox vb.net-to-c#
Public Class Form1
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim g As Graphics = e.Graphics
Dim pn As New Pen(Color.Black) '~~~ color of the lines
Dim x As Integer
Dim y As Integer
Dim intSpacing1 As Integer = 320 '~~~ spacing between adjacent lines
Dim intSpacing2 As Integer = 240
'~~~ Draw the horizontal lines
x = PictureBox1.Width
For y = 0 To PictureBox1.Height Step intSpacing2
g.DrawLine(pn, New Point(0, y), New Point(x, y))
Next
'~~~ Draw the vertical lines
y = PictureBox1.Height
For x = 0 To PictureBox1.Height Step intSpacing1
g.DrawLine(pn, New Point(x, 0), New Point(x, y))
Next
End Sub
结束类
【讨论】: