/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button1.Location = new System.Drawing.Point(560, 320);
this.button1.Name = "button1";
this.button1.TabIndex = 2;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
}
private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("ok");
}
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button1.Location = new System.Drawing.Point(560, 320);
this.button1.Name = "button1";
this.button1.TabIndex = 2;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
}
private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("ok");
}
解决方案 »
- Winform 子窗体访问父窗体控件
- C#数组使用方法请教
- 请教一个基础的LINQ问题,非常感谢
- excel操作改为系统操作中出现的问题?
- 连接Sql Server的时候提示“System.IO.FileNotFoundException: 找不到指定的模块。”
- 怎么在win2003里配置开发环境呀 ...?
- 关于传参数的问题
- datagridview删除某行之后行dataGridView1.CurrentRow.Index问题[精华]
- 大哥大姐们,帮我实现两个TreeView控件上节点之间的画线,谢谢了!
- 关于跨Form调用子程的问题!
- 如何把.CS文件变成.DLL文件,我用Nunit2.2的时候要求测试的是DLL文件,很是着急,各位帮帮忙,感激不尽!
- 如何取得一颗树所有节点的值
using System.Runtime.InteropServices;
接下来是代码:
[ DllImport("user32") ]
public static extern System.IntPtr GetDC(System.IntPtr dc);
System.Drawing.Graphics g; //画图板
private void button1_Click(object sender, System.EventArgs e)
{
//取得句柄
g=Graphics.FromHdc(GetDC(System.IntPtr.Zero));
// Create string to draw.
String drawString = "显示一段文本";
// Create font and brush.
Font drawFont = new Font("Arial", 32);
SolidBrush drawBrush = new SolidBrush(Color.Red);
// Create point for upper-left corner of drawing.
float x = 150.0F;
float y = 50.0F;
// Set format of string.
StringFormat drawFormat = new StringFormat();
drawFormat.FormatFlags = StringFormatFlags.DirectionVertical;
// Draw string to screen.
g.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
}
至于"事件",你设计时,双击产生的就是事件!
private void 实现事件的处理(object sender, 自定义事件类 e)当然,需要将事件的委托加入类似this.button1.Click += new System.EventHandler(this.button1_Click);的语句......
TCE、LCE??