Home > Software engineering >  Win10 bitblt equipment copy is empty
Win10 bitblt equipment copy is empty

Time:09-15

I use VB API drawing, and then, by means of bitblt equipment copy copies image to picture box, there is no question of under XP system, but in win10 is copied to a blank, consult everybody how to solve?

CodePudding user response:

Don't talk to me reply screenshots first, and then copy, because the screen has a zoom, then screenshots - narrow - amplifier, image resolution, was much better, thank you

CodePudding user response:

Try
1, picturebox autoredraw attribute set to true
2, copy before and after doing a picturebox. Painpicture picturebox. Image

CodePudding user response:

First of all, crispy big ice cream reply thank you! I tried a suggestion, you have no effect, still as before, my program is as follows:
Dim hDCtmp As Long
Picture1. AutoRedraw=True
HDCtmp=GetDC (Picture1. HWnd) 'obtained image box handle
Picture1. Picture=Picture1. Image
Call BitBlt (Picture1. HDC, 0, 0, Picture1. ScaleWidth, Picture1. ScaleHeight, hDCtmp, 0, 0, vbSrcCopy) 'convert raster to bitmap
Picture1. Picture=Picture1. Image 'win10 display Image is hidden behind here to (copy to be blank)
HDCtmp ReleaseDC Form1. Picture1. HWnd

CodePudding user response:

Didn't understand your intentions
Picture1 itself with HDC property, do not need getDC
But do you have this in bitblt clearly know HDC property, but why in picture1 copy again?
Checked the getdc and outcomes of HDC property worth?

Don't tangle with your code, say it out loud, you really want to do, application scenarios and the results you want,

CodePudding user response:

Thank you very much for the patience to solve crispy big ice cream! My application scenario is this: I want to paint in a picture box, due to the complexity of graphics, asked for a faster, then to paint with openGL language, through the first Call EnableOpenGL (Picture1. HDC) 'start the openGL, then in memory drawing, painting, through SwapBuffers Picture1. HDC' switch caching displayed, but the images of the show, if the minimum page again after recovery, the picture is to disappear, also not easy to print the next image, and then through the above procedures, the Picture1 Windows copied to the window of the Picture1 attribute, the programs under the XP demonstration is no problem, now win10 system, the images show a moment, if the program above are removed, shows that there is no problem, is back again after the page said above minimization, portrait is to disappear, also not convenient for next print screen, now is to solve the "flash show" and the next step of printing and are looking forward to your help!

CodePudding user response:

Crispy big ice cream: you if it's convenient for you, please add my QQ: 389305844 lettuce Hong, thank you

CodePudding user response:

No one know the way? Crispy big experts also don't have any choice? Hope which expert to give guidance for the feeling!

CodePudding user response:

Image processing is to speed, it don't directly on the output device mapping, directly use GDI and GDI + processing in the graphics device, handle and then output to the output device, this is the basic image processing process,

CodePudding user response:

And flash is your not a problem, the estimate is BitBlt PictureBox didn't open AutoreDraw attribute, actually does not open, can again PictureBox redraw GDI equipment in the Paint event to a PictureBox, this also is fast

CodePudding user response:

Thank you very much "now or human" answer, I draw the figure of the main or three dimensional figure, I used to like tried and openGL drawing speed faster than GDI, don't know how GDI +, more do not know how GDI on 3 d drawing, please advise! I opened AutoreDraw attribute in PictureBox is, if it is not open, to won't flash, blink, returned to normal after just minimize window, the images are not, there is another, if the image can't copy to the PictureBox, next print screen is also a problem, hope "now or human" experts can give guidance to feeling!

CodePudding user response:

No matter you are using is DX, such as OpenGL or GDI, there is output to the display device, and the output of the process is called to refresh, and procedures for drawing process is called drawing, as long as separate the drawing and refresh the process is very easy to understand, such as the following examples such separate mapping and refresh the process will not have what problem:
 
Dim gdi As GDIPlusClass
Dim is_exit As Boolean
Dim is_draw As Boolean
Dim mouse_x As Long
Dim mousy_y As Long

Private Sub Form_Load ()
Set the gdi=New GDIPlusClass
Gdi. Create Picture1. Width, Picture1. Height
Gdi. BgColor=& amp; H0
Is_draw=True
Is_exit=False
Do
DoEvents
DrawImage
Loop While Not is_exit
Gdi. Close
Set the gdi=Nothing
End Sub

'
//drawing processPrivate Sub DrawImage ()
If Not is_draw Then
The Exit Function
End the If
Gdi. Cls
Gdi. DrawLine mouse_x - 20, mousy_y - 20, mouse_x + 20, mousy_y + 20, & amp; HFF, B
Is_draw=False
Refresh
End Sub

'
//refresh processPrivate Sub Refresh ()
Gdi. DrawImage Picture1. HDC, 0, 0, gdi. IWidth, gdi., 0, 0, gdi, iWidth, iHeight gdi. IHeight, vbSrcCopy
End Sub

Private Sub Picture1_Resize ()
Gdi. ZoomSize Picture1. Width, Picture1. Height
Is_draw=True
DrawImage
End Sub

Private Sub Picture1_MouseMove (Button As an Integer, Shift the As an Integer, As Single X, Y As Single)
If X & lt;> Mouse_x Or Y & lt;> Mousy_y Then
Mouse_x=X
Mousy_y=Y
Is_draw=True
End the If
End Sub

Private Sub Picture1_MouseUp (Button As an Integer, Shift the As an Integer, As Single X, Y As Single)
If the Button=1 Then
If X & gt; 0 And X & lt; 40 And Y & gt; 0 And Y & lt; 40 Then
Is_exit=True
End the If
End the If
End Sub

Private Sub Picture1_Paint ()
Refresh
End Sub

Don't need to study the GDIPlusClass class, this is me to write a class, the system didn't, here is convenient for interpreter,

CodePudding user response:

Two days before back to how did not show up? I repeat, thank you very much "now or human" patience to solve! I know what you mean, is the drawing and refresh is divided into two actions, if back to normal again after window to minimize the window, and then call this two action, I once also had tried, is closed AutoreDraw properties, draw flush again refresh, memory DC not cancellation, if returned to normal after I have a minimized window, is to take a refresh again, but without success, pictures or no shows that under win10 system actually, if you don't do to minimize the operation window, even open the other window, or remove the cover the other window, the window of this window will display picture (AutoreDraw properties are off) at this time, not like XP, do not display the original image, so I'm in the design, the function of the window is set to not minimize the, also don't have to consider the action of copy, but in so doing, though shows that there is no problem, but there was a problem with the image or print display, if you can help me solve good print image is displayed on the screen, I posted, it give you the most, for all the answers that "crispy big ice cream" to give him a little, you for helping me, of course, not rush the points, but the result of your helpful noble moral character, if it's convenient for you, you can add my QQ: 389305844, thanks again! Below is my picture and display figure,

CodePudding user response:

Under normal circumstances, whether the Xp or Win10, in case of need to refresh window will receive the WM_PAINT message, of course, if what attribute is set to the VB Paint or intercept the news events to be invalid, if you need to refresh the process is to maximize minimized when, can again the Resize event trigger refresh process or take over directly in the Windows message processing process to capture WM_SIZE message to trigger the refresh process, all in all, this problem is not a problem what Win10 or Xp, but your application itself in the treatment of the refresh process problems,
  •  Tags:  
  • API
  • Related