最近研究了一下NeoSwiff的SDK.能写出flash的C#语法编译器,太强了!! 他的独立IDE安装文件只有3m. 怀疑是不是有公开的C# 语法分析器...... 作者对.net framework很熟悉.虽然它的GDI+与.net略有不同. 我用一个ImageButton扩展System.Windows.Forms.Button控件小试了一下 //ImageButton.ccs using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; namespace Component { public class ImageButton : Button { private Image image = null; private String imagename = ""; public ImageButton() { InitializeComponent(); } private void InitializeComponent() { this.Size = new Size(25,25); } public String ImageName { get { return imagename;} set { imagename = value;} } protected override void OnPaint(PaintEventArgs e) { this.Visual.Clear(); this.Visual.ClearStroke(); Visual v = new Visual(this.Visual); image = new Image(v,imagename); v.X = (Width - v.Width)/2; v.Y = (Height - v.Height)/2; base.OnPaint(e); } } } //Form1.ccs using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; namespace Component { public class Form1 : System.Windows.Forms.Form { private ImageButton button1 = null; private Label lbl = null; public Form1() { InitializeComponent(); // // TODO: Add constructor logic here // this.BackColor = Color.WhiteSmoke; } private void InitializeComponent() { this.button1 = new ImageButton(); this.lbl = new Label(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(50, 50); this.button1.ImageName = "book"; this.button1.Click += new EventHandler(this.button1_Click); // // lbl // this.lbl.Location = new Point(40,100); this.lbl.Visible = false; this.lbl.Text = "Appear!!"; // // Form1 // this.Controls.Add(this.button1); this.Controls.Add(this.lbl); this.Text = "Form1"; this.ResumeLayout(false); } public void button1_Click(object sender, EventArgs e) { this.lbl.Visible = ! this.lbl.Visible; } static void Main() { // // TODO: Add application logic here // Application.Run( new Form1() ); } } } 
|