c# winform 获取ToolStripMenuItem的SourceControl

var s = sender as ToolStripMenuItem;
var m = s.Owner as ContextMenuStrip;
m.SourceControl.BackColor = cf.Color;

原文地址:https://www.cnblogs.com/jephone/p/11992797.html

时间: 2024-08-26 15:27:41

c# winform 获取ToolStripMenuItem的SourceControl的相关文章

C# WinForm获取当前路径汇总

Winform获取应用程序的当前路径的方法集合,具体如下,值得收藏//获取当前进程的完整路径,包含文件名(进程名).string str = this.GetType().Assembly.Location; result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)//获取新的Process 组件并将其与当前活动的进程关联的主模块的完整路径,包含文件名(进程名).string str = System.Diagnostics.Process.GetCurr

c# winform 获取当前程序运行根目录,winform 打开程序运行的文件夹

// 获取程序的基目录. System.AppDomain.CurrentDomain.BaseDirectory // 获取模块的完整路径. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName // 获取和设置当前目录(该进程从中启动的目录)的完全限定目录. System.Environment.CurrentDirectory // 获取应用程序的当前工作目录. System.IO.Directory.GetC

C# Winform 获取天气情况

WebServices(http://www.webxml.com.cn/WebServices/WeatherWebService.asmx)来实现天气预报,该天气预报 Web 服务,数据来源于中国气象局 http://www.cma.gov.cn/ ,数据每2.5小时左右自动更新一次,准确可靠.包括 340 多个中国主要城市和 60 多个国外主要城市三日内的天气预报数据. private void buttonWeather_Click_1(object sender, EventArgs

C#.net Winform获取文件路径

C# 获取路径 string str1 =Process.GetCurrentProcess().MainModule.FileName;//获得当前执行的exe的文件名.string str2=Environment.CurrentDirectory;//获取和设置当前目录的完全限定路径.string str3=Directory.GetCurrentDirectory();//获取应用程序的当前工作目录.string str4=AppDomain.CurrentDomain.BaseDire

(转)C# WinForm获取当前路径汇总

Winform获取应用程序的当前路径的方法集合,具体如下,值得收藏本文来源 :http://www.cnblogs.com/greatverve/archive/2011/12/15/winform-path.html //获取当前进程的完整路径,包含文件名(进程名).string str = this.GetType().Assembly.Location;result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名) //获取新的Process 组件并将其与

Winform获取应用程序的当前路径的方法集合(转)

Winform获取应用程序的当前路径的方法集合,具体如下,值得收藏 //获取当前进程的完整路径,包含文件名(进程名). string str = this.GetType().Assembly.Location; result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名) //获取新的Process 组件并将其与当前活动的进程关联的主模块的完整路径,包含文件名(进程名). string str = System.Diagnostics.Process.Get

C#WinForm获取屏幕大小

当前的屏幕除任务栏外的工作域大小 this.Width = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width; this.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height; 当前的屏幕包括任务栏的工作域大小 this.Width=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;

收集:C# WinForm获取当前路径汇总

Winform获取应用程序的当前路径的方法集合,具体如下,值得收藏 //获取当前进程的完整路径,包含文件名(进程名). string str = this.GetType().Assembly.Location; result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名) //获取新的Process 组件并将其与当前活动的进程关联的主模块的完整路径,包含文件名(进程名). string str = System.Diagnostics.Process.Get

Winform 获取当前单击的控件名称 和 向窗体添加控件

Winform如何获取当前单击的控件名称,比如有100个Button 和一个button_Click()的按钮事件 ,分别点击不同按钮后显示所点击的按钮名称?private void button_Click(object sender, EventArgs e) { Button button = (Button)sender; MessageBox.Show(button.Name); } 然后将要实现的按钮绑定该button_Click事件OK. 向窗体添加控件,比如添加一个Button按