选择显示字体大小

一个多文档界面的应用程序

namespace microsoft.samples.winforms.cs.mdi {
using system;
using system.componentmodel;
using system.drawing;
using system.winforms;

public class mainform : system.winforms.form {
private system.componentmodel.container components;
private system.winforms.mainmenu mainmenu;
private system.winforms.statusbar statusbar1;

private int windowcount = 0 ;

public mainform() {

// required by the windows forms designer
initializecomponent();

// todo: add any constructor code after initializecomponent call

//setup mdi stuff
this.ismdicontainer = true;
this.mdichildactivate += new eventhandler(this.mdichildactivated);

//add file menu
menuitem mifile = mainmenu.menuitems.add("&file");
mifile.mergeorder=0;
mifile.mergetype = menumerge.mergeitems;

menuitem miadddoc = new menuitem("&add document", new eventhandler(this.fileadd_clicked), shortcut.ctrla);
miadddoc.mergeorder=100;

menuitem miexit = new menuitem("e&xit", new eventhandler(this.fileexit_clicked), shortcut.ctrlx);
miexit.mergeorder=110;

mifile.menuitems.add(miadddoc);
mifile.menuitems.add("-"); // gives us a seperator
mifile.menuitems.add(miexit);

//add window menu
menuitem miwindow = mainmenu.menuitems.add("&window");
miwindow.mergeorder = 10;
miwindow.menuitems.add("&cascade", new eventhandler(this.windowcascade_clicked));
miwindow.menuitems.add("tile &horizontal", new eventhandler(this.windowtileh_clicked));
miwindow.menuitems.add("tile &vertical", new eventhandler(this.windowtilev_clicked));
miwindow.mdilist = true ; //adds the mdi window list to the bottom of the menu

adddocument(); //add an initial doc
}


//add a document
private void adddocument() {
windowcount++ ;
document doc = new document("document " + windowcount);
doc.mdiparent = this;
doc.show();
}


//file->add menu item handler
protected void fileadd_clicked(object sender, system.eventargs e) {
adddocument() ;
}


//file->exit menu item handler
protected void fileexit_clicked(object sender, system.eventargs e) {
this.close();
}


//one of the mdi child windows has been activated
protected void mdichildactivated(object sender, system.eventargs e) {
if (null == this.activemdichild) {
statusbar1.text = "";
} else {
statusbar1.text = this.activemdichild.text;
}
}

//window->cascade menu item handler
protected void windowcascade_clicked(object sender, system.eventargs e) {
this.layoutmdi(mdilayout.cascade);
}


//window->tile horizontally menu item handler
protected void windowtileh_clicked(object sender, system.eventargs e) {
this.layoutmdi(mdilayout.tilehorizontal);
}


//window->tile vertically menu item handler
protected void windowtilev_clicked(object sender, system.eventargs e) {
this.layoutmdi(mdilayout.tilevertical);
}


public override void dispose() {
base.dispose();
components.dispose();
}

protected void initializecomponent() {

this.components = new system.componentmodel.container();
this.mainmenu = new system.winforms.mainmenu();
this.statusbar1 = new system.winforms.statusbar();

this.autoscalebasesize = new system.drawing.size(5, 13);
this.text = "mdi example";
this.menu = mainmenu;
this.clientsize = new system.drawing.size(450, 200);

statusbar1.backcolor = system.drawing.systemcolors.control;
statusbar1.size = new system.drawing.size(496, 20);
statusbar1.tabindex = 1;
statusbar1.text = "";
statusbar1.location = new system.drawing.point(0, 273);

this.controls.add(statusbar1);
}


public static void main(string[] args) {
application.run(new mainform());
}

}
}


作者:jspfuns()

  


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons