具体代代码如下,请各位指导一下了.

Public Class Form1
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Integer) As Integer
Private Declare Function SelectObject Lib "gdi32" Alias "SelectObject" (ByVal hdc As Integer, ByVal hObject As Integer) As Integer
Private Declare Function CreateSolidBrush Lib "gdi32.dll" (ByVal crColor As Integer) As Integer
Private Declare Function CreatePen Lib "gdi32.dll" (ByVal nPenStyle As Integer, ByVal nWidth As Integer, ByVal crColor As Integer) As Integer
Private Const PS_SOLID = 0
Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Integer, ByVal lpPoint As Object, ByVal nCount As Integer) As Integer
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Integer, ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer) As Integer
Public Declare Function GetDC Lib "user32" (ByVal hWnd As Integer) As Integer
Public Mur As MapXLib.Layer
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
AxMap1.CurrentTool = MapXLib.ToolConstants.miPanTool
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
AxMap1.CurrentTool = MapXLib.ToolConstants.miZoomInTool
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AxMap1.CurrentTool = MapXLib.ToolConstants.miZoomOutTool
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AxMap1.Layers.LayersDlg()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Mur = AxMap1.Layers.AddUserDrawLayer("CELL", 1) '添加在最上层
End Sub
Private Sub AxMap1_DrawUserLayer(ByVal sender As Object, ByVal e As AxMapXLib.CMapXEvents_DrawUserLayerEvent) Handles AxMap1.DrawUserLayer
Dim Smp As Integer
Dim Smb As Integer
Dim Nmp As Integer
Dim Nmb As Integer
Dim Points(16) As PointAPI
Dim x0 As Double
Dim y0 As Double
Dim px As Single
Dim py As Single
Dim beam As Integer
Dim radiu As Integer
Dim Per_Azimuth As Integer
Dim Calc_azi As Double
x0 = 109.0
y0 = 30.0
AxMap1.ConvertCoord(px, py, x0, y0, MapXLib.ConversionConstants.miMapToScreen) '坐标转换
Points(1).x = px : Points(1).y = py
beam = 80
radiu = 80
Calc_azi = beam - beam / 2
Per_Azimuth = (beam + beam / 15) / 15
For Counter = 2 To 15
Points(Counter).x = Points(1).x + Math.Sin(Calc_azi * 3.141592654 / 180) * radiu
Points(Counter).y = Points(1).y - Math.Cos(Calc_azi * 3.141592654 / 180) * radiu
Calc_azi = (90 - beam / 2) + Per_Azimuth * (Counter - 1)
Next Counter
Points(16).x = px : Points(16).y = py
Smp = CreatePen(PS_SOLID, 3, RGB(255, 0, 0))
Smb = CreateSolidBrush(RGB(0, 255, 0))
Dim hwd As Integer
hwd = GetDC(AxMap1.Handle.ToInt32)
Nmp = SelectObject(e.hOutputDC, Smp)
Nmb = SelectObject(e.hOutputDC, Smb)
Polygon(e.hOutputDC, Points(1), 16) '这里出错,值不在预期范围内
Ellipse(e.hOutputDC, Points(1).x, Points(1).y, Points(5).x, Points(5).y)
End Sub
End Class
Public Structure PointAPI
Public x As Integer
Public y As Integer
End Structure
End Module