Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: Change Color Independent of Fill Color

$
0
0

Here is a snippet of the code I used set the value of the Template property:

Private Sub cmdUpdateTags_Click()
    If Not (oElement.HasAnyTags) Then
        
    Else
        Dim oTags() As TagElement
        Dim oPropertyHandler As PropertyHandler
        Dim i As Integer
        oTags = oElement.GetTags()
        Set oPropertyHandler = CreatePropertyHandler(oElement)
        For i = LBound(oTags) To UBound(oTags)
            Select Case oTags(i).TagSetName
                Case "PCS_Space"
                    Select Case oTags(i).TagDefinitionName
                        Case "Type"
                            oTags(i).Value = Me.cmbType.Text
                        Case "Category"
                            oTags(i).Value = Me.cmbCategory.Text
                            oPropertyHandler.SelectByAccessString "Template"
                            oPropertyHandler.SetValue getTemplateNameFromDialogValues
                        Case "Capacity_Prime"
                            oTags(i).Value = Me.txtPrimaryCap.Value
                        Case "Capacity_Second"
                            oTags(i).Value = Me.txtSecondaryCap.Value
                        Case "Label"
                            oTags(i).Value = Me.txtLabel.Text
                    End Select
                    oTags(i).Redraw msdDrawingModeNormal
                    oTags(i).Rewrite
                Case Else
                
            End Select
        Next i
    End If
End Sub

This script is attached to a command button on a modeless user form. oElement was passed back to the form from a class implementing ILocateCommandEvents.
getTemplateNameFromDialogValues is a function that returns the element template name based on the value in the tag named "Category".
Each of the element templates has basic properties set such as color, fill color, fill type, transparency. Note: all elements being processed are assumed to be closed shapes.

I am finding that if I reuse the property handler by calling the SelectByAccessString method to get the Color property, when I set the value, it also sets the fill color to the same value.
Do I need to store the fill color value before I set the color, then set the element color, then set the fill color back to the stored value?


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>