Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Re: Printing a zoomed area in VB
Started by NeubauerK at 02-26-2008 23:33. Topic has 5 replies.

Print Search « Previous Thread Next Thread »
  02-26-2008, 23:33
NeubauerK is not online. Last active: 2/27/2008 4:30:03 AM NeubauerK

Not Ranked
Joined on 02-27-2008
Posts 3
Printing a zoomed area in VB
Reply Quote
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
   Report 
  02-27-2008, 7:16
Maen Hasan is not online. Last active: 10/13/2008 7:35:45 AM Maen Hasan



Top 10 Posts
Joined on 08-05-2004
Posts 1,748
Re: Printing a zoomed area in VB
Reply Quote
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
   Report 
  02-29-2008, 10:41
NeubauerK is not online. Last active: 2/27/2008 4:30:03 AM NeubauerK

Not Ranked
Joined on 02-27-2008
Posts 3
Re: Printing a zoomed area in VB
Reply Quote
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
   Report 
  03-02-2008, 11:38
Adnan Ismail is not online. Last active: 10/8/2008 8:10:14 AM Adnan Ismail



Top 10 Posts
Joined on 07-31-2006
Posts 1,223
Re: Printing a zoomed area in VB
Reply Quote
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.


Adnan Ismail
LEADTOOLS Technical Support

   Report 
  03-04-2008, 11:45
NeubauerK is not online. Last active: 2/27/2008 4:30:03 AM NeubauerK

Not Ranked
Joined on 02-27-2008
Posts 3
Re: Printing a zoomed area in VB
Reply Quote
Thanks. That worked perfectly.

Kerry
   Report 
  08-26-2008, 18:39
JoeBussell is not online. Last active: 9/25/2008 9:29:30 PM JoeBussell

Top 50 Posts
Joined on 06-17-2008
Eugene, OR
Posts 41
Re: Printing a zoomed area in VB
Reply Quote
The call:
LEAD1.ClientToBitmap LEAD1.ScaleWidth - vScrl, LEAD1.ScaleHeight - vScrl

may need to read:
LEAD1.ClientToBitmap LEAD1.ScaleWidth - hScrl, LEAD1.ScaleHeight - vScrl

   Report 
Post
LEAD Support Fo... » Developer » Printing » Re: Printing a zoomed area in VB

Powered by Community Server, by Telligent Systems