///<summary> ///Creates a new object that is a copy of the current instance. ///</summary> /// ///<returns> ///A new object that is a copy of this instance. ///</returns> ///<filterpriority>2</filterpriority> public object Clone() { ColorPair pair = new ColorPair(); pair.backColor1 = this.backColor1; pair.backColor2 = this.backColor2; pair.gradient = this.gradient; return(pair); }
///<summary> ///Determines whether the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>. ///</summary> /// ///<returns> ///true if the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>; otherwise, false. ///</returns> /// ///<param name="obj">The <see cref="T:System.Object"></see> to compare with the current <see cref="T:System.Object"></see>. </param><filterpriority>2</filterpriority> public override bool Equals(object obj) { ColorPair pair = obj as ColorPair; if (pair != null) { return(pair.BackColor1.Equals(this.backColor1) && pair.BackColor2.Equals(this.backColor2) && pair.Gradient.Equals(this.gradient)); } return(false); }
///<summary> ///Paints a representation of the value of an object using the specified <see cref="T:System.Drawing.Design.PaintValueEventArgs"></see>. ///</summary> /// ///<param name="e">A <see cref="T:System.Drawing.Design.PaintValueEventArgs"></see> that indicates what to paint and where to paint it. </param> public override void PaintValue(PaintValueEventArgs e) { base.PaintValue(e); ColorPair pair = e.Value as ColorPair; if (pair != null) { LinearGradientBrush br = new LinearGradientBrush(e.Bounds, pair.BackColor1, pair.BackColor2, pair.Gradient); e.Graphics.FillRectangle(br, e.Bounds); } }
public void Start(IWindowsFormsEditorService service, object val) { this.edSvc = service; this.value = val as ColorPair; if (val != null) { this.pnlOldBack1.BackColor = this.value.BackColor1; this.pnlOldBack2.BackColor = this.value.BackColor2; this.pnlNewBack1.BackColor = this.value.BackColor1; this.pnlNewBack2.BackColor = this.value.BackColor2; this.lblOldGrad.Text = this.value.Gradient.ToString(); this.gradUI.Value = this.value.Gradient; this.pnlPreview.Refresh(); } }
public void End() { this.edSvc = null; this.value = null; }
///<summary> ///Creates a new object that is a copy of the current instance. ///</summary> /// ///<returns> ///A new object that is a copy of this instance. ///</returns> ///<filterpriority>2</filterpriority> public object Clone() { ColorPair pair = new ColorPair(); pair.backColor1 = this.backColor1; pair.backColor2 = this.backColor2; pair.gradient = this.gradient; return pair; }