欢迎光临
我们一直在努力

NeoSwiff的图像按钮-.NET教程,报表/图形/Office

建站超值云服务器,限时71元/月

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

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » NeoSwiff的图像按钮-.NET教程,报表/图形/Office
分享到: 更多 (0)