[url=viewtopic.php?t=30561]Ich möchte[/url] einen "Wasserfall" fortsetzen, um ein Funkspektrum darzustellen. /> Ist das auch der richtige Ansatz in Win2D? Offscreen: < /p> [code]private CanvasRenderTarget offscreen; private CanvasDevice device = CanvasDevice.GetSharedDevice(); private DispatcherTimer Timer; < /code> Im Konstruktor: < /p> offscreen = new CanvasRenderTarget(device, 300, 255, 96); Timer = new DispatcherTimer(); Timer.Interval = TimeSpan.FromMilliseconds(refreshRate); Timer.Tick += Timer_Tick; Timer.Start(); < /code> Arbeiten im Timer_tick -Ereignis: < /p>
private void Timer_Tick(object? sender, object e) { using (CanvasDrawingSession ds = offscreen.CreateDrawingSession()) { // Draw rectangle ds.FillRectangle(10, 10, 100, 100, Colors.Red); // Source rect to be copied Rect sourceRegion = new Rect(10, 10, 50, 50); // Define the destination point on the current canvas Vector2 destinationPoint = new Vector2(150, 150); // Copy the specified region from the source to the destination **ds.DrawImage(offscreen, destinationPoint, sourceRegion); // Unhandled error** } if (this.waterfallCanvas != null) this.waterfallCanvas.Invalidate(); }
private void waterfallCanvas_Draw(CanvasControl sender, CanvasDrawEventArgs args) { if (offscreen != null) args.DrawingSession.DrawImage(offscreen, 0, 0); } [/code] Es wirft eine unberechtigte Interopervices aus.>
Ich erhalte einen Videostream mit Socket und zeige ihn auf einer Leinwand an. Ich versuche eine Box zu haben, die mit Sliders bewegt werden kann, um ein bestimmtes Objekt im Rahmen zu positionieren....
contentControl wird in wpf.
Das ContentControl erstellt. funktioniert. using WpfApp1.Models;
using OpenTK.Graphics.OpenGL;
using OpenTK.Mathematics;
using OpenTK.Wpf;
using System.Windows;
using...