protected override void OnPostRender(DrawingContext dc) { base.OnPostRender(dc); if (gm.IsTrial) dc.DrawText("Demo version", font, Color.Red, 0, 0); }
protected override void OnRender(DrawingContext dc) { if (!Utils.StringIsNullOrEmpty(activeBrushID)) { Brush brush = (Brush)brushes[activeBrushID]; if (brush != null) dc.DrawRectangle(brush, null, 0, 0, Width, Height); } }
protected override void OnRender(DrawingContext dc) { base.OnRender(dc); // draw crosshair if (crosshairPen != null && CalibrationManager.CalibrationPoints != null && idx < CalibrationManager.CalibrationPoints.Count) { int x = CalibrationManager.CalibrationPoints.ScreenX[idx]; int y = CalibrationManager.CalibrationPoints.ScreenY[idx]; dc.DrawLine(crosshairPen, x - 10, y, x - 2, y); dc.DrawLine(crosshairPen, x + 10, y, x + 2, y); dc.DrawLine(crosshairPen, x, y - 10, x, y - 2); dc.DrawLine(crosshairPen, x, y + 10, x, y + 2); } }
public override void OnRender(DrawingContext dc) { if (background != null) dc.DrawRectangle(background, null, 0, 0, Width, Height); }
protected override void OnRender(DrawingContext dc) { dc.DrawRectangle(background, null, 0, 0, Width, Height); if (foreground != null) { bool horizontal = orientation == Orientation.Horizontal; int w = horizontal ? Width * value / 100 : Width; int h = horizontal ? Height : Height * value / 100; int y = horizontal ? 0 : Height - h; dc.DrawRectangle(foreground, null, 0, y, w, h); } dc.DrawRectangle(null, border, 0, 0, Width, Height); }
public override void OnRender(DrawingContext dc) { if (isChecked) { if (backgroundChecked != null) dc.DrawRectangle(backgroundChecked, border, 0, 0, Width, Height); else { dc.DrawRectangle(backgroundUnchecked, border, 0, 0, Width, Height); int offset = 2; LinearGradientBrush b = new LinearGradientBrush(Color.LimeGreen, Color.Black); dc.DrawRectangle(b, null, offset, offset, Width - 2 * offset, Height - 2 * offset); } } else { dc.DrawRectangle(backgroundUnchecked, border, 0, 0, Width, Height); } }
protected override void OnRender(DrawingContext dc) { #region Background int b = border != null ? 1 : 0; dc.DrawRectangle(TouchCapture.Captured == this ? backgroundPressed : backgroundUnpressed, null, b, b, Width - 2 * b, Height - 2 * b); #endregion bool hasForeground = foreground != null; bool hasText = font != null && !Utils.StringIsNullOrEmpty(text); if (hasForeground && !hasText) { // image only ushort originalOpacity = foreground.Opacity; if (!IsEnabled) foreground.Opacity = (ushort)(originalOpacity / 2); int a = (Width < Height ? Width : Height) - 2; dc.DrawRectangle(foreground, null, (Width - a) / 2, (Height - a) / 2, a, a); foreground.Opacity = originalOpacity; } else if (!hasForeground && hasText) { // text only int w = 0, h = 0; font.ComputeExtent(text, out w, out h); string s = text; dc.DrawText(ref s, font, foreColor, 0, (Height - h) / 2, Width, h, TextAlignment.Center, TextTrimming.None, false); } else if (hasForeground && hasText) { if (textBelow) { } else { } } #region Border //if (border != null) //{ // int corner = 3; // dc.DrawFrame(border, 0, 0, Width, Height, corner, corner); //} #endregion }
public override void OnRender(DrawingContext dc) { if (font != null && !Utils.StringIsNullOrEmpty(text)) dc.DrawText(text, font, foreColor, 0, 0); }
private void RenderTask(RenderTask task) { Rect contentRect = new Rect(0, 0, desktop.Width, desktop.Height); var dirtyRect = contentRect; if (task != null) dirtyRect = task.DirtyArea.Intersection(contentRect); if (dirtyRect.IsZero) return; //dt = DateTime.Now; var dc = new DrawingContext(bitmap); dc.PushClippingRectangle(dirtyRect); if (!dc.ClippingRectangle.IsZero) { desktop.RenderRecursive(dc); desktop.PostRenderRecursive(dc); } dc.PopClippingRectangle(); dc.Close(); //ts = DateTime.Now - dt; if (OnRenderRequest != null) OnRenderRequest(bitmap, dirtyRect); else bitmap.Flush(dirtyRect.X, dirtyRect.Y, dirtyRect.Width, dirtyRect.Height); //Rect dirtyRect2 = new Rect(0, 0, 300, 20); //dc = new DrawingContext(screen); //dc.PushClippingRectangle(dirtyRect2); //Font font = Resources.GetFont(Resources.FontResources.CourierNew_10); //dc.DrawRectangle(new SolidColorBrush(Color.White), null, 0, 0, 300, 20); //dc.DrawText(dirtyRect.ToString() + "; Render: " + ts.ToString(), font, Color.Red, 3, 3); //dc.PopClippingRectangle(); //dc.Close(); //screen.Flush(dirtyRect2.X, dirtyRect2.Y, dirtyRect2.Width, dirtyRect2.Height); //Debug.Print("Render task: " + ts.ToString()); }
protected override void OnRender(DrawingContext dc) { int centerX = Width / 2; int centerY = Height / 2; int radiusX = centerX; int radiusY = centerY; int ratio = 2; if (isChecked) { if (backgroundChecked != null) dc.DrawRectangle(backgroundChecked, border, 0, 0, Width, Height); else { dc.DrawEllipse(backgroundUnchecked, border, centerX, centerY, radiusX, radiusY); SolidColorBrush b = new SolidColorBrush(Color.LimeGreen); dc.DrawEllipse(b, border, centerX, centerY, radiusX / ratio, radiusY / ratio); } } else { dc.DrawEllipse(backgroundUnchecked, border, centerX, centerY, radiusX, radiusY); } }
public override void OnRender(DrawingContext dc) { if (background != null) dc.DrawRectangle(background, null, 0, 0, Width, Height); if (Bitmap != null) dc.DrawRectangle(brush, null, 0, 0, Width, Height); if (border != null) dc.DrawRectangle(null, border, 0, 0, Width, Height); }
protected virtual void OnRender(DrawingContext dc) { }
internal void RenderRecursive(DrawingContext dc) { if (!isVisible || isSuspended) return; dc.PushClippingRectangle(ScreenArea); if (!dc.ClippingRectangle.IsZero) { OnRender(dc); for (int i = 0; i < children.Count; i++) { Control child = children[i]; if (child != null) child.RenderRecursive(dc); } } dc.PopClippingRectangle(); }
protected override void OnRender(DrawingContext dc) { if (Orientation == Orientation.Horizontal) { barThickness = (Width - gap * (barCount - 1)) / barCount; int x = 0; for (int i = 1; i <= barCount; i++) { int val = Height * i / barCount; dc.DrawRectangle( i <= activeBarCount ? foreground : background, null, x, Height - val, barThickness, val); x += barThickness + gap; } } else { barThickness = (Height - gap * (barCount - 1)) / barCount; int y = Height - barThickness; for (int i = 1; i <= barCount; i++) { int val = Width * i / barCount; dc.DrawRectangle( i <= activeBarCount ? foreground : background, null, Width - val, y, val, barThickness); y -= barThickness + gap; } } }
protected internal virtual void RenderRecursive(DrawingContext dc) { Debug.Assert(this.IsMeasureValid && this.IsArrangeValid); dc.Translate(_offsetX, _offsetY); dc.PushClippingRectangle(0, 0, _renderWidth, _renderHeight); try { Debug.Assert(this.Visibility == Visibility.Visible); if (!dc.EmptyClipRect) { OnRender(dc); UIElementCollection children = _logicalChildren; if (children != null) { int n = children.Count; for (int i = 0; i < n; i++) { UIElement child = children[i]; if (child.IsRenderable()) child.RenderRecursive(dc); } } } } finally { dc.PopClippingRectangle(); dc.Translate(-_offsetX, -_offsetY); //------------------------------------------------------------------------------- // Reset the render flags. _flags &= ~(Flags.IsSubtreeDirtyForRender | Flags.IsDirtyForRender); } }
protected override void OnRender(DrawingContext dc) { dc.DrawRectangle(background, border, 0, 0, Width, Height, borderRadius, borderRadius); }
public virtual void OnRender(DrawingContext dc) { }
protected override void OnRender(DrawingContext dc) { if (background != null) dc.DrawRectangle(background, null, 0, 0, Width, Height); if (font != null && !Utils.StringIsNullOrEmpty(text)) { string s = text; // this is important to take a copy!!! don't change!!! dc.DrawText(ref s, font, foreColor, 0, textOffsetY, Width, wordWrap ? Height : font.Height, alignment, trimming, wordWrap); } }
protected override void OnRender(DrawingContext dc) { dc.DrawRectangle(background, border, 0, 0, Width, Height); if (Bitmap != null) dc.DrawRectangle(brush, border, 0, 0, Width, Height); }
protected override void OnRender(DrawingContext dc) { bool horizontal = orientation == Orientation.Horizontal; // background int trackRatio = 7; int a = horizontal ? Height / trackRatio : Width / trackRatio; if (horizontal) trackArea = new Rect(0, (Height - a) / 2, Width, a); else trackArea = new Rect((Width - a) / 2, 0, a, Height); Brush b = background ?? new SolidColorBrush(Color.DarkGray); Pen border = new Pen(Color.Gray, 0); dc.DrawRectangle(b, border, trackArea.X, trackArea.Y, trackArea.Width, trackArea.Height); // thumb int workarea = horizontal ? Width - thumbSize : Height - thumbSize; int x = horizontal ? workarea * value / 100 : 0; int y = horizontal ? 0 : Height - thumbSize - workarea * value / 100; if (horizontal) thumbArea = new Rect(x, y, thumbSize, Height); else thumbArea = new Rect(x, y, Width, thumbSize); Brush bb = foreground ?? new LinearGradientBrush(Color.LightGray, Color.Black); dc.DrawRectangle(bb, thumbBorder, thumbArea.X, thumbArea.Y, thumbArea.Width, thumbArea.Height); }