public void PaintSkinnyHands(Bitmap screen, Time time) { PaintHourHand(screen, Color.White, 3, time.CurrentTime.Hour, time.CurrentTime.Minute); PaintMinuteHand(screen, Color.White, 2, time.CurrentTime.Minute, time.CurrentTime.Second); //PaintSecondHand(screen,Color.White, 1, time.CurrentTime.Second); screen.DrawEllipse(Color.White, 1, Program.Center.X, Program.Center.Y, 3, 3, Color.White, 0, 0, Color.White, 0, 0, 255); screen.DrawEllipse(Color.White, 1, Program.Center.X, Program.Center.Y, 2, 2, Color.Black, 0, 0, Color.White, 0, 0, 255); }
protected internal override void RenderEllipse(Bitmap bmp, Pen pen, int x, int y, int xRadius, int yRadius) { Color outlineColor = (pen != null) ? pen.Color : (Color)0x0; ushort outlineThickness = (pen != null) ? pen.Thickness : (ushort)0; if (bmp != null) bmp.DrawEllipse((MSMedia.Color)outlineColor, outlineThickness, x, y, xRadius, yRadius, (MSMedia.Color)Color, 0, 0, (MSMedia.Color)Color, 0, 0, Opacity); }
public static void Main() { LCD myApplication = new LCD(); Window mainWindow = myApplication.CreateWindow(); // Start the application //myApplication.Run(mainWindow); Bitmap bitmap1 = new Bitmap(SystemMetrics.ScreenWidth,SystemMetrics.ScreenHeight); Bitmap bitmap2 = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight); int ox = 0; int oy = 0; int rx = bitmap1.Width; int ry = bitmap1.Height; int sd=0; if (rx < ry) sd = rx; else sd = ry; // // Draw Diagonals // bitmap1.DrawLine(Colors.Blue, 3, 0, 0, rx, ry); bitmap1.DrawLine(Colors.Blue, 3, rx, 0, 0, ry); bitmap2.DrawLine(Colors.Red, 3, 0, 0, rx, ry); bitmap2.DrawLine(Colors.Red, 3, rx, 0, 0, ry); for(int ioff=0; ioff < sd; ioff += 10) { int oX = ox+ioff; int oY = oy+ioff; int wX = rx - 2*ioff; int wY = ry - 2*ioff; bitmap1.DrawRectangle(Colors.White, 1, oX, oY, wX, wY, 1, 1, Colors.Green, ox, oy, Colors.Green, rx, ry, 0xFF); bitmap2.DrawEllipse(Colors.White, rx/2, ry/2, wX, wY); } while (true) { bitmap1.Flush(); Thread.Sleep(250); bitmap2.Flush(); Thread.Sleep(200); } }
public override void Run() { try { using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height)) { var rand = new Random(); for (int i = 0; i < 100; i++) { int radius = rand.Next(100); bmp.DrawEllipse((Color) rand.Next(0xFFFFFF), 1, rand.Next(Dimensions.Width), rand.Next(Dimensions.Height), radius, radius, 0, 0, 0, 0, 0, 0, 0); bmp.Flush(); } } Pass = true; } catch (Exception e) { UnexpectedException(e); } }
/// <summary> /// Paint all hands, a 0 width will not force the hand to not print. /// </summary> /// <param name="screen"></param> /// <param name="foreColor"></param> /// <param name="hourWidth"></param> /// <param name="minuteWidth"></param> /// <param name="secondWidth"></param> /// <param name="hour"></param> /// <param name="minute"></param> /// <param name="second"></param> public void PaintHands(Bitmap screen, Color foreColor, int hourWidth, int minuteWidth, int secondWidth, int hour, int minute, int second) { if (hourWidth > 0) PaintHourHand(screen, foreColor, hourWidth, hour, minute); if (minuteWidth > 0) PaintMinuteHand(screen, foreColor, minuteWidth, minute, second); if (secondWidth > 0) PaintSecondHand(screen, foreColor, secondWidth, second); screen.DrawEllipse(foreColor, 1, AGENT.Center.X, AGENT.Center.Y, 3, 3, Color.White, 0, 0, Color.White, 0, 0, 255); screen.DrawEllipse(foreColor, 1, AGENT.Center.X, AGENT.Center.Y, 2, 2, Color.Black, 0, 0, Color.White, 0, 0, 255); }
protected override void DrawItem(Bitmap screen, int x, int y, int width, int height, ref int index, object item, Style cStyle) { bool selected = _selItem == item; if (selected) { screen.DrawRectangle(Colors.Blue, 0, x, y, width, height, 0, 0, cStyle.ListBoxSelectedItemBack1, x, y, cStyle.ListBoxSelectedItemBack2, x, y + height, 256); } Font textFont = cStyle.LabelFont; Color textColor = selected ? cStyle.TextBoxPressedTextColor : cStyle.TextBoxEnabledTextColor; screen.DrawTextInRect(item.ToString(), x + 5, y + (height - textFont.Height) / 2, width - 10, height, Bitmap.DT_AlignmentLeft, textColor, textFont); const int rdMargin = 3; int rdX = x + _width - ItemHeight - rdMargin, rdY = y + rdMargin, rdRadius = (ItemHeight - rdMargin * 2) / 2; Color bColor = cStyle.RadioButtonEnabledBack; screen.DrawEllipse(cStyle.RadioButtonEnabledBorder, 1, rdX + rdRadius, rdY + rdRadius, rdRadius, rdRadius, bColor, 0, 0, bColor, 0, 0, 256); if (selected) { const int margin = 6; Color pointColor = cStyle.RadioButtonEnabledPoint; _desktopOwner._screenBuffer.DrawEllipse(pointColor, 0, rdX + rdRadius, rdY + rdRadius, rdRadius - margin, rdRadius - margin, pointColor, 0, 0, pointColor, 0, 0, 256); } }