最近研究了一下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() );
}
}
}