掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
フォントスタイルの制御 (ID:24957)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
今、こんな感じでFontDialogとComboBoxでリンクさせてるんですが、もうちょっとスマートな記述ないでしょうか? //FontDialog側 procedure TfrmWordStyle.btnSubSetClick(Sender: TObject); begin if dlgFont.Execute then if (fsItalic in dlgFont.Font.Style) then if (fsBold in dlgFont.Font.Style) then cbxFontStyle.ItemIndex := 3 else cbxFontStyle.ItemIndex := 1 else if (fsBold in dlgFont.Font.Style) then cbxFontStyle.ItemIndex := 2 else cbxFontStyle.ItemIndex := 0; end; //ComboBox側 procedure TfrmWordStyle.cbxFontStyleChange(Sender: TObject); begin case cbxFontStyle.ItemIndex of 1:begin dlgFont.Font.Style := dlgFont.Font.Style + [fsItalic]; dlgFont.Font.Style := dlgFont.Font.Style - [fsBold]; end; 2:begin dlgFont.Font.Style := dlgFont.Font.Style - [fsItalic]; dlgFont.Font.Style := dlgFont.Font.Style + [fsBold]; end; 3:dlgFont.Font.Style := dlgFont.Font.Style + [fsItalic,fsBold]; else dlgFont.Font.Style := dlgFont.Font.Style - [fsItalic,fsBold; end; end; {*ComboBoxのアイテム*} 0:標準 1:斜体 2:太字 3:太字 斜体
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.