public override RectangleF GetBoundRect(GaugeGraphics g) { if (this.Common != null && !float.IsNaN(base.AspectRatio)) { RectangleF absoluteRectangle = g.GetAbsoluteRectangle(base.Position.Rectangle); if (absoluteRectangle.Width > absoluteRectangle.Height * base.AspectRatio) { float width = absoluteRectangle.Width; absoluteRectangle.Width = absoluteRectangle.Height * base.AspectRatio; absoluteRectangle.X += (float)((width - absoluteRectangle.Width) / 2.0); return(g.GetRelativeRectangle(absoluteRectangle)); } float height = absoluteRectangle.Height; absoluteRectangle.Height = absoluteRectangle.Width / base.AspectRatio; absoluteRectangle.Y += (float)((height - absoluteRectangle.Height) / 2.0); return(g.GetRelativeRectangle(absoluteRectangle)); } return(base.Position.Rectangle); }
internal void BuildMatrices(GaugeGraphics g) { absMatrix.Reset(); RectangleF rectangleF = new RectangleF(0f, 0f, 1f, 1f); RectangleF absoluteRectangle = g.GetAbsoluteRectangle(rectangleF); absMatrix.Translate(g.Transform.OffsetX, g.Transform.OffsetY); absMatrix.Scale(absoluteRectangle.Size.Width, absoluteRectangle.Size.Height); absoluteRectangle = g.GetRelativeRectangle(rectangleF); relMatrix.Reset(); relMatrix.Scale(absoluteRectangle.Size.Width, absoluteRectangle.Size.Height); relMatrix.Translate(0f - g.Transform.OffsetX, 0f - g.Transform.OffsetY); }
public void BuildMatrices(GaugeGraphics g) { this.absMatrix.Reset(); RectangleF rectangleF = new RectangleF(0f, 0f, 1f, 1f); RectangleF rectangleF2 = g.GetAbsoluteRectangle(rectangleF); this.absMatrix.Translate(g.Transform.OffsetX, g.Transform.OffsetY); this.absMatrix.Scale(rectangleF2.Size.Width, rectangleF2.Size.Height); rectangleF2 = g.GetRelativeRectangle(rectangleF); this.relMatrix.Reset(); this.relMatrix.Scale(rectangleF2.Size.Width, rectangleF2.Size.Height); this.relMatrix.Translate((float)(0.0 - g.Transform.OffsetX), (float)(0.0 - g.Transform.OffsetY)); }
public override RectangleF GetBoundRect(GaugeGraphics g) { if (this.Common != null) { RectangleF absolute = this.absoluteRect = g.GetAbsoluteRectangle(base.Position.Rectangle); if (!float.IsNaN(base.AspectRatio)) { if (base.AspectRatio >= 1.0) { float width = absolute.Width; absolute.Width /= base.AspectRatio; absolute.X += (float)((width - absolute.Width) / 2.0); } else { float height = absolute.Height; absolute.Height *= base.AspectRatio; absolute.Y += (float)((height - absolute.Height) / 2.0); } } if (absolute.Width != absolute.Height) { if (absolute.Width > absolute.Height) { absolute.Offset((float)((absolute.Width - absolute.Height) / 2.0), 0f); absolute.Width = absolute.Height; } else if (absolute.Width < absolute.Height) { absolute.Offset(0f, (float)((absolute.Height - absolute.Width) / 2.0)); absolute.Height = absolute.Width; } } return(g.GetRelativeRectangle(absolute)); } return(base.Position.Rectangle); }
internal void RenderGlassEffect(GaugeGraphics g) { if (GlassEffect == GlassEffect.None || FrameStyle == BackFrameStyle.None) { return; } if (IsCustomXamlFrame()) { GetCachedXamlRenderer(g).Layers[2].Render(g); return; } RectangleF bounds; using (GraphicsPath graphicsPath = GetFramePath(g, FrameWidth - 1f)) { bounds = graphicsPath.GetBounds(); using (Brush brush = new LinearGradientBrush(bounds, Color.FromArgb(15, Color.Black), Color.FromArgb(128, Color.Black), LinearGradientMode.ForwardDiagonal)) { if (bounds.Height > 0f && bounds.Width > 0f) { g.FillPath(brush, graphicsPath); } } } if (FrameShape == BackFrameShape.Rectangular || FrameShape == BackFrameShape.RoundedRectangular) { _ = g.GetAbsoluteSize(new SizeF(8f, 0f)).Width; GraphicsPath graphicsPath2 = new GraphicsPath(); float absoluteDimension = g.GetAbsoluteDimension(30f); float absoluteDimension2 = g.GetAbsoluteDimension(10f); float absoluteDimension3 = g.GetAbsoluteDimension(50f); float absoluteDimension4 = g.GetAbsoluteDimension(5f); g.GetAbsoluteDimension(30f); g.GetAbsoluteDimension(5f); PointF[] points = new PointF[4] { new PointF(bounds.X, bounds.Y + absoluteDimension), new PointF(bounds.X + absoluteDimension, bounds.Y), new PointF(bounds.X + absoluteDimension + absoluteDimension2, bounds.Y), new PointF(bounds.X, bounds.Y + absoluteDimension + absoluteDimension2) }; PointF[] points2 = new PointF[4] { new PointF(bounds.X, bounds.Y + absoluteDimension3), new PointF(bounds.X + absoluteDimension3, bounds.Y), new PointF(bounds.X + absoluteDimension3 + absoluteDimension4, bounds.Y), new PointF(bounds.X, bounds.Y + absoluteDimension3 + absoluteDimension4) }; graphicsPath2.AddPolygon(points); graphicsPath2.AddPolygon(points2); Brush brush2 = new SolidBrush(Color.FromArgb(148, Color.White)); g.FillPath(brush2, graphicsPath2); } else if ((FrameShape == BackFrameShape.Circular || FrameShape == BackFrameShape.AutoShape) && GlassEffect == GlassEffect.Simple) { float absoluteDimension5 = g.GetAbsoluteDimension(15f); bounds.X += absoluteDimension5; bounds.Y += absoluteDimension5; bounds.Width -= absoluteDimension5 * 2f; bounds.Height -= absoluteDimension5 * 2f; GraphicsPath circularRangePath = g.GetCircularRangePath(g.GetRelativeRectangle(bounds), 226f, 30f, 6f, 6f, Placement.Inside); GraphicsPath circularRangePath2 = g.GetCircularRangePath(g.GetRelativeRectangle(bounds), 224f, -30f, 6f, 6f, Placement.Inside); Brush brush3 = new SolidBrush(Color.FromArgb(200, Color.White)); g.FillPath(brush3, circularRangePath); g.FillPath(brush3, circularRangePath2); } }