English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

就是msgbox上的字體,要怎麼改?
順便問一下,如果有兩行的話,要怎麼置中,謝謝。

2006-07-20 15:27:53 · 2 個解答 · 發問者 Y7759699399 2 in 電腦與網際網路 程式設計

2 個解答

'建議自己做1個會比較快,否則要動用到API,以下程式若要註解會超過2k字,只好在重要的地方註解(置中的部分寫在意見欄)'以下在表單Private Sub Command1_Click() '更改字體    Call EHK    Ms = "WJS"    MsgBox "知識+", , Ms    Call UHKEnd Sub'以下在模組Declare Function SetWindowsHookEx& Lib "user32" Alias "SetWindowsHookExA" (ByVal H&, ByVal P&, ByVal M&, ByVal T&)Declare Function UnhookWindowsHookEx& Lib "user32" (ByVal H&)Declare Function CallNextHookEx& Lib "user32" (ByVal H&, ByVal C&, ByVal W&, L As Any)Declare Sub GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal H&, ByVal S$, ByVal C&)Declare Sub PostMessage Lib "user32" Alias "PostMessageA" (ByVal H&, ByVal M&, ByVal W&, ByVal L&)Declare Function CreateFont& Lib "gdi32" Alias "CreateFontA" (ByVal H&, ByVal W&, ByVal E&, ByVal O&, ByVal B&, ByVal I As Boolean, ByVal U As Boolean, ByVal D As Boolean, ByVal G&, ByVal F&, ByVal C&, ByVal Q&, ByValY&, ByVal S$)Declare Function FindWindowEx& Lib "user32" Alias "FindWindowExA" (ByVal H&, ByVal G&, ByVal L$, ByVal S$)Public hH&, Ms$Sub EHK()    If hH = 0 Then hH = SetWindowsHookEx(5, AddressOf HoP, 0, App.ThreadID)End SubSub UHK()    If hH Then UnhookWindowsHookEx hH: hH = 0End SubFunction HoP&(ByVal C&, ByVal W&, ByVal L&)    If C < 0 Then           HoP = CallNextHookEx(hH, C, W, L)    ElseIf C = 5 Then           Dim S$, N&, F&, Sz&, B&, I As Boolean, U As Boolean, D As Boolean                      S = String(255, 0)           GetWindowText W, S, 255           S = Replace(S, Chr(0), "")           If S = Ms Then              N = FindWindowEx(W, 0, "Static", vbNullString)              Sz = 14 '大小              B = 900 '粗體(細體 B=0)              I = True '斜體              U = True '底線              D = True '刪除線              S = "新細明體" '名稱              F = CreateFont(Sz, 0, 0, 0, B, I, U, D, 136, 0, 0, 0, 0, S)              PostMessage N, 48, F, 0           End If     End If     HoP = 0End Function

2006-07-21 01:44:04 補充:
Private Sub Command2_Click()
Dim A$, B$

A = "ABCDEFG"
B = "HIJK"
Do
 B = " " & B & " "
Loop Until TextWidth(A) <= TextWidth(B)
MsgBox A & vbCrLf & B
End Sub

2006-07-20 21:43:03 · answer #1 · answered by W.J.S. 7 · 0 0

哈哈 看了之後 我突然有個idea 那就是 用label或text 似乎也能做出msgbox的對話視窗的功能 當然這是另一種想法啦^^y

2006-11-01 03:24:42 · answer #2 · answered by hg 1 · 0 0

fedest.com, questions and answers