1. 程式人生 > >DuiLib筆記之設置文本字體

DuiLib筆記之設置文本字體

edi des fault 筆記 erl nim str 類型 ali

設置文本字體要用到Font

它的常用屬性如下

id

用於標識Font,類型:INT

name

用於指定字體名稱,類型:STRING

size

用於指定字體大小,類型:INT

bold

用於指定是否加粗,類型:BOOL,默認值為false

underline

用於指定是否添加下劃線,類型:BOOL,默認值為false

italic

用於指定是否將字體設為斜體,類型:BOOL,默認值為false

default

用於指定是否將該Font設為全局默認字體,類型:BOOL,默認值為false

註意

Font必須置於根元素Window內

示例

<?xml version="1.0" encoding="utf-8"
?> <Window size="350,250" caption="0,0,0,35" sizebox="6,6,6,6" mininfo="300,200"> <Font id="0" name="宋體" size="17" bold="true" underline="true" italic="true" /> <!--窗口背景色#FFFFFFFF--> <VerticalLayout bkcolor="#FFFFFFFF"> <!--標題欄高度35,背景色#FF12B7F5--> <HorizontalLayout
height="35" bkcolor="#FF12B7F5"> <Control bkimage="file=‘Icons/wolf_white_55x30.png‘ source=‘0,0,55,30‘ dest=‘0,3,55,33‘" float="true" pos="15,3,70,33" /> <!--標題DuiLib演示--> <Label text="DuiLib演示" textcolor="#FFFFFFFF" font="0" float="true" pos="75,0,200,35" /> <!--
空白區--> <Control /> <HorizontalLayout width="90"> <!--最小化、最大化等按鈕--> <Button name="minbtn" float="true" pos="5,8,25,28" tooltip="最小化" normalimage="file=‘Icons/minimize/minimize_white_20x20.png‘" hotimage="file=‘Icons/minimize/minimize_red_20x20.png‘" pushedimage="file=‘Icons/minimize/minimize_black_20x20.png‘" /> <Button name="maxbtn" float="true" pos="35,8,55,28" tooltip="最大化" normalimage="file=‘Icons/maximize/maximize_white_20x20.png‘" hotimage="file=‘Icons/maximize/maximize_red_20x20.png‘" pushedimage="file=‘Icons/maximize/maximize_black_20x20.png‘" /> <Button name="restorebtn" float="true" pos="35,8,55,28" tooltip="還原" visible="false" normalimage="file=‘Icons/restore_down/restore_down_white_20x20.png‘" hotimage="file=‘Icons/restore_down/restore_down_red_20x20.png‘" pushedimage="file=‘Icons/restore_down/restore_down_black_20x20.png‘" /> <Button name="closebtn" float="true" pos="65,8,85,28" tooltip="關閉" normalimage="file=‘Icons/close/close_white_20x20.png‘" hotimage="file=‘Icons/close/close_red_20x20.png‘" pushedimage="file=‘Icons/close/close_black_20x20.png‘" /> </HorizontalLayout> </HorizontalLayout> <!--居中的按鈕--> <Button name="button" text="自由不是免費的。" pos="-65,-15,65,15" float="0.5,0.5,0.5,0.5" /> </VerticalLayout> </Window>

DuiLib筆記之設置文本字體