直接用LoadBitmaps函数显示is not a member of 'CButton'?

这是怎么回事?还有SizeToContent函数;
确实函数库里没有,所以想问问怎么调用,万分感谢!!!

慕桂英3389331
浏览 127回答 2
2回答

一只甜甜圈

如果是API函数的话,调用时要先封装,例如:Const LR_LOADFROMFILE = &H10Const IMAGE_BITMAP = 0Const IMAGE_ICON = 1Const IMAGE_CURSOR = 2Const IMAGE_ENHMETAFILE = 3Const CF_BITMAP = 2Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal dwImageType As Long, ByVal dwDesiredWidth As Long, ByVal dwDesiredHeight As Long, ByVal dwFlags As Long) As LongPrivate Declare Function CloseClipboard Lib "user32" () As LongPrivate Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As LongPrivate Declare Function EmptyClipboard Lib "user32" () As LongPrivate Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As Long) As LongPrivate Declare Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As Long) As LongPrivate Sub Form_Load()Dim hDC As Long, hBitmap As Long'Load the bitmap into the memoryhBitmap = LoadImage(App.hInstance, "d:\pintu\p1.bmp", IMAGE_BITMAP, 400, 290, LR_LOADFROMFILE)If hBitmap = 0 ThenMsgBox "There was an error while loading the bitmap"Exit SubEnd If'open the clipboardOpenClipboard Me.hwnd'Clear the clipboardEmptyClipboard'Put our bitmap onto the clipboardSetClipboardData CF_BITMAP, hBitmap'Check if there's a bitmap on the clipboardIf IsClipboardFormatAvailable(CF_BITMAP) = 0 ThenMsgBox "There was an error while pasting the bitmap to the clipboard!"End If'Close the clipboardCloseClipboard'Get the picture from the clipboardMe.Picture = Clipboard.GetData(vbCFBitmap)End Sub>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>SizeToContent是不是自定义函数就不清楚了,如果是,可以直接Call SizeToContent(参数)就好了。

一只名叫tom的猫

要新建一个CBitmapButton 的类对象就可以了
打开App,查看更多内容
随时随地看视频慕课网APP