Hi,
I am having a bit of confusion with the Select Points command. I want the user to select a point, then insert an object at that point. Additionally, if the user inserts an object and 2 points were selected, the objects is inserted at the first point and fit into the window created by the 2 selected points.
Also, if the user picks 2 points, how do I extract the coordinates of the two points selected. The docs spell it out ok, but I cannot seem to get working properly.
Here is the some code which selects the two points, but the image never is inserted. (I am using VB.Net which uses 0 for the first uitem in an array, not 1). Could you let me know what I am doing wrong.
Dim iProp As Avax.AvaxProp
Dim sMask As String
Dim sExpFile As String
Dim sExpExt As String
Dim aWidth As Single
Dim aHeight As Single
Dim PictureFiles() As String
Dim sSelectID As String
Dim lPointsToSelect As Long
Dim x() As Single
Dim y() As Single
Dim z() As Single
Dim Answer As Boolean
Dim fBoxOn As Boolean = True
Dim fNoSnapAndOrtho As Boolean = True
sMask = "MS Windows Bitmap (*.BMP)|*.BMP|"
sMask = sMask & "JPEG File Interchange (*.JPG)|*.JPG|"
sMask = sMask & "Graphics Interchnage Format (*.GIF)|*.GIF"
With DrawingForm.OpenFileDialog1
.FileName = ""
.RestoreDirectory = True
.Title = "Insert Raster Image..."
.CheckFileExists = True
.CheckPathExists = True
.Filter = sMask
.ShowDialog()
End With
If DrawingForm.OpenFileDialog1.FileName <> "" Then
sExpFile = DrawingForm.OpenFileDialog1.FileName
sExpExt = System.IO.Path.GetExtension(sExpFile)
ReDim PictureFiles(0)
PictureFiles(0) = sExpFile
DrawingForm.drawingscreen.Command = Avax.AvaxCommand.AutoLimits_c
sSelectID = "Select 2 points"
lPointsToSelect = 2
ReDim x(1)
ReDim y(1)
ReDim z(1)
Answer = DrawingForm.drawingscreen.SelectPoints(sSelectID, lPointsToSelect, x, y, z, fBoxOn, fNoSnapAndOrtho)
DrawingForm.drawingscreen.GetSelectedPoints(x, y, z)
DrawingForm.drawingscreen.GetPictureSize(sExpFile, aWidth, aHeight)
DrawingForm.drawingscreen.Add_Picture(PictureFiles, x(0), x(0), aWidth, aHeight, CLng(0))
DrawingForm.drawingscreen.CtlRefresh()
End If
Page 1 of 1
Select Points
#2 Guest_Terry_*
Posted 07 June 2005 - 08:27 PM
I have figured this one out. In VB.Net the SelectedPoints appears as:
Private Sub drawingscreen_SelectedPoints(ByVal sender As Object, ByVal e As AxAvax.__cAvax_SelectedPointsEvent) Handles drawingscreen.SelectedPoints
Select Case e.selectId
Case "2 points"
If e.lPointNumber = 2 Then
MsgBox(e.x1(1))
MsgBox(e.y1(1))
MsgBox(e.z1(1))
MsgBox(e.x1(2))
MsgBox(e.y1(2))
MsgBox(e.z1(2))
End If
Case "3 points"
If e.lPointNumber = 3 Then
MsgBox(e.x1(1))
MsgBox(e.y1(1))
MsgBox(e.z1(1))
MsgBox(e.x1(2))
MsgBox(e.y1(2))
MsgBox(e.z1(2))
MsgBox(e.x1(3))
MsgBox(e.y1(3))
MsgBox(e.z1(3))
End Select
End Sub
Private Sub drawingscreen_SelectedPoints(ByVal sender As Object, ByVal e As AxAvax.__cAvax_SelectedPointsEvent) Handles drawingscreen.SelectedPoints
Select Case e.selectId
Case "2 points"
If e.lPointNumber = 2 Then
MsgBox(e.x1(1))
MsgBox(e.y1(1))
MsgBox(e.z1(1))
MsgBox(e.x1(2))
MsgBox(e.y1(2))
MsgBox(e.z1(2))
End If
Case "3 points"
If e.lPointNumber = 3 Then
MsgBox(e.x1(1))
MsgBox(e.y1(1))
MsgBox(e.z1(1))
MsgBox(e.x1(2))
MsgBox(e.y1(2))
MsgBox(e.z1(2))
MsgBox(e.x1(3))
MsgBox(e.y1(3))
MsgBox(e.z1(3))
End Select
End Sub
Page 1 of 1
Sign In
Register
Help
Add Reply
MultiQuote
