public EmulatorDemo(PixelFormats format, Pictor.UI.PlatformSupportAbstract.ERenderOrigin RenderOrigin) : base(format, RenderOrigin) { m_idx = (-1); background = new Pictor.RGBA_Bytes(127, 127, 127); m_x[0] = 100; m_y[0] = 100; m_x[1] = 500; m_y[1] = 350; button = Pictor.UI.UIManager.CreateButton(8.0, 130.0, "Quit", 8, 1, 1, 3); button.ButtonClick += Quit; AddChild(button); white = Pictor.UI.UIManager.CreateButton(8.0, 110.0, "Gray", 8, 1, 1, 3); blue = Pictor.UI.UIManager.CreateButton(8.0, 90.0, "Blue", 8, 1, 1, 3); reset = Pictor.UI.UIManager.CreateButton(8.0, 70.0, "Reset", 8, 1, 1, 3); border = new Pictor.UI.CheckBoxWidget(8.0, 50.0, "Draw as outline"); alpha = new Pictor.UI.SliderWidget(10, 10, 590, 19); radius = new Pictor.UI.SliderWidget(10, 30, 590, 39); alpha.Range(0, 255); alpha.Value(255); //alpha.BackgroundColor(new Pictor.RGBA_Doubles(255, 255, 255)); radius.Label("Radius = {0:F3}"); radius.Range(0.0, 50.0); radius.Value(25.0); border.Status(false); white.ButtonClick += White; blue.ButtonClick += Blue; reset.ButtonClick += Reset; AddChild(white); AddChild(blue); AddChild(reset); AddChild(border); AddChild(alpha); AddChild(radius); }
public void Blue(Pictor.UI.ButtonWidget button) { background = new Pictor.RGBA_Bytes(117, 115, 217); }
public void White(Pictor.UI.ButtonWidget button) { background = new Pictor.RGBA_Bytes(127, 127, 127); }
public void Reset(Pictor.UI.ButtonWidget button) { m_x[0] = 100; m_y[0] = 100; m_x[1] = 500; m_y[1] = 350; }
public void Quit(Pictor.UI.ButtonWidget button) { dialog = new Pictor.UI.Dialogs.YesNoDialog(150, 200, "Close Application?"); dialog.Show(this); }
public override void OnMouseUp(Pictor.UI.MouseEventArgs mouseEvent) { m_idx = -1; base.OnMouseUp(mouseEvent); }
public override void OnMouseMove(Pictor.UI.MouseEventArgs mouseEvent) { if (mouseEvent.Button == Pictor.UI.MouseButtons.Left) { if (m_idx >= 0) { m_x[m_idx] = mouseEvent.X - m_dx; m_y[m_idx] = mouseEvent.Y - m_dy; ForceRedraw(); } } base.OnMouseMove(mouseEvent); }
public override void OnMouseDown(Pictor.UI.MouseEventArgs mouseEvent) { if (mouseEvent.Button == Pictor.UI.MouseButtons.Left) { for (int i = 0; i < 2; i++) { double x = mouseEvent.X; double y = mouseEvent.Y; if (System.Math.Sqrt((x - m_x[i]) * (x - m_x[i]) + (y - m_y[i]) * (y - m_y[i])) < 5.0) { m_dx = x - m_x[i]; m_dy = y - m_y[i]; m_idx = i; break; } } } base.OnMouseDown(mouseEvent); }
/* //---------------------------------------------------------set_orientation public static EPathCommands set_orientation(uint c, EPathFlags o) { return ClearOrientation(c) | o; } */ public static void ShortenPath(Pictor.vertex_sequence vs, double s) { ShortenPath(vs, s, 0); }
public void AddVertex(double x, double y, Pictor.Path.FlagsAndCommand unknown) { throw new System.NotImplementedException(); }