* UIRichTextBox:增加右键菜单

This commit is contained in:
Sunny 2020-11-16 22:29:41 +08:00
parent 0cd12d900b
commit dc2c9bc740
6 changed files with 37 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -43,7 +43,10 @@
this.uiLine2 = new Sunny.UI.UILine();
this.uiLine3 = new Sunny.UI.UILine();
this.uiTextBox4 = new Sunny.UI.UITextBox();
this.uiContextMenuStrip1 = new Sunny.UI.UIContextMenuStrip();
this.aaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.PagePanel.SuspendLayout();
this.uiContextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// PagePanel
@ -214,6 +217,7 @@
// uiRichTextBox1
//
this.uiRichTextBox1.AutoWordSelection = true;
this.uiRichTextBox1.ContextMenuStrip = this.uiContextMenuStrip1;
this.uiRichTextBox1.FillColor = System.Drawing.Color.White;
this.uiRichTextBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiRichTextBox1.Location = new System.Drawing.Point(388, 219);
@ -269,6 +273,20 @@
"nnyUI技术交流群)请给源码项目点个Star吧";
this.uiTextBox4.Watermark = "水印文字";
//
// uiContextMenuStrip1
//
this.uiContextMenuStrip1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiContextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.aaToolStripMenuItem});
this.uiContextMenuStrip1.Name = "uiContextMenuStrip1";
this.uiContextMenuStrip1.Size = new System.Drawing.Size(99, 30);
//
// aaToolStripMenuItem
//
this.aaToolStripMenuItem.Name = "aaToolStripMenuItem";
this.aaToolStripMenuItem.Size = new System.Drawing.Size(98, 26);
this.aaToolStripMenuItem.Text = "aa";
//
// FTextBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@ -277,8 +295,10 @@
this.Name = "FTextBox";
this.Symbol = 61962;
this.Text = "TextBox";
this.Controls.SetChildIndex(this.PagePanel, 0);
this.PagePanel.ResumeLayout(false);
this.PagePanel.PerformLayout();
this.uiContextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -299,5 +319,7 @@
private UITextBox uiTextBox4;
private UILine uiLine3;
private UILine uiLine2;
private UIContextMenuStrip uiContextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem aaToolStripMenuItem;
}
}

View File

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="uiContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -69,6 +69,12 @@ namespace Sunny.UI
timer.Start();
}
protected override void OnContextMenuStripChanged(EventArgs e)
{
base.OnContextMenuStripChanged(e);
listbox.ContextMenuStrip = ContextMenuStrip;
}
private void Listbox_MouseMove(object sender, MouseEventArgs e)
{
MouseMove?.Invoke(this, e);

View File

@ -46,6 +46,12 @@ namespace Sunny.UI
edit.ScrollBars = RichTextBoxScrollBars.Vertical;
}
protected override void OnContextMenuStripChanged(EventArgs e)
{
base.OnContextMenuStripChanged(e);
edit.ContextMenuStrip = ContextMenuStrip;
}
protected override void OnFontChanged(EventArgs e)
{
base.OnFontChanged(e);