·首页 ·asp ·.net ·php ·JSP ·CGI ·数据库 ·网页设计 ·网管专栏 ·XML ·工具软件 ·办公软件 ·操作系统 ·程序设计 ·LINUX 
  当前位置: 普克>>计算机教程>>.net>>报表/图形/Office>>NeoSwiff的图像按钮
flash视频教学

photoshop专题

asp.net专题

office专题

NeoSwiff的图像按钮


报表/图形/Office 发表时间:2006-4-8 字体:  返回

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




上一篇:DirectX9 3D 快速上手 5
下一篇:.NET开发AutoCAD指南(一)

普克创业投资网刊载此文不代表同意其说法或描述,仅为提供更多信息。
在百度中搜索NeoSwiff的图像按钮的相关内容]   [在狗狗中搜索NeoSwiff的图像按钮的相关内容]
Copyright @ 2006 PUPK.COM 普克创业投资网 版权所有
 建议使用1024*768以达到最好的浏览效果