在VB中利用Windows的API函数可以实现很多的VB无法实现的扩展功能,下面的程序介绍的是如何通过调用Windows中的API函数实现文本旋转显示的特级效果。 首先建立一个工程文件,然后选菜单中的Project | Add Class Module 加入一个新的类文件,并将这个类的Name属性改变为APIFont,然后在类的代码窗口中加入以下的代码: Option Explicit
Private Declare Function SelectClipRgn Lib “gdi32”(ByVal hdc As Long, ByVal hRgn As _ Long) As Long Private Declare Function CreateRectRgn Lib “gdi32”(ByVal X1 As Long, ByVal Y1 As _ Long, ByVal X2 As Long, ByVal Y2 As Long) As Long Private Declare Function SetTextColor Lib “gdi32”(ByVal hdc As Long, ByVal crColor As _ Long) As Long Private Declare Function DeleteObject Lib “gdi32”(ByVal hObject As Long) As Long 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 X As Long, ByVal Y As Long, ByVal lpS