STK X Tutorial - Visual Basic 6
16 pages
Slovak
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

STK X Tutorial - Visual Basic 6

-

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
16 pages
Slovak

Description

STK X Tutorial - Visual Basic 6
In this exercise you will gain hands-on experience using STK X to embed STK
functionality in a container application created with Visual Basic 6.0.
CONTENTS
CREATE THE PROJECT............................................................................................... 1
ADD THE STK X CONTROLS TO THE TOOLBOX.............................................................. 2
SEND COMMANDS TO STK X ...................................................................................... 5
ADD ZOOM IN/OUT TO THE MAP CONTROL .................................................................. 7
RESPOND TO EVENTS RAISED BY STK X...................................................................... 9
ADD MAP PICKING...................................................................................................11
SET STK X PROPERTIES ...........................................................................................13

Create the project
1) Start Microsoft Visual Basic 6.
2) A dialog box will open asking whether you want to create a new project. Select
Standard EXE.

3) If Form1 now appears in the designer, skip to the next section. Otherwise proceed
to the next step.
4) If a default form was not created automatically, click on the Add Form button in the
toolbar to create a new one.


STK X Tutorial – Visual Basic 6.0 1 5) In the dialog box that appears, select Form. The form will be opened in design mode.

Add the ...

Sujets

Informations

Publié par
Nombre de lectures 379
Langue Slovak

Exrait

STK X Tutorial - Visual Basic 6 In this exercise you will gain hands-on experience using STK X to embed STK functionality in a container applicat ion created with Visual Basic 6.0. C ONTENTS  CREATE THE PROJECT ............................................................................................... 1  ADD THE ST K X CONT ROLS TO THE TOOLBOX .............................................................. 2  SEND COMMANDS T O STK X ...................................................................................... 5  ADD ZOOM IN/OUT TO THE MAP CONTROL .................................................................. 7  RESPOND TO EVENTS RAI SED BY ST K X ...................................................................... 9  ADD MAP PI CKING ...................................................................................................11  SET ST K X P ROPERTIES ...........................................................................................13   
Create the project 1) Start Microsoft Visual Basic 6. 2) A dialog bxo will open asking whether you want to creaet a new project. Select Standard EXE .
 
 3) If  Form1  now appeasr in the designer, skipt o the next section. Otherwise proceed to the next step. 4) If a defalut form was notc reated automaticlaly, click on the A  dd Form button inthe toolbar to create a new one.
STK X Tutorial – Vi sual Basic 6.0
 
1  
5) In the dialog box that appears, s F e o l r e m ct.  The form will be oepned in design mode.
 
Add the STK X controls to the Toolbox 1) Onthe View menu, clic T k oolbox to bring up the toolbox.
 
 2) Right-click in the toolbox bagrcokund. In the context menu, c C li o ck m  ponents…  
STK X Tutorial – Vi sual Basic 6.0
2  
 
 3) In the Components  dialog, gothe Controls  tab. Check AGI STK X 8 to load the AGI Map and Globe controls.
STK X Tutorial – Vi sual Basic 6.0
3  
 
 4) Click OK to close th C e omponents dialog. 5) On the main menu, select Project->References. Scroll down and make sure AGI STK/Util 8 is selected.
6) The Map and Globe contro  lnsow appear in th T e o  olbox .
STK X Tutorial – Vi sual Basic 6.0
 
4  
 
Send commands to STK X 1) Reszie Form1  to a comfortable dimension. Click the Map Control  and Globe Control  in the Toolbox  and place them on the for . mResizeand move the controls to a visually pleasing orientation.
 
 2) Click on the C  ommandButton control in th T e oolbox to add a button to the form.
STK X Tutorial – Vi sual Basic 6.0
5  
 
 3) In the Properties  dialog for the new button, change the C  aption property to “ New Scenario ”.
 4) Double-click on the ne wbutton in the designer. The coed for Form1.vb  wi l  be displayed. Modify th C e o  mmand1_Click function as follows: _ Private Sub Command1 Click()  AgUiAx2DCntrl1.Application.ExecuteCommand("New / Scenario Test")
STK X Tutorial – Vi sual Basic 6.0
6  
End Sub 5) Run the application. Click t N h e e w Scenario button. This may take a few minutes.
6) With the mouse you ccaonn trol the Globe window. 
 
Add Zoom In/Out to the Map control 1) Add two more buttons tot he Form1  window sform. Chagne thec aptionf or the buttons to Z  oom In and Zoom Out .
 
STK X Tutorial – Vi sual Basic 6.0
7  
 
 2) Double-click on the Zoom In  button to switch to the codre  tfhoe Click  evetn handler. Modify the code like this: Private Sub Command2 Click() _  AgUiAx2DCntrl1.ZoomIn End Sub 3) Double-click on the Zoom Out  button to switch to the code for C t l h i e ck  event handler. Modify the code like this: _ Private Sub Command3 Click()  AgUiAx2DCntrl1.ZoomOut End Sub 4) Run the applicationC.l ick the New  Scenario bu t on. Click the Zoom  In button. Use themouse to definethe z o m areain the Map control. Youcan zoom outby clicking the Zoom  Out button.
STK X Tutorial – Vi sual Basic 6.0
8  
 
Respond to events raised by STK X 1) In the Visual Basic 6 IDE, switch teo  tchode view and enter the following function: _ Private Sub AgUiAx2DCntrl1 DblClick()  MsgBox ("2D Map double-clicked.") End Sub 2) Run the application. Dobule-click in the Map window. The message box will be displayed.
 
STK X Tutorial – Vi sual Basic 6.0
9  
 
 
 3) You can use the same approachho otok  up to the oGbl e control events. 4) You are now goingt o respond to STK X application events. Using the clas sand methodn ame selectors at the top of teh code window, select (General) as the cla s  and (  Declarations) for the method name.
STK X Tutorial – Vi sual Basic 6.0
10  
5) Add the line below to thfeo rm code. This adds t s h t e kxApp  member variable to your form. Through this variable cyaonu  access the STK X application object. Private WithEvents stkxApp As AgSTKXApplication 6) You will now subscribe for notificationon the STK X application boject. Asthis object is noat  control, the procedeu irs a little bit different. Use the class nad method name selectros to select the Form  class an tdhe Load  method. Add these lines to the form loader: Private Sub Form Load() _  Set stkxApp = AgUiAxVOCntrl1.Application End Sub  7) Now, add an event hadnler to litsen for new scenario evenst. At the end of the code, add the following ahndler: Private Sub stkxApp OnScenarioNew(ByVal path As String) _  MsgBox ("Scenario created: " & path) End Sub 8) Run the a p lication. lCick the New  Scenario  button. The me s age box will be displayed as a result of the event.
Add map picking 1) Go backt o the Design veiw in Visual Basic  6by selecting Form1 from te hProject panel. Add a label to the form.
 
 2) Under the Appearance subsection of teh Properties  pag,e clear th elabel caption so that it comes up blank.
STK X Tutorial – Vi sual Basic 6.0
11  
  • Accueil Accueil
  • Univers Univers
  • Livres Livres
  • Livres audio Livres audio
  • Presse Presse
  • BD BD
  • Documents Documents