主婦と.NETと犬のぶろぐ

奥様 と プログラム と お犬様 の 楽しい日常

目次

Blog 利用状況

ニュース

書庫

日記カテゴリ

FontDialog(System.Windows.Forms.FontDialog)

既定値をわすれないようにメモろうシリーズその2です。
でも、FontDialog って業務ではあんまり使った事がないです。
っていうか全然ないかもしれません。
自分のホームページの デザインパターン の実装に時によく使ったかもですね。

AllowSimulations についてなんですが、設定値を変えて見ても何が変わったのか
よく解らないんです。GDI、フォント、シミュレーション、等の単語の意味は解るのですが...
識者の方、教えてください~

■参考文献
FontDialog コンポーネント (Windows フォーム)
FontDialog クラス

■実行画像
見る間でも無いですが、実行したところ
FontDialog 実行したところ
FontDialog
存在しないフォントを指定した時のエラーメッセージ
FontDialog エラーメッセージ

Public Class FontDialogTest

Private Sub FontDialogTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load With Me.FontDialog1 ' 規定値に戻す .Reset() ' 文字セットのコンボボックスの値を変更可能か否か(既定:True) .AllowScriptChange = True ' GDI におけるフォント表示をシミュレーションできるか否か(既定:True) .AllowSimulations = True ' ベクタフォントを選択できるか否か(既定:True) ' ベクタフォント(デジタルアイテム用語集) ' http://kw.allabout.co.jp/glossary/g_digital/w003222.htm .AllowVectorFonts = True ' 縦書きフォントを表示するか否か(既定:True) ' @ が頭についたフォント .AllowVerticalFonts = True ' (サンプルに表示する)文字の色(既定:Black) ' ShowColor = True の場合、色コンボボックスで予め選択されている色となる .Color = Me.Label1.ForeColor ' 等幅フォント(固定ピッチフォント)のみにするか否か(既定:False) .FixedPitchOnly = False ' ダイアログ上で規定のフォントを指定する場合(既定:MS UI Gothic, 9pt) .Font = Me.Label1.Font ' 存在しないフォントを選択した場合にエラーメッセージを出すか否か(既定:False) .FontMustExist = True ' ポイントの最大値(既定:0) .MaxSize = 72 ' ポイントの最小値(既定:0) ' 今回の設定値の場合、9 ポイント以上 72 ポイント以下を選択させる。 .MinSize = 9 ' 非 OEM 文字セット、Symbol 文字セット、および ANSI 文字セットすべてのフォントを選択できるか否か(既定:False) ' 文字セット:http://e-words.jp/w/E69687E5AD97E382BBE38383E38388.html .ScriptsOnly = True ' 適用ボタンを表示するか否か(既定:False) ' FontDialog.Apply イベントがハンドリングする .ShowApply = True ' 色の選択を行うコンボボックスを表示するか否か(既定:False) .ShowColor = True ' 取り消し線、下線、およびテキストの色のオプションを設定するコントロールをダイアログ ボックスに表示するか否か(既定:True) .ShowEffects = True ' [?] ボタンを表示するか否か(既定:False) ' FontDialog.HelpRequest イベントがハンドリングする .ShowHelp = True End With End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If System.Windows.Forms.DialogResult.OK = _ Me.FontDialog1.ShowDialog(Me) Then Me.SetFontAndColor() End If End Sub
Private Sub FontDialog1_Apply(ByVal sender As Object, ByVal e As System.EventArgs) Handles FontDialog1.Apply MessageBox.Show("適用します。") Me.SetFontAndColor() End Sub
Private Sub FontDialog1_HelpRequest(ByVal sender As Object, ByVal e As System.EventArgs) Handles FontDialog1.HelpRequest MessageBox.Show("好きなフォントを選んでください。") End Sub
Private Sub SetFontAndColor() Me.Label1.Font = Me.FontDialog1.Font Me.Label1.ForeColor = Me.FontDialog1.Color End Sub End Class

投稿日時 : 2007年1月22日 10:16

Feedback

# re: FontDialog(System.Windows.Forms.FontDialog) 2007/01/22 13:07 シャノン

> AllowSimulations についてなんですが、設定値を変えて見ても何が変わったのかよく解らないんです。

