Dim st As IPictureDisp
Set st = LoadPicture(App.Path + "\1.bmp")
pic.Picture = st
Don Leno писал(а):в этом коде реализована загрузка в ОЗУ компа, а потом его показывает в PictureBox или нет?
Если да, то я хотел бы загрузив картинку например наложить на нее какую нить дополнительную графику и только потом вывести на PictureBox.
nDC = CreateDC("DISPLAY", vbNullString, vbNullString, ByVal 0&)
Option Explicit
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Sub Form_Load()
Dim pic As StdPicture
Dim hdc As Long
Dim obp As Long
Set pic = LoadPicture("D:\Temp\Mega.jpg")
hdc = CreateCompatibleDC(Me.hdc)
obp = SelectObject(hdc, pic.Handle)
' Рисуем круг
Ellipse hdc, 0, 0, 100, 100
SelectObject hdc, obp
DeleteDC hdc
Set Me.Picture = pic
End Sub
hdc = CreateCompatibleDC(Me.hdc)
Set Me.Picture = pic
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Const SRCCOPY = &HCC0020
Private Sub Command1_Click()
Dim st As IPictureDisp
Dim lt As IPictureDisp
Dim hdc As Long
Dim hst As Long
Dim hlt As Long
Set st = LoadPicture(App.Path + "\1.bmp")
Set lt = LoadPicture(App.Path + "\2.bmp")
hst = CreateCompatibleDC(Me.hdc)
hlt = CreateCompatibleDC(Me.hdc)
SelectObject hst, st.Handle
SelectObject hlt, lt.Handle
BitBlt hst, 0, 0, 50, 50, hlt, 0, 0, SRCCOPY
SelectObject hst, st
DeleteDC hst
DeleteDC hlt
Form1.Picture = st
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 82