Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 519

Change Icon of ClientFeature Node in built-in Browser Pane

$
0
0

By Xiaodong Liang

We have a blog on how to change icon of ClientFeature node in custom browser pane.

http://adndevblog.typepad.com/manufacturing/2012/08/change-the-browser-node-icon.html

The workflow is similar if you want to change icon ClientFeature node in built-in browser pane. The following is a demo. It assumes a part document (with two part features) is opened.

Sub CGInClientFeatureTest()


Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
 
Dim oDef As PartComponentDefinition
Set oDef = oDoc.ComponentDefinition
 

‘get first and second features
Dim oPartFea1 As PartFeature
Set oPartFea1 = oDef.Features(1)
 
  Dim oPartFea2 As PartFeature
Set oPartFea2 = oDef.Features(2)   
 
'create client feature definition
Dim oClientFeatureDef As ClientFeatureDefinition
Set oClientFeatureDef = oDef.Features.ClientFeatures.CreateDefinition("ClientFeatureTest")
 
  ‘add the part features to client feature
oClientFeatureDef.ClientFeatureElements.Add oPartFea1
oClientFeatureDef.ClientFeatureElements.Add oPartFea2
 
'create client feature
Dim oClientFeature As ClientFeature
Set oClientFeature = oDef.Features.ClientFeatures.Add(oClientFeatureDef, "ClientIDString")

 

‘get the browser node of the client feature
     Dim oNode As BrowserNode
        Set oNode = oDoc.BrowserPanes(1).GetBrowserNodeFromObject(oClientFeature)
       

  ‘create the resource of icon. assume a bitmap 1.bmp exists  ‘ in c:\temp
        Dim oCnr As ClientNodeResource
       
        Dim oIcon As IPictureDisp
        Set oIcon = stdole.LoadPicture("C:\temp\1.bmp")
       
        ' Create a client node resource.
        Set oCnr = oDoc.BrowserPanes.ClientNodeResources.Add("SamplePocketFeature", -1, oIcon)

        ' Override the icon for the client feature.
        oNode.BrowserNodeDefinition.OverrideIcon = oCnr

 
      ThisApplication.ActiveView.Update
End Sub

2015-01-15_1412


Viewing all articles
Browse latest Browse all 519

Trending Articles