public AnalogLayout(AnalogClock.AnalogClock analogLayout) { dropShadowColor = analogLayout.DropShadowColor; drawDropShadow = analogLayout.DrawDropShadow; faceColourHigh = analogLayout.FaceColorHigh; faceColourLow = analogLayout.FaceColorLow; faceGradient = analogLayout.FaceGradientMode; rimColourHigh = analogLayout.RimColorHigh; rimColourLow = analogLayout.RimColorLow; rimGradient = analogLayout.RimGradientMode; fontColour = analogLayout.NumeralColor; hourHand = analogLayout.HourHandColor; minuteHand = analogLayout.MinuteHandColor; secondHand = analogLayout.SecondHandColor; secondTickStyle = analogLayout.SecondHandTickStyle; // enum deadlineHand = analogLayout.DeadlineHandColour; drawHourHand = analogLayout.DrawHourHand; drawMinuteHand = analogLayout.DrawMinuteHand; drawSecondHand = analogLayout.DrawSecondHand; drawHourShadow = analogLayout.DrawHourHandShadow; drawMinuteShadow = analogLayout.DrawMinuteHandShadow; drawSecondShadow = analogLayout.DrawSecondHandShadow; drawDeadlineShadow = analogLayout.DrawDeadlineHandShadow; hourShadow = analogLayout.HourHandDropShadowColor; minuteShadow = analogLayout.MinuteHandDropShadowColor; secondShadow = analogLayout.SecondHandDropShadowColor; deadlineShadow = analogLayout.DeadlineHandDropShadowColor; }
public void GradientFillRectangle(Rect theRect, System.Drawing.Color Color1, System.Drawing.Color Color2, System.Drawing.Drawing2D.LinearGradientMode GradientType) { TransformRect(theRect); SourceDrawOperations.GradientFillRectangle(R, Color1, Color2, GradientType); }
public static LinearGradientMode ToNPlot(this SD.Drawing2D.LinearGradientMode value) => (LinearGradientMode)value;
public void GradientFillRectangle(Rect theRect, System.Drawing.Color Color1, System.Drawing.Color Color2, System.Drawing.Drawing2D.LinearGradientMode GradientType) { System.Drawing.Rectangle R = theRect.GetRectangle(); System.Drawing.Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(R, Color1, Color2, GradientType); mGraphics.FillRectangle(b, R); }
private void AddGradientBorder(System.Drawing.Rectangle rect, System.Drawing.Color Color1, System.Drawing.Color Color2, System.Drawing.Drawing2D.LinearGradientMode Mode, int XOffset, int YOffset) { System.Drawing.Rectangle brect = new System.Drawing.Rectangle(rect.X, rect.Y, rect.Width, rect.Height); brect.X += XOffset; brect.Y += YOffset; System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(brect, Color1, Color2, Mode); brush.WrapMode = System.Drawing.Drawing2D.WrapMode.TileFlipXY; Graphics gr = System.Drawing.Graphics.FromImage(Bitmap); gr.FillRectangle(brush, rect); //gr.DrawRectangle(System.Drawing.Pens.Red, New System.Drawing.Rectangle(CInt(rect.X), CInt(rect.Y), CInt(rect.Width), CInt(rect.Height))) gr.Dispose(); }
/// <summary> /// 初始化<see cref="AuroraFramework.Forms.Control.AuroraGradientColor"/>结构的新实例 /// </summary> /// <param name="fColor">初始颜色</param> /// <param name="tColor">结束颜色</param> /// <param name="gradientMode">线性渐变模式</param> /// <param name="factors">色彩渲染系数(0到1的浮点数值)</param> /// <param name="positions">色彩渲染位置(0到1的浮点数值)</param> public AuroraGradientColor(System.Drawing.Color fColor, System.Drawing.Color tColor, System.Drawing.Drawing2D.LinearGradientMode gradientMode, float[] factors, float[] positions) { this.FromColor = fColor; this.ToColor = tColor; this.GradientMode = gradientMode; this.Factors = factors ?? (new float[] { }); this.Positions = positions ?? (new float[] { }); }
/// <summary> /// 初始化<see cref="AuroraFramework.Forms.Control.AuroraGradientColor"/>结构的新实例 /// </summary> /// <param name="fColor">初始颜色</param> /// <param name="tColor">结束颜色</param> /// <param name="gradientMode">线性渐变模式</param> /// <param name="blend"><see cref="LinearGradientBrush"/>对象的混合图案</param> public AuroraGradientColor(System.Drawing.Color fColor, System.Drawing.Color tColor, System.Drawing.Drawing2D.LinearGradientMode gradientMode, System.Drawing.Drawing2D.Blend blend) { this.FromColor = fColor; this.ToColor = tColor; this.GradientMode = gradientMode; this.Factors = blend == null ? new float[] { } : (blend.Factors ?? (new float[] { })); this.Positions = blend == null ? new float[] { } : (blend.Positions ?? (new float[] { })); }
/// <summary> /// 初始化<see cref="AuroraFramework.Forms.ControlAuroraGradientColor"/>结构的新实例 /// </summary> /// <param name="fColor">初始颜色</param> /// <param name="tColor">结束颜色</param> /// <param name="gradientMode">线性渐变模式</param> public AuroraGradientColor(System.Drawing.Color fColor, System.Drawing.Color tColor, System.Drawing.Drawing2D.LinearGradientMode gradientMode) { this.FromColor = fColor; this.ToColor = tColor; this.GradientMode = gradientMode; this.Factors = null; this.Positions = null; }
public void GradientFillRectangle(Rect theRect, System.Drawing.Color Color1, System.Drawing.Color Color2, System.Drawing.Drawing2D.LinearGradientMode GradientType) { int ColorR1 = Color1.R; int ColorG1 = Color1.G; int ColorB1 = Color1.B; int ColorR2 = Color2.R - ColorR1; int ColorG2 = Color2.G - ColorG1; int ColorB2 = Color2.B - ColorB1; int Width = theRect.Size.X; int Height = theRect.Size.Y; int x0 = theRect.Location.X; int y0 = theRect.Location.Y; int x1 = theRect.Right; int y1 = theRect.Bottom; if (Width <= 0 || Height <= 0) { return; } double Coeff; int StepSize; API.RECT R = new API.RECT(); const int NumberOfSteps = 128; // number of steps if (GradientType == System.Drawing.Drawing2D.LinearGradientMode.Horizontal) { double InvWidth = 1.0 / Width; StepSize = Width / NumberOfSteps; if (StepSize < 1) { StepSize = 1; } R.Top = y0; R.Bottom = y1; for (int i = x0; i <= x1; i += StepSize) { R.Left = i; R.Right = i + StepSize; if (R.Right > x1) { R.Right = x1; } Coeff = (i - x0) * InvWidth; IntPtr hBrush = API.CreateSolidBrush((int) (int)(ColorR1 + (double)ColorR2 * Coeff) | (int)(ColorG1 + (double)ColorG2 * Coeff) << 8 | (int)(ColorB1 + (double)ColorB2 * Coeff) << 16 ); API.FillRect(hDC, ref R, hBrush); API.DeleteObject(hBrush); } } else { double InvHeight = 1.0 / Height; StepSize = Height / NumberOfSteps; if (StepSize < 1) { StepSize = 1; } R.Left = x0; R.Right = x1; for (int i = y0; i <= y1; i += StepSize) { R.Top = i; R.Bottom = i + StepSize; if (R.Bottom > y1) { R.Bottom = y1; } Coeff = (i - y0) * InvHeight; IntPtr hBrush = API.CreateSolidBrush( (int)(ColorR1 + (double)ColorR2 * Coeff) | (int)(ColorG1 + (double)ColorG2 * Coeff) << 8 | (int)(ColorB1 + (double)ColorB2 * Coeff) << 16 ); API.FillRect(hDC, ref R, hBrush); API.DeleteObject(hBrush); } } }