/// <summary> /// Called if the background style changed. /// </summary> /// <param name="newValue">The new index of the style.</param> public void EhView_BackgroundStyleChanged(int newValue) { BrushX backgroundColor = new BrushX(Color.Transparent); if (newValue != 0) { _tempDoc = (IBackgroundStyle)Activator.CreateInstance(this._backgroundStyles[newValue - 1]); backgroundColor = _tempDoc.Brush; } else // is null { _tempDoc = null; } if (_tempDoc != null && _tempDoc.SupportsBrush) { _view.BackgroundBrush_Initialize(backgroundColor); _view.BackgroundBrushEnable_Initialize(true); } else { _view.BackgroundBrushEnable_Initialize(false); } OnTemporaryModelObjectChanged(); }
} // not used here void Initialize(bool bInit) { if (bInit) { _fontFamily = _doc.Font; _color = _doc.Color; _fontSize = _doc.FontSize; _horizontalAlignment = _doc.HorizontalAlignment; _verticalAlignment = _doc.VerticalAlignment; _automaticAlignment = _doc.AutomaticAlignment; _xOffset = _doc.XOffset; _yOffset = _doc.YOffset; _currentLabelStyleInstance = _doc.LabelFormat; _backgroundStyle = _doc.BackgroundStyle; } if (null != View) { View.Font_Initialize(_fontFamily); View.Color_Initialize(_color); View.FontSize_Initialize(_fontSize); View.HorizontalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)), System.Enum.GetName(typeof(System.Drawing.StringAlignment), _horizontalAlignment)); View.VerticalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)), System.Enum.GetName(typeof(System.Drawing.StringAlignment), _verticalAlignment)); View.AutomaticAlignment_Initialize(this._automaticAlignment); View.Rotation = (float)_doc.Rotation; View.XOffset_Initialize(Serialization.NumberConversion.ToString(_xOffset * 100)); View.YOffset_Initialize(Serialization.NumberConversion.ToString(_yOffset * 100)); View.Background = _backgroundStyle; InitializeLabelStyle(); } }
public override bool CopyFrom(object obj) { var isCopied = base.CopyFrom(obj); if (isCopied && !object.ReferenceEquals(this, obj)) { var from = obj as TextGraphic; if (from != null) { _text = from._text; _font = from._font; _textBrush = from._textBrush; _background = from._background == null ? null : (IBackgroundStyle)from._background.Clone(); if (null != _background) { _background.ParentObject = this; } _lineSpacingFactor = from._lineSpacingFactor; // don't clone the cached items _isStructureInSync = false; _isMeasureInSync = false; } } return(isCopied); }
} // not used here void Initialize(bool bInit) { if (bInit) { _font = _doc.Font; _independentColor = _doc.IndependentColor; _color = _doc.Color; _horizontalAlignment = _doc.HorizontalAlignment; _verticalAlignment = _doc.VerticalAlignment; _attachToEdge = _doc.AttachedAxis != null; _attachedEdge = _doc.AttachedAxis; _xOffset = _doc.XOffset; _yOffset = _doc.YOffset; _labelColumn = _doc.LabelColumn; _backgroundStyle = _doc.BackgroundStyle; } if (null != View) { View.Font_Initialize(_font); View.IndependentColor_Initialize(_independentColor); View.Color_Initialize(_color); View.HorizontalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)), System.Enum.GetName(typeof(System.Drawing.StringAlignment), _horizontalAlignment)); View.VerticalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)), System.Enum.GetName(typeof(System.Drawing.StringAlignment), _verticalAlignment)); View.AttachToAxis_Initialize(_attachToEdge); SetAttachmentDirection(); View.Rotation = (float)_doc.Rotation; View.XOffset_Initialize(Serialization.NumberConversion.ToString(_xOffset * 100)); View.YOffset_Initialize(Serialization.NumberConversion.ToString(_yOffset * 100)); View.Background = _backgroundStyle; InitializeLabelColumnText(); } }
void CopyFrom(LayerBackground from) { this._background = null == from._background ? null : (IBackgroundStyle)from._background.Clone(); this._leftPadding = from._leftPadding; this._rightPadding = from._rightPadding; this._topPadding = from._topPadding; this._bottomPadding = from._bottomPadding; }
public MSVS2012DarkItemBackgroundStyles() { _focused = new BackgroundWithBorder(MSVS2012DarkColors.WINDOW, MSVS2012DarkColors.HIGHLIGHT); _selectedFocused = new SolidBackground(MSVS2012DarkColors.HIGHLIGHT); _selected = _selectedFocused; _selectedNoFocus = new SolidBackground(MSVS2012DarkColors.HIDDEN_HIGHLIGHT); _hovered = new SolidBackground(MSVS2012DarkColors.HOT_TRACK); _hoveredFocused = new BackgroundWithBorder(MSVS2012DarkColors.HOT_TRACK, MSVS2012DarkColors.HIGHLIGHT); }
private void CopyFrom(LayerBackground from) { if (object.ReferenceEquals(this, from)) return; this._background = null == from._background ? null : (IBackgroundStyle)from._background.Clone(); this._background.ParentObject = this; this._leftPadding = from._leftPadding; this._rightPadding = from._rightPadding; this._topPadding = from._topPadding; this._bottomPadding = from._bottomPadding; }
void EhStyle_SelectionChangeCommitted(object sender, EventArgs e) { if (_cbStyle.SelectedIndex > 0) { _doc = (IBackgroundStyle)Activator.CreateInstance(this._backgroundStyles[_cbStyle.SelectedIndex - 1]); } else { _doc = null; } OnBackgroundStyleChanged(); UpdateBrushState(); }
private void CopyFrom(LayerBackground from) { if (object.ReferenceEquals(this, from)) { return; } _background = null == from._background ? null : (IBackgroundStyle)from._background.Clone(); _background.ParentObject = this; _leftPadding = from._leftPadding; _rightPadding = from._rightPadding; _topPadding = from._topPadding; _bottomPadding = from._bottomPadding; }
private void EhStyle_SelectionChangeCommitted(object sender, EventArgs e) { if (_cbStyle.SelectedIndex > 0) { _doc = (IBackgroundStyle)Activator.CreateInstance(_backgroundStyles[_cbStyle.SelectedIndex - 1]); } else { _doc = null; } // Apply the currently selected brush to the newly created instance if (_doc != null && _cbBrush != null) { _doc.Material = _cbBrush.SelectedMaterial; } OnBackgroundStyleChanged(); UpdateBrushState(); }
void EhStyle_SelectionChangeCommitted(object sender, EventArgs e) { if (_cbStyle.SelectedIndex>0) _doc = (IBackgroundStyle)Activator.CreateInstance(this._backgroundStyles[_cbStyle.SelectedIndex - 1]); else _doc = null; OnBackgroundStyleChanged(); UpdateBrushState(); }
public UseDocument UseDocumentCopy { set { _useDocumentCopy = value; } } // not used here void Initialize(bool bInit) { if(bInit) { _font = _doc.Font; _independentColor = _doc.IndependentColor; _color = _doc.Color; _horizontalAlignment = _doc.HorizontalAlignment; _verticalAlignment = _doc.VerticalAlignment; _attachToEdge = _doc.AttachedAxis!=null; _attachedEdge = _doc.AttachedAxis; _xOffset = _doc.XOffset; _yOffset = _doc.YOffset; _labelColumn = _doc.LabelColumn; _backgroundStyle = _doc.BackgroundStyle; } if(null!=View) { View.Font_Initialize(_font); View.IndependentColor_Initialize(_independentColor); View.Color_Initialize(_color); View.HorizontalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)),System.Enum.GetName(typeof(System.Drawing.StringAlignment),_horizontalAlignment)); View.VerticalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)),System.Enum.GetName(typeof(System.Drawing.StringAlignment),_verticalAlignment)); View.AttachToAxis_Initialize(_attachToEdge); SetAttachmentDirection(); View.Rotation = (float)_doc.Rotation; View.XOffset_Initialize(Serialization.NumberConversion.ToString(_xOffset*100)); View.YOffset_Initialize(Serialization.NumberConversion.ToString(_yOffset*100)); View.Background = _backgroundStyle; InitializeLabelColumnText(); } }
public LayerBackground(IBackgroundStyle style) { _background = style; }
public MSVS2012LightItemBackgroundStyles() { _focused = new BackgroundWithBorder(MSVS2012LightColors.WINDOW, MSVS2012LightColors.HIGHLIGHT); _selectedFocused = new SolidBackground(MSVS2012LightColors.HIGHLIGHT); _selected = _selectedFocused; _selectedNoFocus = new SolidBackground(MSVS2012LightColors.HIDDEN_HIGHLIGHT); _hovered = new SolidBackground(MSVS2012LightColors.HOT_TRACK); _hoveredFocused = new BackgroundWithBorder(MSVS2012LightColors.HOT_TRACK, MSVS2012LightColors.HIGHLIGHT); }
public override object SetObjectData(object obj,System.Runtime.Serialization.SerializationInfo info,System.Runtime.Serialization.StreamingContext context,System.Runtime.Serialization.ISurrogateSelector selector) { base.SetObjectData(obj, info, context, selector); _text = info.GetString("Text"); _font = (Font)info.GetValue("Font", typeof(Font)); _textBrush = (BrushX)info.GetValue("Brush", typeof(BrushX)); _background = (IBackgroundStyle)info.GetValue("BackgroundStyle", typeof(IBackgroundStyle)); _lineSpacingFactor = info.GetSingle("LineSpacing"); _xAnchorType = (XAnchorPositionType)info.GetValue("XAnchor", typeof(XAnchorPositionType)); _yAnchorType = (YAnchorPositionType)info.GetValue("YAnchor", typeof(YAnchorPositionType)); return this; }
public UseDocument UseDocumentCopy { set { } } // not used here void Initialize(bool bInit) { if(bInit) { _fontFamily = _doc.Font; _color = _doc.Color; _fontSize = _doc.FontSize; _horizontalAlignment = _doc.HorizontalAlignment; _verticalAlignment = _doc.VerticalAlignment; _automaticAlignment = _doc.AutomaticAlignment; _xOffset = _doc.XOffset; _yOffset = _doc.YOffset; _currentLabelStyleInstance = _doc.LabelFormat; _backgroundStyle = _doc.BackgroundStyle; } if(null!=View) { View.Font_Initialize(_fontFamily); View.Color_Initialize(_color); View.FontSize_Initialize(_fontSize); View.HorizontalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)),System.Enum.GetName(typeof(System.Drawing.StringAlignment),_horizontalAlignment)); View.VerticalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)),System.Enum.GetName(typeof(System.Drawing.StringAlignment),_verticalAlignment)); View.AutomaticAlignment_Initialize(this._automaticAlignment); View.Rotation = (float)_doc.Rotation; View.XOffset_Initialize(Serialization.NumberConversion.ToString(_xOffset*100)); View.YOffset_Initialize(Serialization.NumberConversion.ToString(_yOffset*100)); View.Background = _backgroundStyle; InitializeLabelStyle(); } }
protected override void CopyFrom(GraphicBase bfrom) { TextGraphic from = bfrom as TextGraphic; if (from != null) { this._text = from._text; this._font = from._font == null ? null : (Font)from._font.Clone(); this._textBrush = from._textBrush == null ? null : (BrushX)from._textBrush.Clone(); this._background = from._background == null ? null : (IBackgroundStyle)from._background.Clone(); this._lineSpacingFactor = from._lineSpacingFactor; _xAnchorType = from._xAnchorType; _yAnchorType = from._yAnchorType; // don't clone the cached items this._cachedTextLines = null; this._isStructureInSync = false; this._isMeasureInSync = false; } base.CopyFrom(bfrom); }
public bool Apply() { _doc = _tempDoc; return(true); }
public BackgroundStyleController(IBackgroundStyle doc) { _doc = doc; _tempDoc = _doc == null ? null : (IBackgroundStyle)doc.Clone(); Initialize(true); }
public override bool CopyFrom(object obj) { var isCopied = base.CopyFrom(obj); if (isCopied && !object.ReferenceEquals(this, obj)) { var from = obj as TextGraphic; if (from != null) { this._text = from._text; this._font = from._font; this._textBrush = from._textBrush == null ? null : (BrushX)from._textBrush.Clone(); if (null != _textBrush) _textBrush.ParentObject = this; this._background = from._background == null ? null : (IBackgroundStyle)from._background.Clone(); if (null != _background) _background.ParentObject = this; this._lineSpacingFactor = from._lineSpacingFactor; // don't clone the cached items this._isStructureInSync = false; this._isMeasureInSync = false; } } return isCopied; }
public override void OnPaintItemBackground(CustomListBoxItem item, ItemPaintEventArgs paintEventArgs) { var state = paintEventArgs.State; if (state == ItemState.None) { return; } bool hovered = (state & ItemState.Hovered) == ItemState.Hovered; bool selected = (state & ItemState.Selected) == ItemState.Selected; bool focused = (state & ItemState.Focused) == ItemState.Focused; IBackgroundStyle background = null; if (selected) { if (paintEventArgs.IsHostControlFocused) { if (hovered) { background = BackgroundStyle.SelectedFocused; } else if (focused) { background = BackgroundStyle.SelectedFocused; } else { background = BackgroundStyle.Selected; } } else { if (hovered) { background = BackgroundStyle.SelectedFocused; } else { background = BackgroundStyle.SelectedNoFocus; } } } else { if (hovered) { if (focused && paintEventArgs.IsHostControlFocused) { background = BackgroundStyle.HoveredFocused; } else { background = BackgroundStyle.Hovered; } } else if (focused) { if (paintEventArgs.IsHostControlFocused) { background = BackgroundStyle.Focused; } } } if (background != null) { background.Draw(paintEventArgs.Graphics, paintEventArgs.Bounds); } }
private void EhStyle_SelectionChangeCommitted(object sender, EventArgs e) { if (_cbStyle.SelectedIndex > 0) _doc = (IBackgroundStyle)Activator.CreateInstance(this._backgroundStyles[_cbStyle.SelectedIndex - 1]); else _doc = null; // Apply the currently selected brush to the newly created instance if (_doc != null && _cbBrush != null) _doc.Material = _cbBrush.SelectedMaterial; OnBackgroundStyleChanged(); UpdateBrushState(); }