Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bug in GDI+ Imgage Capture
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01524847
Message ID:
01525189
Vues:
60
>>>There is a bug in the loCaptureBmp function (below) in GDI+. Every time I run it the entire form jumps down one line and I have to set form.top = 0 to reset it. I tried LockScreen = .t. but it had no effect at all. Everything else works great but the screen jump is annoying to my customers.
>>>
>>>
WITH _Screen.System.Drawing
>>>  loCaptureBmp = .Bitmap.FromScreen(;
>>>    Thisform.HWnd, ;
>>>    mLeftOffset, ;
>>>    mTopOffset, ;
>>>    mWidth, ;
>>>    mHeight )
>>>    *
>>>    * Write file directly to image object
>>>    Thisform.imgDummy.PictureVal= loCaptureBmp.GetPictureValFromHbitmap()
>>>ENDWITH
>>
>>Hi John
>>
>>I have posted some code for a GDI+ Lightbox here:
>>
>>http://weblogs.foxite.com/bernardbout/archive/2009/09/21/8974.aspx
>>
>>Download the code and see if you get the same jump.
>>
>>When I run the sample form included above and capture the screen I do not see any jump.
>>
>>Also could you give more info about your form properties?
>>
>>1. ShowWindow
>>2. WindowState
>>3. WindowType
>>4. Titlebar
>>4. BorderStyle
>>
>>and I will test this for you with my class to see if any of these have any effect.
>
>Bernard,
>thanks for the offer to help. Here are the window settings:
>>
>1. ShowWindow = 0 In screen
>2. WindowState = Normal
>3. WindowType = 1 Modal
>4. Titlebar = 0 Off
>4. BorderStyle = 1 Fixed Single
>
>I did not try your sample because it says no containers. This is a very complex form that can have many layers of containers and also IE Browser ActiveX controls within the containers. The Browser control is always held in at least the third level of containers. The process is used to "take a picture" (capture it) of the contents of an IE ActiveX window and use it as the picture property of a container.
>
>I tried capturing the image of a container with an image to see if the ActiveX window was causing the problem. Same result.
>
>Thanks

John I am sure that the code you are using is not taking t=into account the Height of the Titlebar of the form, which your form has not.

Anyway I created a form with the exact same settings you posted above and added 2 Activex controls, One in a container and another in a container in a container ( 2 levels deep)

I then added my lightbox class and called it. There was absolutely no shifting of the form up or down which leads me to suspect some other code in your form, especially since you say it is complicated.

Things to try:

1. Download the sample I did which uses my lightbox class also included. Run it and see if there is a shift in the form.

http://www.multiupload.com/46TV65QNBJ

2. In your Form.Moved add this line:
WAIT WINDOW NOWAIT "Form Moved. Top is now "+ALLTRIM(STR(Thisform.Top))
If it fires after your call to your lightbox code then comment it out and add instead
SUSPEND
Then if the code stops because the form was moved by your lightbox code, you can open the Call Stack window and check where this happened in your code.

However I suggest you try my lightbox class as it has support for Activex as well. It is very simple to use. Just drop it on your form and add code like I have done in the Form.LightBox method.

Lets know how you go.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform