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 : Tuesday, February 26, 2008 6:28:10 PM(UTC)
NeubauerK

Groups: Registered
Posts: 3


Is there a way to print the current soomed in area of the image using VB 6 and LeadTools 14.0? In other words, I want to print only what the control is currently displaying, not the entire image.

Thanks,
Kerry
 

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 : Wednesday, February 27, 2008 2:11:20 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Hello,

Assuming you are using the LEAD Main OCX, you should be able to do that by manipulating the source rectangle before calling the Render() method. To do that, use the SetSrcRect() method and give it a rectangle that corresponds to the currently displayed area.

Note:
You might also need to use the Source Rectangle so as not to change the display during printing. Also, you might need to convert the currently displayed rectangle from client coordinates to bitmap coordinates. To do that, use the ClientToBitmap method.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Friday, February 29, 2008 5:36:41 AM(UTC)
NeubauerK

Groups: Registered
Posts: 3


I am using the Lead Main OCX and I understand about the SetSrcRect() method. In fact I am able to print an area of the image by setting Top, Left, Width and Height values and calling the Render() method. However, I can't figure out how to find the rectangle values (Top, Left, Width, Height) of the currently displayed area. What property or method can I use to get that information?

Thanks,
Kerry
 
#4 Posted : Sunday, March 2, 2008 6:33:31 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Kerry,

















































The code will look like this:
LEAD1.ClientToBitmap 0, 0
Dim xBmp, yBmp, wBmp, hBmp
xBmp = LEAD1.ConvertX
yBmp = LEAD1.ConvertY
Dim vScrl, hScrl
vScrl = 0
hScrl = 0
If LEAD1.VScrollInfo.Visible Then
   vScrl = LEAD1.VScrollInfo.Width
End If
If LEAD1.HScrollInfo.Visible Then
   hScrl = LEAD1.HScrollInfo.Width
End If
LEAD1.ClientToBitmap LEAD1.ScaleWidth - vScrl, LEAD1.ScaleHeight - vScrl
wBmp = LEAD1.ConvertX - xBmp
hBmp = LEAD1.ConvertY - yBmp
LEAD1.SetSrcRect xBmp, yBmp, wBmp, hBmp
Dim hDC
hDC = LEAD1.PrintStart
LEAD1.Render hDC, 0, 0, 0, 0
LEAD1.PrintEnd hDC

Please
note that it will change the display, so you might want to store the source rectangle values (x, y, width and height) and restore them after printing.

 
#5 Posted : Tuesday, March 4, 2008 6:40:23 AM(UTC)
NeubauerK

Groups: Registered
Posts: 3


Thanks. That worked perfectly.

Kerry
 
#6 Posted : Tuesday, August 26, 2008 1:34:58 PM(UTC)
JoeBussell

Groups: Registered
Posts: 15


The call:
LEAD1.ClientToBitmap LEAD1.ScaleWidth - vScrl, LEAD1.ScaleHeight - vScrl

may need to read:
LEAD1.ClientToBitmap LEAD1.ScaleWidth - hScrl, LEAD1.ScaleHeight - vScrl
 
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.087 seconds.