之前想要弄ToolStripMenuItem的单选菜单效果,本来想着要用到不短的一段if判断来实现,百度了一下发现了一个蛮不错的方法,如果菜单栏目多的话更能体现高效率。...自定义函数 { 自动识别AToolStripMenuItem.Checked = false; 电信DToolStripMenuItem.Checked = false; 联通ToolStripMenuItem.Checked...= false; 移动ToolStripMenuItem.Checked = false; ((ToolStripMenuItem)sender).Checked = true; }...电信DToolStripMenuItem_Click(object sender, EventArgs e) { SingleCheck(sender); } private void 联通ToolStripMenuItem_Click...(object sender, EventArgs e) { SingleCheck(sender); } private void 移动ToolStripMenuItem_Click(object
.Items.Add(menuItem); // 添加下拉菜单 ToolStripMenuItem dropdownMenuItem = new ToolStripMenuItem("下拉菜单...= "File";ToolStripMenuItem newToolStripMenuItem = new ToolStripMenuItem();newToolStripMenuItem.Name...];// 使用索引器获取菜单项ToolStripMenuItem item1 = (ToolStripMenuItem)menuStrip1.Items[0];ToolStripMenuItem item2...menuStrip1.Items.Find("newToolStripMenuItem", true);ToolStripMenuItem item3 = (ToolStripMenuItem)items...fileMenu = new ToolStripMenuItem("文件"); ToolStripMenuItem editMenu = new ToolStripMenuItem
1.属性介绍1.1 ToolStripMenuItem在Winform中使用ContextMenuStrip控件和ToolStripMenuItem控件可以方便地实现弹出式菜单。...分别为toolStripMenuItem1和toolStripMenuItem2;设置toolStripMenuItem1的Text属性为"复制",设置toolStripMenuItem2的Text属性为...toolStripMenuItem = new ToolStripMenuItem();toolStripMenuItem.Text = "下拉框菜单项";contextMenuStrip.Items.Add...item1 = new ToolStripMenuItem("菜单项1");ToolStripMenuItem item2 = new ToolStripMenuItem("菜单项2");// 添加分隔符...添加两个ToolStripMenuItem控件,一个以“删除”为文本,另一个以“复制”为文本。右键单击第一个ToolStripMenuItem控件,选择“属性”选项。
tsmiClose = new System.Windows.Forms.ToolStripMenuItem(); tsmiClose.Name = "cms";...this.tsmiClose_Click); // // tsmiALLClose // System.Windows.Forms.ToolStripMenuItem...tsmiALLClose = new System.Windows.Forms.ToolStripMenuItem(); tsmiALLClose.Name = "cms";...// // tsmiApartFromClose // System.Windows.Forms.ToolStripMenuItem...tsmiApartFromClose = new System.Windows.Forms.ToolStripMenuItem(); tsmiApartFromClose.Name
类型替换 将 ContextMenu 替换为 ContextMenuStrip 将 MenuItem 替换为 ToolStripMenuItem 如: private readonly ContextMenu...MenuItem _toolTipMenuItem; 替换为 private readonly ContextMenuStrip _menu = new ContextMenuStrip(); private ToolStripMenuItem..._verticalMenuItem; private ToolStripMenuItem _toolTipMenuItem; API 差异 Shortcut 枚举类型被删库,老代码: private...shortcut; 类似的,MenuItems属性被删库,老代码: _menu.MenuItems.Add(mi); 改为 _menu.Items.Add(mi); 这段函数升级后的完整代码: private ToolStripMenuItem...AddMenuItem(string text, Keys shortcut = Keys.None) { ToolStripMenuItem mi = new ToolStripMenuItem
4.2.2实现方法(以程序流程图或伪码表示 ) 学生模块代码: private void 学生选课ToolStripMenuItem_Click(object sender, EventArgs e)...new Syixuan().Show(); } private void 查询实验信息ToolStripMenuItem_Click(object sender, EventArgs e) {...4.2.2实现方法(以程序流程图或伪码表示 ) private void 录入成绩ToolStripMenuItem_Click(object sender, EventArgs e) { new...xueshengmingdan().Show(); } private void 考勤ToolStripMenuItem_Click(object sender, EventArgs e) {...().Show(); } private void 添加实验课程信息ToolStripMenuItem_Click(object sender, EventArgs e) { new AddC()
BeginListenWorkerAsync)); workerThread.IsBackground = true; workerThread.Start(); this.停止自动监听ToolStripMenuItem.Enabled..._eventBeginListenWorkList.Reset(); //3.页面执行完相应操作则再次挂起线程,等待ajax请求结果再判断是否恢复线程 }}private void 停止自动监听ToolStripMenuItem_Click...(object sender, EventArgs e){ this.开始自动监听ToolStripMenuItem.Enabled = true; this.停止自动监听ToolStripMenuItem.Enabled...= false; _eventBeginListenWorkList.Reset(); StartListen = false;}private void 开始自动监听ToolStripMenuItem_Click...(object sender, EventArgs e){ this.开始自动监听ToolStripMenuItem.Enabled = false; this.停止自动监听ToolStripMenuItem.Enabled
int)rect.Width, bottom = (int)rect.Height } }; var checkState = (sender as ToolStripMenuItem...ret = PlayerSdk.EasyPlayer_ShowOSD(channelID, fontInfo); (sender as ToolStripMenuItem...ret = PlayerSdk.EasyPlayer_ShowOSD(channelID, fontInfo, false); (sender as ToolStripMenuItem
System.Runtime.InteropServices Imports Microsoft.Office.Interop Public Class Form1 Private Sub ToolStripMenuItem1..._Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem1.Click...ToolStripProgressBar1.ForeColor = Color.Red ToolStripStatusLabel1.Text = "图片加载完成" End Sub Private Sub ToolStripMenuItem2..._Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
{ cmsOneRout = new ContextMenuStrip(); var tmiEditRoutStation = new ToolStripMenuItem...Owner"); cmsOneRout.Items.Add(tmiEditRoutStation); var changePermission = new ToolStripMenuItem...changePress_Click; cmsOneRout.Items.Add(changePermission); var tmiDel = new ToolStripMenuItem...var cmslv = new ContextMenuStrip(); var tmiEditRoutStation = new ToolStripMenuItem...tmiDelte_Click; cmslv.Items.Add(tmiDelte); var downloadFile = new ToolStripMenuItem
MenuStrip menuStrip = new MenuStrip(); menuStrip.Items.AddRange(new ToolStripItem[] { new ToolStripMenuItem...("文件"), new ToolStripMenuItem("编辑"), new ToolStripMenuItem("查看"), new ToolStripMenuItem...("工具"), new ToolStripMenuItem("帮助") }); // 创建一个新的ToolStrip控件并设置一些工具按钮 ToolStrip
XMLOperate(尾部附加),如下,可以读写配置文件: 2、将播放、截图、录像、OSD显示等功能做到右键菜单中,增加contextMenuStrip控件: 播放功能实现: private void 播放ToolStripMenuItem_Click...default: break; } var isPlay = false; if (this.播放ToolStripMenuItem.Text...{ PlayerSdk.EasyPlayer_SetFrameCache(channelID, 3); this.播放ToolStripMenuItem.Text...PlayerSdk.EasyPlayer_CloseStream(channelID); if (ret == 0) { this.播放ToolStripMenuItem.Text
private void 显示ToolStripMenuItem_Click(object sender, EventArgs e) { this.Visible...FormWindowState.Normal;//正常显示 this.ShowInTaskbar = false;//在任务栏中显示该窗口 } private void 退出ToolStripMenuItem_Click
) 9 { 10 InitializeComponent(); 11 } 12 13 private void Child1ToolStripMenuItem_Click...15 ShowSingleWindow(typeof(FrmChild1)); 16 } 17 18 private void Child2ToolStripMenuItem_Click
fm.MdiParent = this; fm.Show(); } private void 注销ToolStripMenuItem_Click...sender, EventArgs e) { Application.Exit(); } private void 货品信息新增ToolStripMenuItem_Click...fm.MdiParent = this; fm.Show(); } private void toolStripMenuItem1...fm.MdiParent = this; fm.Show(); } private void toolStripMenuItem3...; fm.textBox1.ReadOnly = true; fm.Show(); } private void 人员信息浏览ToolStripMenuItem_Click
e.Control.ContextMenuStrip = contextMSEdit; } 右键功能: private void 我选择的文字ToolStripMenuItem_Click
MDI的使用,是为了让一个父窗体拥有许多个子窗体,进行更加简单有效的操作 在父窗体new子窗体就行,记得一系列基本操作,你也可以通过生成函数和属性进行快速高效设置 private void 新建ToolStripMenuItem_Click...writingBoard.MdiParent = this; writingBoard.Show(); } private void 打开ToolStripMenuItem_Click...writingBoard.父窗体打开Open(writingBoard); writingBoard.Show(); } private void 退出ToolStripMenuItem_Click
函数如下: //新建 private void ToolStripMenuItem_newfile_Click(object sender, EventArgs e) { //定义一个变量接收子窗体...函数如下: //关闭窗体 private void ToolStripMenuItem_closefile_Click(object sender, EventArgs e) { //接收当前窗体...函数如下: //关闭全部窗体 private void ToolStripMenuItem_closeall_Click(object sender, EventArgs e) { //循环遍历当前已经打开的所有窗体的集合...函数如下: //退出 private void ToolStripMenuItem_quit_Click(object sender, EventArgs e) { this.Close();
(object sender, EventArgs e) { if (自动换行ToolStripMenuItem.Text == "☆自动换行")...{ textBox1.WordWrap = true; 自动换行ToolStripMenuItem.Text = "★取消自动换行";...} else if (自动换行ToolStripMenuItem.Text == "★取消自动换行") { textBox1....WordWrap = false; 自动换行ToolStripMenuItem.Text = "☆自动换行"; } }...private void 字体ToolStripMenuItem_Click(object sender, EventArgs e) { FontDialog
快捷菜单中的每一个菜单项(ToolStripMenuItem)都有自己的属性和事件 菜单项的主要属性和事件 属 性 说
领取专属 10元无门槛券
手把手带您无忧上云