Neoswiff image button

xiaoxiao2021-03-05  20

Recently studied the SDK of Neoswiff. I can write Flash's C # syntax compiler, too strong !! His independent IDE installation file is only 3m. Suspected is an open C # grammar analyzer ... .NET Framework is very familiar. Although its GDI is slightly different. I use an ImageButton extension system.Windows.Forms.Button control Try.

//Imagebutton.ccs using system; using system.collections; using system.componentmodel; using system.windows.form;

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 ( image = new image (v, imagename); vx = (width - v.width) / 2; VY = (Height - v.Height) / 2; base.onpaint (e);}}

}

//Form1.ccs using system; using system.drawing; using system.ComponentModel; using system.windows.forms;

Namespace Component {public class form1: system.windows.forms.form = 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);

转载请注明原文地址:https://www.9cbs.com/read-32352.html

New Post(0)