by kwn » 2007年8月06日(月) 19:55
コードはこのようになっています。
[ここをクリックすると内容が表示されます] [ここをクリックすると非表示にします]コード: 全て選択
Dim cf As CHOOSEFONT
Dim lf As LOGFONT
Dim hFontTextBox As HFONT
With cf
.lStructSize = Len(cf)
.hwndOwner = hMainWnd
.lpLogFont = VarPtr(lf)
.Flags = CF_SCREENFONTS Or CF_NOVERTFONTS
End With
If ChooseFont(cf) <> FALSE Then
Dim hFont As HFONT
hFont = CreateFontIndirect(lf)
If hFont = NULL Then
MsgBox hMainWnd, "フォントの作成に失敗", "", MB_ICONEXCLAMATION
Else
DeleteObject(hFontTextBox)
hFontTextBox = hFont
SendDlgItemMessage(hMainWnd, EditBox1, WM_SETFONT, hFontTextBox As WPARAM, TRUE)
End If
End If
コードはこのようになっています。
[hide][code]
Dim cf As CHOOSEFONT
Dim lf As LOGFONT
Dim hFontTextBox As HFONT
With cf
.lStructSize = Len(cf)
.hwndOwner = hMainWnd
.lpLogFont = VarPtr(lf)
.Flags = CF_SCREENFONTS Or CF_NOVERTFONTS
End With
If ChooseFont(cf) <> FALSE Then
Dim hFont As HFONT
hFont = CreateFontIndirect(lf)
If hFont = NULL Then
MsgBox hMainWnd, "フォントの作成に失敗", "", MB_ICONEXCLAMATION
Else
DeleteObject(hFontTextBox)
hFontTextBox = hFont
SendDlgItemMessage(hMainWnd, EditBox1, WM_SETFONT, hFontTextBox As WPARAM, TRUE)
End If
End If
[/code][/hide]