销售热线:0755-28441200
销售热线:0755-89368951
传真:0755-28441200
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AxMDisplay1.ClearOverlay()
DrawDotLine(30, 10, 400, 100)‘开始XY,结束XY坐标 改变此值即可画出用户所需的位置
End Sub
Private Sub DrawDotLine(Startx As Integer ,Starty As Integer ,Endx As Integer ,Endy As Integer )
Dim I As Integer
For I = Startx To Endx Step 5 '顶横
AxMGraphicContext1.DrawingRegion.StartX = I
AxMGraphicContext1.DrawingRegion.StartY = Starty
AxMGraphicContext1.DrawingRegion.EndX = IIf((I + 2) > Endx, I, I + 2)
AxMGraphicContext1.DrawingRegion.EndY = Starty
AxMGraphicContext1.LineSegment()
Next
For I = Starty To Endy Step 5 '左竖
AxMGraphicContext1.DrawingRegion.StartX = Startx
AxMGraphicContext1.DrawingRegion.StartY = I
AxMGraphicContext1.DrawingRegion.EndX = Startx
AxMGraphicContext1.DrawingRegion.EndY = IIf((I + 2) > Endy, Endy, I + 2)
AxMGraphicContext1.LineSegment()
Next
'MsgBox(Startx & " " & Endy)
For I = Startx To Endx Step 5 '底横
AxMGraphicContext1.DrawingRegion.StartX = I '+ Startx
AxMGraphicContext1.DrawingRegion.StartY = Endy
AxMGraphicContext1.DrawingRegion.EndX = IIf((I + 2) > Endx, Endx, I + 2)
AxMGraphicContext1.DrawingRegion.EndY = Endy
AxMGraphicContext1.LineSegment()
Next
For I = Starty To Endy Step 5 '右竖
AxMGraphicContext1.DrawingRegion.StartX = Endx
AxMGraphicContext1.DrawingRegion.StartY = I
AxMGraphicContext1.DrawingRegion.EndX = Endx
AxMGraphicContext1.DrawingRegion.EndY = IIf((I + 2) > Endy, Endy, I + 2)
AxMGraphicContext1.LineSegment()
Next
End Sub