コード例 #1
0
ファイル: XPPanel.cs プロジェクト: svn2github/fiddler-plus
 /// <summary>
 /// Create a new <c>XPPanelPropertyChangeArgs</c> with the specified
 /// property enumeration value
 /// </summary>
 /// <param name="property"></param>
 public XPPanelPropertyChangeEventArgs(XPPanelProperties property)
 {
     this.xpPanelProperty = property ;
 }
コード例 #2
0
ファイル: XPPanel.cs プロジェクト: svn2github/fiddler-plus
        /// <summary>
        /// Preprocessor for <see cref="PropertyChange"/> events
        /// </summary>
        /// <param name="xpPanelProperty">The property that changed</param>
        /// <remarks>
        /// Look at each property change and invalidate cached GDI+ objects 
        /// as necessary.
        /// </remarks>
        protected virtual void OnPropertyChange(XPPanelProperties xpPanelProperty)
        {
            switch(xpPanelProperty) {
                case XPPanelProperties.HorzAlignmentProperty:
                case XPPanelProperties.VertAlignmentProperty:
                    MeasureTextFormat = null ;
                    DrawTextFormat = null ;
                    break ;

                case XPPanelProperties.TextColorsProperty:
                    FontBrush = null ;
                    break ;

                case XPPanelProperties.TextHighlightColorsProperty:
                    FontHighlightBrush = null ;
                    break ;

                case XPPanelProperties.CaptionGradientProperty:
                case XPPanelProperties.CaptionGradientModeProperty:
                case XPPanelProperties.GradientOffsetProperty:
                case XPPanelProperties.CaptionCornerTypeProperty:
                    CaptionBrush = null ;
                    break ;

                case XPPanelProperties.FontProperty:
                    DisabledFont = null ;
                    isLayoutDirty = true ;
                    break ;

                case XPPanelProperties.CaptionProperty:
                case XPPanelProperties.SpacingProperty:
                case XPPanelProperties.CurveRadiusProperty:
                case XPPanelProperties.FitToImageProperty:
                case XPPanelProperties.XPPanelStyleProperty:
                case XPPanelProperties.PanelHeightProperty:
                    isLayoutDirty = true ;
                    break ;

                case XPPanelProperties.CaptionUnderlineProperty:
                    CaptionUnderlinePen = null ;
                    // this may not be necessary, but its hard to tell without more logic
                    isLayoutDirty = true ;
                    break ;

                case XPPanelProperties.PanelGradientProperty:
                case XPPanelProperties.PanelGradientModeProperty:
                    PanelBrush = null ;
                    break ;

                case XPPanelProperties.IsFixedHeightProperty:
                    if (IsFixedHeight) {
                        PanelState = XPPanelState.Expanded ;
                    }
                    break ;

                case XPPanelProperties.PanelStateProperty:
                case XPPanelProperties.ExpandedGlyphsProperty:
                case XPPanelProperties.CollapsedGlyphsProperty:
                    break ;

                case XPPanelProperties.EnabledProperty:
                    CaptionBrush = null ;
                    PanelBrush = null ;
                    CaptionUnderlinePen = null ;
                    break ;

                case XPPanelProperties.DisabledOpacityProperty:
                    if (!Enabled) {
                        Invalidate() ;
                    }
                    break ;
            }

            // forward the event to listeners
            if (propertyChangeListeners != null) {
                propertyChangeListeners(this,new XPPanelPropertyChangeEventArgs(xpPanelProperty)) ;
            }

            // invalidate the control
            Invalidate() ;
        }