private void mouseMoved(object sender, MouseEventArgs e) { if (mMode == MouseMode.PENCIL_MODE) { // do nothing } else if (mMode == MouseMode.SELECT_REGION_MODE) { if (isMouseClicked) { endPosition = new Point(e.X, e.Y); rect = new Rectangle( startPosition.X, startPosition.Y, endPosition.X - startPosition.X, endPosition.Y - startPosition.Y); InnerPanel.Refresh(); g = InnerPanel.CreateGraphics(); g.DrawRectangle(greenPen, rect); g.Dispose(); } } else if (mMode == MouseMode.SERIAL_PAINT_MODE) { } }
// When an option is clicked, update the bool array of options private void CheckboxFields_Click(object sender, MouseEventArgs e) { Control clickedControl = (Control)sender; // Sender gives you which control is clicked. int index = CheckboxFields.FindIndex(a => a == clickedControl); // Which control is clicked in a list CheckboxState[index] = !CheckboxState[index]; InnerPanel.Invalidate(); }
private void leftMouseUp(object sender, MouseEventArgs e) { isMouseClicked = false; if (mMode == MouseMode.PENCIL_MODE) { Point sP = new Point(startPosition.X, startPosition.Y); Note n = new Note(); n.Size = new Size(25 * (int)pp, 20); n.BackColor = Color.Aquamarine; n.Location = sP; n.p = sP; n.x = n.p.X / 25; n.y = n.p.Y / 20; n.pKey = pKeyIdx++; n.noteLevel = NOTEPITCHMAX; n.noteLevel -= (byte)n.y; n.noteTimeStamp = n.x * 250; n.noteDuration = 250; noteDict.Add(n.pKey, n); InnerPanel.Controls.Add(n); toolStripStatusLabel1.Text = n.noteLevel.ToString(); toolStripStatusLabel2.Text = n.noteTimeStamp.ToString(); toolStripStatusLabel3.Text = n.pKey.ToString(); } else if (mMode == MouseMode.SELECT_REGION_MODE) { // not implemented yet // select inner rectangle region for (int i = 0; i < noteDict.Count; i++) { if (noteDict[i].p.X >= startPosition.X && noteDict[i].p.X <= endPosition.X && noteDict[i].p.Y >= startPosition.Y && noteDict[i].p.Y <= endPosition.Y) { noteDict[i].BackColor = Color.Violet; } } Cursor = Cursors.Default; InnerPanel.Refresh(); } else if (mMode == MouseMode.SERIAL_PAINT_MODE) { } }
private void InnerPanel_Paint(object sender, PaintEventArgs e) { g = this.InnerPanel.CreateGraphics(); h = this.panel2.CreateGraphics(); f = this.panel4.CreateGraphics(); Pen whitePen = new Pen(Color.White, 1); Pen redPen = new Pen(Color.Red, 1); Pen greenPen = new Pen(Color.Green, 1); Pen bluePen = new Pen(Color.Blue, 1); g = InnerPanel.CreateGraphics(); for (int i = 0, j = 0; j <= 130; i++, j++) { if (i <= 130) { g.DrawLine(whitePen, i * 25 * (int)pp, 0, i * 25 * (int)pp, 25 * (int)pp * 128); f.DrawLine(whitePen, i * 25 * (int)pp, 0, i * 25 * (int)pp, 30); if (i % 4 == 0) { g.DrawLine(redPen, i * 25 * (int)pp, 0, i * 25 * (int)pp, 25 * (int)pp * 128); if (i % 16 == 0) { g.DrawLine(bluePen, i * 25 * (int)pp, 0, i * 25 * (int)pp, 25 * (int)pp * 128); } } } g.DrawLine(whitePen, 0, j * 20, 25 * (int)pp * 128, j * 20); h.DrawLine(whitePen, 0, j * 20, 45, j * 20); if (j % 12 == 0) { g.DrawLine(greenPen, 0, j * 20, 25 * (int)pp * 128, j * 20); } } h.Dispose(); f.Dispose(); g.Dispose(); }
protected virtual void SetupTabs() { Log.Verbose("Debugger", "Setup debug window tabs..."); tabStrip = new TabStrip("DebuggerTabStrip"); tabContainer = new TabContainer("DebuggerTabContainer"); tabStrip.Container = tabContainer; InnerPanel.AttachControl(disposingManager.R(tabStrip)); InnerPanel.AttachControl(disposingManager.R(tabContainer)); tabStrip.Anchor = Anchor.Top | Anchor.CenterHorizontal; tabStrip.Size = new Vector2(5 * 120 + 4, 37); tabStrip.RelativePosition = Vector3.zero; tabContainer.Anchor = Anchor.All; tabContainer.RelativePosition = new Vector3(0, tabStrip.Height + 2); tabContainer.Size = new Vector2(InnerPanel.Width, InnerPanel.Height - (tabStrip.Height + 2)); var tab1 = tabStrip.AddTab("Console"); tab1.Width = 120; tab1.ZOrder = 10; tabStrip.AddTab("Log").ZOrder = 20; tabStrip.AddTab("Code").ZOrder = 30; tabStrip.AddTab("Inspector").ZOrder = 40; tabStrip.AddTab("Watch").ZOrder = 50; tabStrip.InitiallySelectedIndex = 0; tabStrip.SelectedIndex = 0; UIComponent[] tabs = tabStrip.UIComponent.tabs.OfType <UIButton>().ToArray(); tabPageConsole = new Panel(tabContainer.Children[0]); tabPageLog = new Panel(tabContainer.Children[1]); tabPageCode = new Panel(tabContainer.Children[2]); tabPageInspector = new Panel(tabContainer.Children[3]); tabPageWatch = new Panel(tabContainer.Children[4]); }
private void toolStripButton4_Click(object sender, EventArgs e) { if (pp == PanelGridSizeConst.HORIZONTAL_SINGLE) { pp = PanelGridSizeConst.HORIZONTAL_DOUBLE; } else if (pp == PanelGridSizeConst.HORIZONTAL_DOUBLE) { pp = PanelGridSizeConst.HORIZONTAL_TRIPLE; } else if (pp == PanelGridSizeConst.HORIZONTAL_TRIPLE) { pp = PanelGridSizeConst.HORIZONTAL_SINGLE; } for (int i = 0; i < noteDict.Count; i++) { noteDict[i].Width = 25 * (int)pp; noteDict[i].Location = new Point(noteDict[i].p.X * (int)pp, noteDict[i].p.Y); } InnerPanel.Refresh(); panel4.Refresh(); }
public void Awake() { instance = this; }