OVH Cloud OVH Cloud

problème avec l'api BITBLT

2 réponses
Avatar
marc.dufresne
bonjour à tous
je teste les différents mode d'affichage d'image à l'écran et j'essaye cette
fontion d'API "bitBlt"
j'ai recopié un exemple cidessous où j'ai attribué dans picture1 une photo
voici le code:

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

Public Sub Form_Load()
Form1.Height = Screen.Height
Form1.Width = Screen.Width
Form1.Move 0, 0
Form1.ScaleMode = 3
Form1.AutoRedraw = True


Set pics = LoadPicture("G:\Mes Documents\Mes images\chicago.jpg")

Picture1.Height = Screen.Height
Picture1.Width = Screen.Width

Picture1.ScaleMode = 3

Picture1.Move 0, 0
Picture1.Visible = False
'Timer1.Enabled = True
'Timer1.Interval = 1
x = BitBlt(Form1.hDC, 100,100, 300, 300, Picture1.hDC, 200, 200, _
SRCCOPY)
Form1.Refresh ' Montre l'image une fois la page rafraîchit
End Sub


Mais apparement j'obtiens bien un affichage mais d'une partie de l'écran
actuel (mon programme visual basic)

si vous aviez une idée

2 réponses

Avatar
Picalausa François
"marc.dufresne" a écrit dans le
message de news: 4426a4b0$0$11338$
bonjour à tous
je teste les différents mode d'affichage d'image à l'écran et j'essaye
cette
fontion d'API "bitBlt"
j'ai recopié un exemple cidessous où j'ai attribué dans picture1 une photo
voici le code:

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

Public Sub Form_Load()
Form1.Height = Screen.Height
Form1.Width = Screen.Width
Form1.Move 0, 0
Form1.ScaleMode = 3
Form1.AutoRedraw = True


Set pics = LoadPicture("G:Mes DocumentsMes imageschicago.jpg")

Picture1.Height = Screen.Height
Picture1.Width = Screen.Width

Picture1.ScaleMode = 3

Picture1.Move 0, 0
Picture1.Visible = False
'Timer1.Enabled = True
'Timer1.Interval = 1
x = BitBlt(Form1.hDC, 100,100, 300, 300, Picture1.hDC, 200, 200, _
SRCCOPY)
Form1.Refresh ' Montre l'image une fois la page rafraîchit
End Sub


Mais apparement j'obtiens bien un affichage mais d'une partie de l'écran
actuel (mon programme visual basic)

si vous aviez une idée



Hello,

Le picturebox doit être visible pour que ça marche.
Sinon, tu peux employer PaintPicture qui permet l'emploi des mêmes opcodes:
Form1.PaintPicture pic, 0, 0, 100, 100, Opcode:=vbSrcCopy

--
Picalausa François
Avatar
marc.dufresne
Bonjour à tous
j'ai trouvé
Il faut mettre la picturebox1 à mode autoredraw à vraie
et le picture box peut être invisible

merci encore

"Picalausa François" a écrit dans le message de news:
uTXO%
"marc.dufresne" a écrit dans le
message de news: 4426a4b0$0$11338$
bonjour à tous
je teste les différents mode d'affichage d'image à l'écran et j'essaye
cette
fontion d'API "bitBlt"
j'ai recopié un exemple cidessous où j'ai attribué dans picture1 une
photo
voici le code:

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

Public Sub Form_Load()
Form1.Height = Screen.Height
Form1.Width = Screen.Width
Form1.Move 0, 0
Form1.ScaleMode = 3
Form1.AutoRedraw = True


Set pics = LoadPicture("G:Mes DocumentsMes imageschicago.jpg")

Picture1.Height = Screen.Height
Picture1.Width = Screen.Width

Picture1.ScaleMode = 3

Picture1.Move 0, 0
Picture1.Visible = False
'Timer1.Enabled = True
'Timer1.Interval = 1
x = BitBlt(Form1.hDC, 100,100, 300, 300, Picture1.hDC, 200, 200, _
SRCCOPY)
Form1.Refresh ' Montre l'image une fois la page rafraîchit
End Sub


Mais apparement j'obtiens bien un affichage mais d'une partie de l'écran
actuel (mon programme visual basic)

si vous aviez une idée



Hello,

Le picturebox doit être visible pour que ça marche.
Sinon, tu peux employer PaintPicture qui permet l'emploi des mêmes
opcodes:
Form1.PaintPicture pic, 0, 0, 100, 100, Opcode:=vbSrcCopy

--
Picalausa François