何なんでしょうネ。
このプロパティを false にすると、内部で呼び出している Win32 API の ChooseFont 関数に渡す CHOOSEFONT 構造体の Flags メンバに CF_NOSIMULATIONS が設定されることまではわかりました。
が、Win32 SDK の CF_NOSIMULATIONS の説明も AllowSimulations の説明と大差なく、結局何をしているんだか分りません。

# re: FontDialog(System.Windows.Forms.FontDialog) 2007/01/22 13:54 シャノン

わかったっぽい。
AllowSimulations が true だと、すべてのフォントで「標準」「太字」「斜体」「太字 斜体」が選べますが、false だと、フォントによっては選べないものがあります。
これは、C:\Windows\Fonts 以下に、太字用フォントとか斜体用フォントがインストールされているかどうかによります。
AllowSimulations を true にすると、各スタイルのフォントがインストールされていなくても、GDIがそれらスタイルをシミュレートする、ということのようです。

# re: FontDialog(System.Windows.Forms.FontDialog) 2007/01/22 16:14 なおこ(・∀・)

>> シャノンさん
おーっ確かに!
AllowSimulations = False にして、
C:\Windows\Fonts の中身を見ながら、
Verdana と MS ゴシック とかで実行時の違いを比べてみれば一目瞭然でした。

ありがとうございます~。

# re: FontDialog(System.Windows.Forms.FontDialog) 2007/01/22 17:13 επιστημη

わんくま同盟っていろんな畑のおーそりちが集結してて、すなおに"すげー"と思いまつ。

# re: FontDialog(System.Windows.Forms.FontDialog) 2007/01/22 20:03 なおこ(・∀・)

Authority
http://dictionary.goo.ne.jp/search.php?MT=Authority&search_history=&kind=ej&kwassist=0&mode=0&ej.x=22&ej.y=13

>> えぴさん
うーむ。私は違うかもですが、確かにおーそりちがたくさんいらっしゃいますね~

# 渡辺利香さん 2007/01/28 11:17 39歳です

自分でも分かっているほど
淫乱な熟女なのですがコレは
もう我慢する事はできなく
ていつでもセックスが出来
ないとうずうずイライラし
てきます。私のイライラを
止めてくれませんか?http://www.gameyoou.com

# TaqvBdARpxgDBbP 2014/08/28 2:45 http://crorkz.com/

y9q297 I like what you guys tend to be up too. This sort of clever work and exposure! Keep up the excellent works guys I've included you guys to blogroll.

# Appreciation to my father who told me regarding this webpage, this website is truly amazing. 2018/09/27 19:07 Appreciation to my father who told me regarding th

Appreciation to my father who told me regarding this webpage,
this website is truly amazing.

# I was very happy to uncover this page. I wanted to thank you for ones time for this fantastic read!! I definitely savored every little bit of it and I have you saved to fav to look at new things in your website. 2018/10/01 15:45 I was very happy to uncover this page. I wanted to

I was very happy to uncover this page. I wanted to thank
you for ones time for this fantastic read!! I definitely savored every little
bit of it and I have you saved to fav to look at new things in your website.

# This article provides clear idea in support of the new people of blogging, that actually how to do blogging. 2018/10/29 20:34 This article provides clear idea in support of th

This article provides clear idea in support of the new people of blogging, that actually how
to do blogging.

# Have you ever thought about creating an e-book or guest authoring on other websites? I have a blog centered on the same subjects you discuss and would really like to have you share some stories/information. I know my visitors would appreciate your work. 2018/11/11 15:25 Have you ever thought about creating an e-book or

Have you ever thought about creating an e-book or guest authoring
on other websites? I have a blog centered on the same subjects you discuss and
would really like to have you share some stories/information. I
know my visitors would appreciate your work. If you are even remotely interested, feel free to send me an e mail.

# You really make it seem so easy with your presentation but I find this matter to be actually something that I think I would never understand. It seems too complicated and extremely broad for me. I'm looking forward for your next post, I will try to get 2018/12/06 21:55 You really make it seem so easy with your presenta

You really make it seem so easy with your presentation but I find this matter to be actually something that I think I would never understand.
It seems too complicated and extremely broad for me. I'm looking forward for your next post,
I will try to get the hang of it!

タイトル
名前
Url
コメント