电竞比分网-中国电竞赛事及体育赛事平台

分享

如何讓字體逆時鐘轉(zhuǎn)90度°

 Library_ZYQ 2014-06-17
Private Declare Function CreateFontIndirect Lib "gdi32" _
                Alias "CreateFontIndirectA" _
                (lpLogFont As LOGFONT) _
                As Long
                 
Private Declare Function SelectObject Lib "gdi32" _
                (ByVal hdc As Long, _
                ByVal hObject As Long) _
                As Long
                 
Private Declare Function TextOut Lib "gdi32" _
                Alias "TextOutA" _
                (ByVal hdc As Long, _
                ByVal As Long, _
                ByVal As Long, _
                ByVal lpString As String, _
                ByVal nCount As Long) _
                As Long
                 
Private Declare Function DeleteObject Lib "gdi32" _
                (ByVal hObject As Long) _
                As Long
                 
Private Declare Function SetBkMode Lib "gdi32" _
                (ByVal hdc As Long, _
                ByVal nBkMode As Long) _
                As Long
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 As String * 50
End Type
Dim RF As LOGFONT
Dim NewFont As Long
Dim OldFont As Long
Private Sub Command_View_Click()
     Dim Throw As Long
     Me.Picture1.Cls
     RF.lfEscapement = Int(Val(Me.txtEscapement.Text)) * 10
    '設(shè)置文本傾斜度
     '設(shè)置字體參數(shù)
     NewFont = CreateFontIndirect(RF)
     '創(chuàng)建新字體
     OldFont = SelectObject(Me.Picture1.hdc, NewFont)
     '應(yīng)用新字體
     x = Me.Picture1.ScaleWidth / 2
     y = Me.Picture1.ScaleHeight / 2
     '選擇顯示文本的起點
     Throw = TextOut(Me.Picture1.hdc, x, y, Me.Text_Input.Text, _
                Len(Me.Text_Input.Text))
     '顯示文本
     NewFont = SelectObject(Me.Picture1.hdc, OldFont)
     '選擇舊字體
     Throw = DeleteObject(NewFont)
     '刪除新字體
End Sub
Private Sub Form_Load()
     SetBkMode Me.Picture1.hdc, 1
     RF.lfHeight = 50
     '設(shè)置字符高度
     RF.lfWidth = 10
     '設(shè)置字符平均寬度
     RF.lfEscapement = 0
     '設(shè)置文本傾斜度
     RF.lfWeight = 400
     '設(shè)置字體的輕重
     RF.lfItalic = 0
     '字體不傾斜
     RF.lfUnderline = 0
     '字體不加下劃線
     RF.lfStrikeOut = 0
     '字體不加刪除線
     RF.lfOutPrecision = 0
     '設(shè)置輸出精度
     RF.lfClipPrecision = 0
     '設(shè)置剪輯精度
     RF.lfQuality = 0
     '設(shè)置輸出質(zhì)量
     RF.lfPitchAndFamily = 0
     '設(shè)置字體的字距和字體族
     RF.lfCharSet = 0
     '設(shè)置字符集
     RF.lfFaceName = "Arial" + Chr(0)
     '設(shè)置字體名稱
      
     Me.txtEscapement.Text = RF.lfEscapement / 10
End Sub

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多