using System;
using System.Drawing;
using System.Windows.Forms;
using System.Resources;public class ButtonCtl : System.Windows.Forms.Form
{ private System.Windows.Forms.Button button1; }public ButtonCtl() : base()
{ InitializeComponent(); }
private void InitializeComponent()
{ System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ButtonCtl)); this.button1 = new System.Windows.Forms.Button(); this.Text = "按钮";
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(504, 381); button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
button1.Location = new System.Drawing.Point(32, 112);
button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
button1.Size = new System.Drawing.Size(136, 56);
button1.TabIndex = 5;
button1.Text = "TestButton";
button1.Click += new System.EventHandler(button1_Click);
button1.Image = (System.Drawing.Image)resources.GetObject("button1.Image");//这句是什么意思 this.Controls.Add(button1);
} /// <summary>
/// 处理 button1.Click
/// </summary>
private void button1_Click(object sender, EventArgs e) {
MessageBox.Show("您已按下测试按钮") ;
} /// <summary>
/// 该应用程序的主入口点。
/// </summary>
[STAThread]
public static void Main(string[] args) {
Application.Run(new ButtonCtl());
}}
我的问题是button1.Image = (System.Drawing.Image)resources.GetObject("button1.Image");这句是什么意思,我理解为:取得button1.Image资源,再赋给button1.Image我看了MSDN讲的ResourceManage没太明白什么意思,明朋友帮望解决一下
using System.Drawing;
using System.Windows.Forms;
using System.Resources;public class ButtonCtl : System.Windows.Forms.Form
{ private System.Windows.Forms.Button button1; }public ButtonCtl() : base()
{ InitializeComponent(); }
private void InitializeComponent()
{ System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ButtonCtl)); this.button1 = new System.Windows.Forms.Button(); this.Text = "按钮";
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(504, 381); button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
button1.Location = new System.Drawing.Point(32, 112);
button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
button1.Size = new System.Drawing.Size(136, 56);
button1.TabIndex = 5;
button1.Text = "TestButton";
button1.Click += new System.EventHandler(button1_Click);
button1.Image = (System.Drawing.Image)resources.GetObject("button1.Image");//这句是什么意思 this.Controls.Add(button1);
} /// <summary>
/// 处理 button1.Click
/// </summary>
private void button1_Click(object sender, EventArgs e) {
MessageBox.Show("您已按下测试按钮") ;
} /// <summary>
/// 该应用程序的主入口点。
/// </summary>
[STAThread]
public static void Main(string[] args) {
Application.Run(new ButtonCtl());
}}
我的问题是button1.Image = (System.Drawing.Image)resources.GetObject("button1.Image");这句是什么意思,我理解为:取得button1.Image资源,再赋给button1.Image我看了MSDN讲的ResourceManage没太明白什么意思,明朋友帮望解决一下
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货