/// <summary> /// Gets or sets whether a given <see cref="PictureBoxStateProperties"/> is set in <see cref="AnimatedProperties"/>. /// </summary> public bool this[PictureBoxStateProperties property] { get { return(PictureBoxState.IsPropertySet(this.AnimatedProperties, property)); } set { if (value) { this.AnimatedProperties = this.AnimatedProperties | property; } else { this.AnimatedProperties = this.AnimatedProperties & ~property; } } }
/// <summary> /// Checks whether one <see cref="PictureBoxStateProperties"/> is part of /// another one. /// </summary> /// <param name="allProperties"></param> /// <param name="testProperty"></param> /// <returns></returns> public static bool IsPropertySet(PictureBoxStateProperties allProperties, PictureBoxStateProperties testProperty) { return((allProperties & testProperty) == testProperty); }
/// <summary> /// Applies the a defined set of properties from a given state to /// the current instance. /// </summary> /// <param name="state">State from which to transfer the properties.</param> /// <param name="properties">Definition of which properties to transfer.</param> public void Apply(PictureBoxState state, PictureBoxStateProperties properties) { if (IsPropertySet(properties, PictureBoxStateProperties.Alpha)) { _alpha = state._alpha; } if (IsPropertySet(properties, PictureBoxStateProperties.RotationAngle)) { _rotationAngle = state._rotationAngle; } if (IsPropertySet(properties, PictureBoxStateProperties.Zoom)) { _zoom = state._zoom; } if (IsPropertySet(properties, PictureBoxStateProperties.ExtraImageRotationAngle)) { _extraImageRotationAngle = state._extraImageRotationAngle; } if (IsPropertySet(properties, PictureBoxStateProperties.BackColorGradientRotationAngle)) { _backColorGradientRotationAngle = state._backColorGradientRotationAngle; } if (IsPropertySet(properties, PictureBoxStateProperties.BackColor)) { _backColor = state._backColor; } if (IsPropertySet(properties, PictureBoxStateProperties.BackColor2)) { _backColor2 = state._backColor2; } if (IsPropertySet(properties, PictureBoxStateProperties.ForeColor)) { _foreColor = state._foreColor; } if (IsPropertySet(properties, PictureBoxStateProperties.TextHaloColor)) { _textHaloColor = state._textHaloColor; } if (IsPropertySet(properties, PictureBoxStateProperties.TextHaloWidth)) { _textHaloWidth = state._textHaloWidth; } if (IsPropertySet(properties, PictureBoxStateProperties.TextRotationAngle)) { _textRotationAngle = state._textRotationAngle; } if (IsPropertySet(properties, PictureBoxStateProperties.TextZoom)) { _textZoom = state._textZoom; } if (IsPropertySet(properties, PictureBoxStateProperties.ShadowOffset)) { _shadowOffset = state._shadowOffset; } if (IsPropertySet(properties, PictureBoxStateProperties.ImageOffset)) { _imageOffset = state._imageOffset; } if (IsPropertySet(properties, PictureBoxStateProperties.TextOffset)) { _textOffset = state._textOffset; } }
/// <summary> /// Applies the a defined set of properties from a given state to the current instance. /// </summary> /// <param name="state">State from which to transfer the properties.</param> /// <param name="properties">Definition of which properties to transfer.</param> public void Apply(PictureBoxState state, PictureBoxStateProperties properties) { if (IsPropertySet(properties, PictureBoxStateProperties.Alpha)) _alpha = state._alpha; if (IsPropertySet(properties, PictureBoxStateProperties.RotationAngle)) _rotationAngle = state._rotationAngle; if (IsPropertySet(properties, PictureBoxStateProperties.Zoom)) _zoom = state._zoom; if (IsPropertySet(properties, PictureBoxStateProperties.ExtraImageRotationAngle)) _extraImageRotationAngle = state._extraImageRotationAngle; if (IsPropertySet(properties, PictureBoxStateProperties.BackColorGradientRotationAngle)) _backColorGradientRotationAngle = state._backColorGradientRotationAngle; if (IsPropertySet(properties, PictureBoxStateProperties.BackColor)) _backColor = state._backColor; if (IsPropertySet(properties, PictureBoxStateProperties.BackColor2)) _backColor2 = state._backColor2; if (IsPropertySet(properties, PictureBoxStateProperties.ForeColor)) _foreColor = state._foreColor; if (IsPropertySet(properties, PictureBoxStateProperties.TextHaloColor)) _textHaloColor = state._textHaloColor; if (IsPropertySet(properties, PictureBoxStateProperties.TextHaloWidth)) _textHaloWidth = state._textHaloWidth; if (IsPropertySet(properties, PictureBoxStateProperties.TextRotationAngle)) _textRotationAngle = state._textRotationAngle; if (IsPropertySet(properties, PictureBoxStateProperties.TextZoom)) _textZoom = state._textZoom; if (IsPropertySet(properties, PictureBoxStateProperties.ShadowOffset)) _shadowOffset = state._shadowOffset; if (IsPropertySet(properties, PictureBoxStateProperties.ImageOffset)) _imageOffset = state._imageOffset; if (IsPropertySet(properties, PictureBoxStateProperties.TextOffset)) _textOffset = state._textOffset; }
/// <summary> /// Checks whether one <see cref="PictureBoxStateProperties"/> is part of another one. /// </summary> /// <param name="allProperties"></param> /// <param name="testProperty"></param> /// <returns></returns> public static bool IsPropertySet(PictureBoxStateProperties allProperties, PictureBoxStateProperties testProperty) { return (allProperties & testProperty) == testProperty; }