why cannot i change the Text control's font ?

z_axis z_axis at 163.com
Fri Nov 9 06:36:03 PST 2007


setfont.handleEvent(codeText, DWT.Selection, delegate(Event e){
	Text txt = cast(Text)e.cData;
	Font oldFont = txt.getFont();
	FontDialog fontDialog = new FontDialog (shell);
	if(oldFont !is null)
		fontDialog.setFontList(oldFont.getFontData());
	FontData fontData = fontDialog.open ();
	if (fontData !is null) {
		Font newFont = new Font(display, fontData) ;
		txt.font = newFont;
		txt.setFont( newFont );
		if(oldFont !is null) oldFont.dispose();
	}
});

the code runs smoothly however the text control's font doesnot change !

-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/


More information about the Digitalmars-d-dwt mailing list