Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, June 21, 2007 5:57:49 AM(UTC)
jshelley

Groups: Registered
Posts: 3


Using Main Control - ActiveX in VB6.

I have succesfully combined 2 .jpg images using the .combine method.  I am now attempting to give the user the ability to pan (move) and/or zoom one of the images while the other stays docked.  Once the user places and sizes the image to the correct location, then I want to save the resulting combination of the two images as a new .jpg file. 

I can provide sample images and the code I have written so far if needed.

Thanks.

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, June 21, 2007 6:40:10 AM(UTC)
jshelley

Groups: Registered
Posts: 3


I forgot to mention that I am using Version 14.
 
#3 Posted : Friday, June 22, 2007 6:09:55 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Here's a basic project to help get you started.  It shows how to keep two images as backups and then combine them onto your display Main Control wherever you would like them.  Because of problems with the mouse event (see below) I could only do the very basics and use buttons and text boxes for the implementation.  Once you get the logic and coordinates correct with the mouse, all you need to do is update the fTop and fLeft parameters of the two Combine calls which is easily done by updating the global properties xDstBack, yDstBack, xDstFront, and yDstFront.

Unfortunately, there is a problem with VB 6 and our main control's mouse events that makes the values way off.  Therefore the panning with the mouse was no possible using the MainControl.MouseMove events.  I have reported this problem with the incident number 5918IDT.  This incident will be reviewed and prioritized by our engineering department.  I will contact you when I get more information from our developers.  The same code would work in VS 2003 and 2005, so if you have those environments available then you won't have to worry about this incident.

If you are stuck with VB6 then you will have to find another way to calculate where your points were
when you started clicking and dragging with the mouse.  Most likely the Windows API will work fine
for you but you will have to declare those functions and then do a little extra math to calculate where you are on the form.  Depending on whether or not you are zoomed in/out or if the image is scrolled you may also need to use the ClientToBitmap method.
 
If you have any more questions, please let me know.
File Attachment(s):
OCX - V145 - Pan Combined Images.zip (9kb) downloaded 97 time(s).
 
#4 Posted : Monday, June 25, 2007 9:15:05 AM(UTC)
jshelley

Groups: Registered
Posts: 3


Thank you for your quick reply.

This is on track with what I am trying to do.  I may try to write the code to handle the panning, OR maybe I can get access to VB 2005.  You mention using MouseMove events of the MainControl; do you happen to have any sample code which acclomplishes this?  I am also having trouble trying to zoom the back image (loaded into LEAD3 in your example).  I want to zoom in on the back image, while the top image stays the same, and then combine the image again.

Thank you very much for your help.

 
#5 Posted : Tuesday, June 26, 2007 4:56:06 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


I did not include my code for the MouseMove event purposefully because it was not working properly, thus the incident I reported for you.  If you want some sample code on the MouseMove event you can get it from the OCX help file.

As for "zooming", you need to remember that you're combining the bitmap data onto eachother.  Therefore to "zoom" one of the two images, you need to physically resize the bitmap with the Size method before combining it on the image.  If you want to zoom out, you  need to make the image smaller and vice versa.  You may need to do some additional cropping and use more LEAD controls so that you can maintain the originals.
 
#6 Posted : Monday, July 9, 2007 5:32:22 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


The developer working on your incident, 5918IDT has let me know that it is not a bug with LEADTOOLS.  Our Main OCX control's mouse events will use the base environment's units.  VB will always have its units in Twips, even if the form's scalemode is in pixels.  The easiest way to convert twips to pixels is to use the Screen.TwipsPerPixelX and Screen.TwipsPerPixelY properties:


'change position of foreground picture
xDstFront = X / Screen.TwipsPerPixelX
yDstFront = Y / Screen.TwipsPerPixelY


I've attached a new test project closer to your original request.
File Attachment(s):
OCX - V145 - Pan Combined Images.zip (9kb) downloaded 98 time(s).
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.104 seconds.