中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > .NET > 临时文章
NeoSwiff的图像按钮
作者:未知 时间:2005-07-27 21:45 出处:CSDN 责编:chinaitpower
              摘要:NeoSwiff的图像按钮

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


关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有