dongshan
路人甲
路人甲
  • 注册日期2005-06-25
  • 发帖数26
  • QQ155351222
  • 铜币257枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1955回复:3

[求助]这是在VBA中的一段鹰眼图代码,请问在VB中应将Application怎么处理才行?

楼主#
更多 发布于:2006-04-21 11:39
<P>这是在VBA中的一段鹰眼图代码,请问在VB中应将VBA代码中的Application怎么处理才行?</P>
<P>谢谢各位!</P>
喜欢0 评分0
dongshan
路人甲
路人甲
  • 注册日期2005-06-25
  • 发帖数26
  • QQ155351222
  • 铜币257枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2006-04-21 11:45
Public Sub CreateOverviewWindow()<BR>  Dim pOverview As IOverview<BR>  Dim pOverviewWindow As IOverviewWindow<BR>  Dim pDataWindowFactory As IDataWindowFactory<BR>  Dim pFillSymbol As ISimpleFillSymbol<BR>  Dim pLineSymbol As ISimpleLineSymbol<BR>  Dim pRgbColor As IRgbColor<BR>  <BR>  Set pDataWindowFactory = New OverviewWindowFactory<BR>  If Not pDataWindowFactory.CanCreate(Application) Then Exit Sub<BR>  'Create a new overview window<BR>  Set pOverviewWindow = pDataWindowFactory.Create(Application)<BR>  'Change the area of interterest fill symbol<BR>  'to a hollow fill with a blue border<BR>  Set pOverview = pOverviewWindow.Overview<BR>  Set pFillSymbol = New SimpleFillSymbol<BR>  Set pLineSymbol = New SimpleLineSymbol<BR>  Set pRgbColor = New RgbColor<BR>  pRgbColor.Blue = 255<BR>  pLineSymbol.Color = pRgbColor<BR>  pFillSymbol.Style = esriSFSNull<BR>  pFillSymbol.Outline = pLineSymbol<BR>  pOverview.AoiFillSymbol = pFillSymbol<BR>End Sub
举报 回复(0) 喜欢(0)     评分
bbexx
路人甲
路人甲
  • 注册日期2005-02-23
  • 发帖数5
  • QQ
  • 铜币114枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2006-04-26 11:42
<P>' Implement the ICommand interface<BR>Implements ICommand</P><PRE><P>Dim m_pApp As IApplication      'ArcMap application</P>
<P>Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE<BR>  ' The VB project contains a form called Form1.<BR>  ' Picture1 is the name of a PictureBox control on the form.<BR>  ' The Picture property of PictureBox1 is set to some bitmap on<BR>  ' your system.<BR>  ICommand_Bitmap = Form1.Picture1.Picture.Handle<BR>End Property</P>
<P>Private Property Get ICommand_Caption() As String<BR>  ' Set the string that appears when the command is used as a<BR>  ' menu item.<BR>  ICommand_Caption = "MyCommand"<BR>End Property</P>
<P>Private Property Get ICommand_Category() As String<BR>  ' Set the category of this command. This determines where the<BR>  ' command appears in the Commands panel of the Customize dialog.<BR>  ICommand_Category = "MyCustomTools"<BR>End Property</P>
<P>Private Property Get ICommand_Checked() As Boolean</P>
<P>End Property</P>
<P>Private Property Get ICommand_Enabled() As Boolean<BR>  ' Add some logic here to specify in what state the application<BR>  ' should be in for the command to be enabled. In this example,<BR>  ' the command is enabled only when there is at least one data<BR>  ' layer loaded in ArcMap.<BR>  Dim pMxDoc As IMxDocument<BR>  Dim pLayerCount As Integer<BR>  'm_pApp is set in OnCreate<BR>  Set pMxDoc =  m_pApp.Document<BR>  pLayerCount =  pMxDoc.FocusMap.LayerCount <BR>  If pLayerCount > 0 Then<BR>    ICommand_Enabled =  True<BR>  Else<BR>    ICommand_Enabled =  False<BR>  End  If<BR>End Property </P>
<P>Private Property Get ICommand_HelpContextID() As Long<BR>  ICommand_HelpContextID =  1234 <BR>End Property</P>
<P>Private Property Get ICommand_HelpFile() As String <BR>  ' If the help file is not registered you may need<BR>  ' to  supply the  full path to the file<BR>  ICommand_HelpFile = "MyHelp.hlp"<BR>End Property</P>
<P>Private Property Get ICommand_Message() As String<BR>  'Set the message string that appears in the statusbar of the<BR>  'application when the mouse passes over the command.<BR>  ICommand_Message = "This is my custom command"<BR>End Property</P>
<P>Private Property Get ICommand_Name() As String<BR>  ' Set the internal name of this command. By convention, this<BR>  ' name string contains the category and caption of the command.<BR>  ICommand_Name = "MyCustomTool_MyCommand"<BR>End Property</P>
<P>Private Sub ICommand_OnClick()<BR>  ' Add some code to do some action when the command is clicked. In this<BR>  ' example, a message box is displayed.<BR>  MsgBox "Clicked on my command"<BR>End Sub</P>
<P>Private Sub ICommand_OnCreate(ByVal hook As Object)<BR>  ' The hook argument is a pointer to Application object.<BR>  ' Establish a hook to the application<BR>  Set m_pApp = hook<BR>End Sub</P>
<P>Private Property Get ICommand_Tooltip() As String<BR>  'Set the string that appears in the screen tip.<BR>  ICommand_Tooltip = "MyCommand"<BR>End Property</P><P>m_pApp这个变量里存的就是application</P></PRE>
举报 回复(0) 喜欢(0)     评分
dongshan
路人甲
路人甲
  • 注册日期2005-06-25
  • 发帖数26
  • QQ155351222
  • 铜币257枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2006-04-28 10:43
谢谢!
举报 回复(0) 喜欢(0)     评分
游客

返回顶部