gdi+就很好呀,vb6中这样用 Public Declare Function GdiplusStartup Lib "gdiplus.dll" _ (token As Long, inputbuf As GdiplusStartupInput, Optional ByVal outputbuf As Long = 0) As GpStatus Public Declare Sub GdiplusShutdown Lib "gdiplus.dll" _ (ByVal token As Long) '----------------GDI+------------------- Public GpInput As GdiplusStartupInput Public token As Long ' Needed to close GDI+ ' NOTE: Enums evaluate to a Long Public Enum GpStatus ' aka Status Ok = 0 GenericError = 1 InvalidParameter = 2 OutOfMemory = 3 ObjectBusy = 4 InsufficientBuffer = 5 NotImplemented = 6 Win32Error = 7 WrongState = 8 Aborted = 9 FileNotFound = 10 ValueOverflow = 11 AccessDenied = 12 UnknownImageFormat = 13 FontFamilyNotFound = 14 FontStyleNotFound = 15 NotTrueTypeFont = 16 UnsupportedGdiplusVersion = 17 GdiplusNotInitialized = 18 PropertyNotFound = 19 PropertyNotSupported = 20 End EnumPrivate Sub Form_Load() 'gdi+初始化 GpInput.GdiplusVersion = 1 If GdiplusStartup(token, GpInput) <> Ok Then MsgBox "初始化GDI+错误!" & Chr(13) & "gdiplus.dll出现故障!", vbCritical, "程序启动失败" Unload Me Exit Sub End If End SubPrivate Sub Form_Unload(Cancel As Integer) Call GdipClose End Sub Public Sub GdipClose() Call GdiplusShutdown(token) End Subgdiplus.dll可以从QQ的文件夹中找到,网上有专门的gdi+处理图形图片的vb模块文件。
怎样用GDI来编程呢?能否说明以下,或举个例子,多谢,给加分。
没有搜索到所谓的 Memory DC 的类
Public Declare Function GdiplusStartup Lib "gdiplus.dll" _
(token As Long, inputbuf As GdiplusStartupInput, Optional ByVal outputbuf As Long = 0) As GpStatus
Public Declare Sub GdiplusShutdown Lib "gdiplus.dll" _
(ByVal token As Long)
'----------------GDI+-------------------
Public GpInput As GdiplusStartupInput
Public token As Long ' Needed to close GDI+
' NOTE: Enums evaluate to a Long
Public Enum GpStatus ' aka Status
Ok = 0
GenericError = 1
InvalidParameter = 2
OutOfMemory = 3
ObjectBusy = 4
InsufficientBuffer = 5
NotImplemented = 6
Win32Error = 7
WrongState = 8
Aborted = 9
FileNotFound = 10
ValueOverflow = 11
AccessDenied = 12
UnknownImageFormat = 13
FontFamilyNotFound = 14
FontStyleNotFound = 15
NotTrueTypeFont = 16
UnsupportedGdiplusVersion = 17
GdiplusNotInitialized = 18
PropertyNotFound = 19
PropertyNotSupported = 20
End EnumPrivate Sub Form_Load()
'gdi+初始化
GpInput.GdiplusVersion = 1
If GdiplusStartup(token, GpInput) <> Ok Then
MsgBox "初始化GDI+错误!" & Chr(13) & "gdiplus.dll出现故障!", vbCritical, "程序启动失败"
Unload Me
Exit Sub
End If
End SubPrivate Sub Form_Unload(Cancel As Integer)
Call GdipClose
End Sub
Public Sub GdipClose()
Call GdiplusShutdown(token)
End Subgdiplus.dll可以从QQ的文件夹中找到,网上有专门的gdi+处理图形图片的vb模块文件。
要在vb6中使用gdi+ ,例如在新建工程1-Form1中使用gdi+,需要做那些安装或设置工作。
在网上有gdi画图的教程,你看看就好了