void showControls(CharacterSample sample) { System.Drawing.Point startPoint = new System.Drawing.Point(sample.bitmapLoc.X, sample.bitmapLoc.Y + sample.Img.Height); System.Drawing.Point finishPoint = new System.Drawing.Point(sample.bitmapLoc.X + sample.Img.Width, sample.bitmapLoc.Y); System.Drawing.Point beginPoint = new System.Drawing.Point( sample.Begin.X + sample.bitmapLoc.X, sample.Begin.Y + sample.bitmapLoc.Y); System.Drawing.Point endPoint = new System.Drawing.Point( sample.End.X + sample.bitmapLoc.X, sample.End.Y + sample.bitmapLoc.Y); ControlsCanvas.Children.Clear(); /*bitmap = (Bitmap)buffBitmap.Clone(); * graphics = Graphics.FromImage(bitmap);*/ drawPointControl(startPoint, Colors.Black); drawPointControl(finishPoint, Colors.Black); drawPointControl(beginPoint, Colors.Green); drawPointControl(endPoint, Colors.Red); SolidColorBrush brush = new SolidColorBrush(Colors.Black); Line firstLine = createLine(startPoint.X, finishPoint.Y, finishPoint.X, finishPoint.Y); Line secondLine = createLine(finishPoint.X, finishPoint.Y, finishPoint.X, startPoint.Y); Line thirdLine = createLine(finishPoint.X, startPoint.Y, startPoint.X, startPoint.Y); Line fourthLine = createLine(startPoint.X, startPoint.Y, startPoint.X, finishPoint.Y); firstLine.Stroke = secondLine.Stroke = thirdLine.Stroke = fourthLine.Stroke = brush; ControlsCanvas.Children.Add(firstLine); ControlsCanvas.Children.Add(secondLine); ControlsCanvas.Children.Add(thirdLine); ControlsCanvas.Children.Add(fourthLine); /*System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Black, * 1f / (float)PreviewScale.ScaleX); * graphics.DrawLine(pen, startPoint.X, finishPoint.Y, finishPoint.X, finishPoint.Y); * graphics.DrawLine(pen, finishPoint.X, finishPoint.Y, finishPoint.X, startPoint.Y); * graphics.DrawLine(pen, finishPoint.X, startPoint.Y, startPoint.X, startPoint.Y); * graphics.DrawLine(pen, startPoint.X, startPoint.Y, startPoint.X, finishPoint.Y); * onBitmapChanged();*/ SymbolPreview.Source = BitmapFuncs.fromBitmap(sample.Img); }
void onBitmapChanged(Bitmap newBitmap) { Preview.Source = BitmapFuncs.fromBitmap(newBitmap); }