public virtual bool DrawNeedleCover(Graphics Gr, RectangleF rc) { if (this.AnalogMeter == null) { return(false); } Color clr = this.AnalogMeter.NeedleColor; RectangleF _rc = rc; Color clr1 = Color.FromArgb(70, clr); _rc.Inflate(5 * drawRatio, 5 * drawRatio); SolidBrush brTransp = new SolidBrush(clr1); Gr.FillEllipse(brTransp, _rc); clr1 = clr; Color clr2 = HTColorManager.StepColor(clr, 75); LinearGradientBrush br1 = new LinearGradientBrush(rc, clr1, clr2, 45); Gr.FillEllipse(br1, rc); return(true); }
public virtual bool DrawBody(Graphics Gr, RectangleF rc) { if (this.AnalogMeter == null) { return(false); } Color bodyColor = this.AnalogMeter.BodyColor; Color cDark = HTColorManager.StepColor(bodyColor, 20); LinearGradientBrush br1 = new LinearGradientBrush(rc, bodyColor, cDark, 45); Gr.FillEllipse(br1, rc); RectangleF _rc = rc; _rc.X += 3 * drawRatio; _rc.Y += 3 * drawRatio; _rc.Width -= 6 * drawRatio; _rc.Height -= 6 * drawRatio; LinearGradientBrush br2 = new LinearGradientBrush(_rc, cDark, bodyColor, 45); Gr.FillEllipse(br2, _rc); return(true); }
/// <summary> /// Draw the body of the control /// </summary> /// <param name="Gr"></param> /// <param name="rc"></param> /// <returns></returns> public virtual bool DrawBody(Graphics Gr, RectangleF rc) { if (this.Button == null) { return(false); } Color bodyColor = this.Button.ButtonColor; Color cDark = HTColorManager.StepColor(bodyColor, 20); LinearGradientBrush br1 = new LinearGradientBrush(rc, bodyColor, cDark, 45); if ((this.Button.Style == HTButton.ButtonStyle.Circular) || (this.Button.Style == HTButton.ButtonStyle.Elliptical)) { Gr.FillEllipse(br1, rc); } else { GraphicsPath path = this.RoundedRect(rc, 15F); Gr.FillPath(br1, path); path.Dispose(); } if (this.Button.State == HTButton.ButtonState.Pressed) { RectangleF _rc = rc; _rc.Inflate(-15F * this.drawRatio, -15F * drawRatio); LinearGradientBrush br2 = new LinearGradientBrush(_rc, cDark, bodyColor, 45); if ((this.Button.Style == HTButton.ButtonStyle.Circular) || (this.Button.Style == HTButton.ButtonStyle.Elliptical)) { Gr.FillEllipse(br2, _rc); } else { GraphicsPath path = this.RoundedRect(_rc, 10F); Gr.FillPath(br2, path); path.Dispose(); } br2.Dispose(); } br1.Dispose(); return(true); }
/// <summary> /// Draw the text of the control /// </summary> /// <param name="Gr"></param> /// <param name="rc"></param> /// <returns></returns> public virtual bool DrawText(Graphics Gr, RectangleF rc) { if (this.Button == null) { return(false); } //Draw Strings Font font = new Font(this.Button.Font.FontFamily, this.Button.Font.Size * this.drawRatio, this.Button.Font.Style); String str = this.Button.Label; Color bodyColor = this.Button.ButtonColor; Color cDark = HTColorManager.StepColor(bodyColor, 20); SizeF size = Gr.MeasureString(str, font); SolidBrush br1 = new SolidBrush(bodyColor); SolidBrush br2 = new SolidBrush(cDark); Gr.DrawString(str, font, br1, rc.Left + ((rc.Width * 0.5F) - (float)(size.Width * 0.5F)) + (float)(1 * this.drawRatio), rc.Top + ((rc.Height * 0.5F) - (float)(size.Height * 0.5)) + (float)(1 * this.drawRatio)); Gr.DrawString(str, font, br2, rc.Left + ((rc.Width * 0.5F) - (float)(size.Width * 0.5F)), rc.Top + ((rc.Height * 0.5F) - (float)(size.Height * 0.5))); br1.Dispose(); br2.Dispose(); font.Dispose(); return(false); }
/// <summary> /// Draw the body of the control /// </summary> /// <param name="Gr"></param> /// <param name="rc"></param> /// <returns></returns> public virtual bool DrawLed(Graphics Gr, RectangleF rc) { if (this.Led == null) { return(false); } Color cDarkOff = HTColorManager.StepColor(Color.LightGray, 20); Color cDarkOn = HTColorManager.StepColor(this.Led.LedColor, 60); LinearGradientBrush brOff = new LinearGradientBrush(rc, Color.Gray, cDarkOff, 45); LinearGradientBrush brOn = new LinearGradientBrush(rc, this.Led.LedColor, cDarkOn, 45); if (this.Led.State == HTLed.LedState.Blink) { if (this.Led.BlinkIsOn == false) { if (this.Led.Style == HTLed.LedStyle.Circular) { Gr.FillEllipse(brOff, rc); } else if (this.Led.Style == HTLed.LedStyle.Rectangular) { Gr.FillRectangle(brOff, rc); } } else { if (this.Led.Style == HTLed.LedStyle.Circular) { Gr.FillEllipse(brOn, rc); } else if (this.Led.Style == HTLed.LedStyle.Rectangular) { Gr.FillRectangle(brOn, rc); } } } else { if (this.Led.State == HTLed.LedState.Off) { if (this.Led.Style == HTLed.LedStyle.Circular) { Gr.FillEllipse(brOff, rc); } else if (this.Led.Style == HTLed.LedStyle.Rectangular) { Gr.FillRectangle(brOff, rc); } } else { if (this.Led.Style == HTLed.LedStyle.Circular) { Gr.FillEllipse(brOn, rc); } else if (this.Led.Style == HTLed.LedStyle.Rectangular) { Gr.FillRectangle(brOn, rc); } } } brOff.Dispose(); brOn.Dispose(); return(true); }