private void PaintingObject_MouseUp(PaintingObject sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { PaintingControl1.Refresh(); CM_Cmd.Popup(Cursor.Position); } }
private void EditHex() { var po = PaintingControl1.SelectedObjects.FirstOrDefault(); if (po is object) { SM64Lib.Script.ICommand cmd = dicCommands[po.Name]; General.OpenHexEditor(cmd); po.Text = cmd.ToString(); PaintingControl1.Refresh(); } }
private void ListCommands() { PaintingControl1.SuspendLayout(); PaintingControl1.PaintingObjects.Clear(); dicLabelItems.Clear(); dicCommands.Clear(); int curY = 10; int curWidth = 0; foreach (BaseCommand <eTypes> cmd in Script) { var po = new PaintingObject() { EnableResize = false }; PaintingControl1.PaintingObjects.Add(po); po.Text = $"{cmd.ToString()}"; po.TextColor = ForeColor; po.Type = PaintingObjectType.Custom; po.TextFont = new Font(po.TextFont.FontFamily, 12, po.TextFont.Style); po.HorizontalTextAlignment = StringAlignment.Near; var lb = new LabelX() { Text = po.Text, Font = po.TextFont }; string newName = Conversions.ToString(dicLabelItems.Count); lb.BackColor = PanelEx_PaintingControl1.Style.BackColor1.Color; po.Name = newName; lb.Name = newName; lb.Visible = false; lb.Refresh(); dicLabelItems.Add(newName, lb); dicCommands.Add(newName, cmd); po.Y = curY; po.X = 10; po.FitSizeToText(); lb.Size = Size.Round(po.Size); curWidth = Conversions.ToInteger(Math.Max(curWidth, po.Width)); curY += (int)po.Height + 10; po.MouseUp += PaintingObject_MouseUp; po.DrawMethodes.Add(DrawCmdText); } PaintingControl1.Size = new Size(PanelEx_PaintingControl1.Width - 17, curY); PaintingControl1.ResumeLayout(); PaintingControl1.Invalidate(); }