?? fonttest.xml
字號:
<?xml version="1.0"?><!-- A bit more complicated test app. The app includes a few different components that changes the font of a label--><application> <window caption="Font Test" width="400" height="200" centered="true"/> <resources> <script src="SolidColorIcon.js"/> <script><![CDATA[function addItemsToCombo(oCombo, aText) { for (var i = 0; i < aText.length; i++) { oCombo.add( new BiComboBoxItem( String(aText[i]) ) ); }}function FontTest() { var win = application.getWindow(); var faceCombo = new BiComboBox; addItemsToCombo(faceCombo, ["Arial", "Verdana", "Tahoma", "Courier New", "Times", "Comic Sans MS", "MS Sans Serif", "Trebuchet MS"].sort()); var cs = faceCombo.getChildren(); for (var i = 0; i < cs.length; i++) cs[i].setFont( new BiFont(null, cs[i].getText()) ); var sizeCombo = new BiComboBox; addItemsToCombo(sizeCombo, [6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]); sizeCombo.setWidth(50); cs = sizeCombo.getChildren(); for (var i = 0; i < cs.length; i++) cs[i].setAlign("right"); var colorCombo = new BiComboBox; addItemsToCombo(colorCombo, ["Black", "Green", "Silver", "Lime", "Gray", "Olive", "White", "Yellow", "Maroon", "Navy", "Red", "Blue", "Purple", "Teal", "Fuchsia", "Aqua"].sort() ); var cs = colorCombo.getChildren(); for (var i = 0; i < cs.length; i++) cs[i].setIcon( new SolidColorIcon(cs[i].getText(), 15, 15) ); win.add(faceCombo); win.add(sizeCombo); win.add(colorCombo); faceCombo.findStringExact("Tahoma").setSelected(true); sizeCombo.findStringExact("11").setSelected(true); colorCombo.findStringExact("Black").setSelected(true); faceCombo.setLocation(5, 5); sizeCombo.setLocation(faceCombo.getLeft() + faceCombo.getWidth() + 5, 5); colorCombo.setLocation(sizeCombo.getLeft() + sizeCombo.getWidth() + 5, 5); var boldCheck = new BiCheckBox("Bold"); var italicCheck = new BiCheckBox("Italic"); var underlineCheck = new BiCheckBox("Underline"); var strikeout = new BiCheckBox("Strikeout"); win.add(boldCheck); win.add(italicCheck); win.add(underlineCheck); win.add(strikeout); var top = faceCombo.getTop() + faceCombo.getHeight() + 5; boldCheck.setLocation(5, top); italicCheck.setLocation(boldCheck.getLeft() + boldCheck.getWidth() + 5, top); underlineCheck.setLocation(italicCheck.getLeft() + italicCheck.getWidth() + 5, top); strikeout.setLocation(underlineCheck.getLeft() + underlineCheck.getWidth() + 5, top); var label = new BiLabel("The quick brown fox jumps over the lazy dog. 1234567890"); label.setPadding(2); label.setWrap(true); label.setBackColor("White"); label.setForeColor("Black"); label.setBorder( new BiBorder(1, "solid", "ThreeDShadow") ); win.add(label); label.setLocation(5, boldCheck.getTop() + boldCheck.getHeight() + 5); label.setRight(5); label.setBottom(5); this.label = label; this.sizeCombo = sizeCombo; this.faceCombo = faceCombo; this.colorCombo = colorCombo; this.boldCheck = boldCheck; this.italicCheck = italicCheck; this.underlineCheck = underlineCheck; this.strikeout = strikeout; faceCombo.addEventListener("change", this.updateFont, this); sizeCombo.addEventListener("change", this.updateFont, this); colorCombo.addEventListener("change", this.updateFont, this); boldCheck.addEventListener("change", this.updateFont, this); italicCheck.addEventListener("change", this.updateFont, this); underlineCheck.addEventListener("change", this.updateFont, this); strikeout.addEventListener("change", this.updateFont, this);}FontTest.prototype.updateFont = function () { var f = new BiFont(); if ( this.faceCombo.getSelectedItem() ) f.setName(this.faceCombo.getSelectedItem().getText()); if ( this.sizeCombo.getSelectedItem() ) f.setSize(this.sizeCombo.getSelectedItem().getText()); if ( this.colorCombo.getSelectedItem() ) this.label.setForeColor(this.colorCombo.getSelectedItem().getText()); f.setBold(this.boldCheck.getChecked()); f.setItalic(this.italicCheck.getChecked()); f.setUnderline(this.underlineCheck.getChecked()); f.setStrikeout(this.strikeout.getChecked()); this.label.setFont(f);};FontTest.main = function () { new FontTest(); }; ]]></script> </resources></application>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -