private void showCurrentPosition() { int width = OutputPanel.Width; int height = OutputPanel.Height; int smallest = Math.Min(width, height) - 1; using (Bitmap bufl = new Bitmap(width, height)) using (Graphics g = Graphics.FromImage(bufl)) using (System.Drawing.Pen blackPen = new System.Drawing.Pen(System.Drawing.Color.Black)) using (System.Drawing.Pen redPen = new System.Drawing.Pen(System.Drawing.Color.Red)) { g.FillRectangle(Brushes.White, new Rectangle(0, 0, width, height)); System.Drawing.Rectangle drawingRegion = new System.Drawing.Rectangle((width - smallest) / 2, (height - smallest) / 2, smallest, smallest); g.DrawEllipse(System.Drawing.Pens.Black, drawingRegion); g.DrawLine(blackPen, (width - smallest) / 2, height / 2, width - (width - smallest) / 2, height / 2); g.DrawLine(blackPen, width / 2, (height - smallest) / 2, width / 2, height - (height - smallest) / 2); int Xpos = width / 2 + (int)((float)currentBalanceBoardX / 20.0 * smallest); int Ypos = height / 2 + (int)((float)currentBalanceBoardY / 20.0 * smallest); if (parent.xInverted) { Xpos = width - Xpos; } if (parent.yInverted) { Ypos = height - Ypos; } System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(Xpos - cursorSize, Ypos - cursorSize, 2 * cursorSize, 2 * cursorSize); g.FillRectangle(Brushes.Red, rectangle); g.DrawLine(redPen, Xpos - 5 * cursorSize, Ypos, Xpos + 5 * cursorSize, Ypos); g.DrawLine(redPen, Xpos, Ypos - 5 * cursorSize, Xpos, Ypos + 5 * cursorSize); OutputPanel.CreateGraphics().DrawImage(bufl, 0, 0); } // throw new NotImplementedException(); }
private void showComplete(int lastPoint) { OutputPanel.CreateGraphics().DrawImageUnscaled(getOutpanelBitmap(lastPoint, ""), 0, 0); return; }