内容摘要
当一个应用程序中调入*.ServerStyle文件后,再用IStyleGalleryStorage的AddFile和RemoveFile方法出错。
过程描述

'如果*.ServerStyle文件调入后又没有用TargetFile方法设置成其他,则再试使用时出错,哪AddFile方法、RemoveFile方法,将出错,测试环境VB6.0+ArcEngine DEV 9.1

Private Sub Command1_Click()
   Dim aaa As IStyleGallery
    Set aaa = New ServerStyleGallery
    Dim bbb As IStyleGalleryStorage
    Set bbb = aaa
    bbb.AddFile App.Path & "Transportation.ServerStyle"      
    bbb.RemoveFile App.Path & "Transportation.ServerStyle"
    aaa.Clear
    Set aaa = Nothing
End Sub

Private Sub Form_Load()
    Dim a As IStyleGallery
    Set a = New ServerStyleGallery
    Dim b As IStyleGalleryStorage
    Set b = a
    b.TargetFile = App.Path & "Transportation.ServerStyle"
    MsgBox b.CanUpdate(App.Path & "Transportation.ServerStyle")

    Dim symbol As IMarkerSymbol
    Set symbol = New SimpleMarkerSymbol   

    Dim item As IStyleGalleryItem
    Set item = New ServerStyleGalleryItem
    item.item = symbol
    item.Category = "Guide Sign"
    item.Name = "Test"
    a.AddItem item
    b.RemoveFile App.Path & "Transportation.ServerStyle"
   '如果不设置下面这句,将出错

   b.TargetFile = "d:/df.serversytle"
    a.Clear
    Set a = Nothing
    Set b = Nothing
    'b.TargetFile = "" 不能设为空
End Sub