public void apply(GradientLabel label) { label.topColor = tools.RGB2Color(TopColor); label.bottomColor = tools.RGB2Color(BottomColor); label.ForeColor = tools.RGB2Color(TextColor); label.borderColor = tools.RGB2Color(BorderColor); }
void init(bool state = false) { h = Height; w = Width / 2; p1 = new Point(-w, 0); p2 = new Point(0, 0); p3 = new Point(w - 1, 0); p4 = new Point(w * 2, 0); //p1 = new Float2D(-w, 0); //p2 = new Float2D(0, 0); //p3 = new Float2D(w-1, 0); //p4 = new Float2D(w * 2, 0); Margin = new Padding(3); labelOn = new cbsLabel( color(onTopColor), color(onBottomColor), color(onTextColor), color(onBorderColor), h, w, onText ); labelMiddle = new cbsLabel( color(middleTopColor), color(middleBottomColor), color(middleTextColor), color(middleBorderColor), Height, Width ); labelOff = new cbsLabel( color(offTopColor), color(offBottomColor), color(offTextColor), color(offBorderColor), h, w + 1, offText ); if (state) { setOn(); } else { setOff(); } _checked = state; Controls.Add(labelOn); Controls.Add(labelOff); // Middle will be as background if we add it last Controls.Add(labelMiddle); labelOn.Click += onClick; labelMiddle.Click += onClick; labelOff.Click += onClick; //animLeftOff = new Animator2D(new Path2D(p2, p1, animationtime)); //animMiddleOff = new Animator2D(new Path2D(p3, p2, animationtime)); //animRightOff = new Animator2D(new Path2D(p4, p3, animationtime)); //animLeftOn = new Animator2D(new Path2D(p1, p2, animationtime)); //animMiddleOn = new Animator2D(new Path2D(p2, p3, animationtime)); //animRightOn = new Animator2D(new Path2D(p3, p4, animationtime)); //animDone = new SafeInvoker(onAnimDone); }