Private Sub Command2_Click() Dim nDC As Long
nDC = GetDC(TreeView1.hwnd)
Call SetBkMode(nDC, TRANSPARENT)
’如何设置字体?
Call TextOut(nDC, 0, 0, "我33", 4)
Call ReleaseDC(TreeView1.hwnd, nDC)
End Sub我想给TreeView自画个背景,不知道如何设置字体,请各位指教。谢谢!
nDC = GetDC(TreeView1.hwnd)
Call SetBkMode(nDC, TRANSPARENT)
’如何设置字体?
Call TextOut(nDC, 0, 0, "我33", 4)
Call ReleaseDC(TreeView1.hwnd, nDC)
End Sub我想给TreeView自画个背景,不知道如何设置字体,请各位指教。谢谢!
你需要通过API函数CreateFontIndirect等方法创建一个字体,然后通过SelectObject选到Treeview的hdc中。
================================
谢谢,这个我知道。
我没有描述清楚,实在是不好意思。Private Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(1 To LF_FACESIZE) As Byte
End Type1。我需要把字体改为“隶书”
2。字体颜色改为红色。
我自己创建一个红色的CBrush,将其SelectObject添到DC中,可是字体还是黑色的。谢谢!