Hello There, Guest!
View New Posts  |  View Today's Posts
[VB.Net] Scrollable Panel

  • 0 Vote(s) - 0 Average


04-15-2017, 07:36 AM #1
simx
Member
**
Posts: 233 Threads:37 Joined: Jun 2011 Reputation: 4

Scrollable Panel
Hi guys!

It's ben quite a long time since I bothered people on this board with troublesome questions so I thought it was about time I came back to keep you guys thinking lol
I am tring to get all the controls within my scrolable panel to either print to A4 or save as an image and then print to A4.
The problem I keep getting is that it only ever prints out the current view and not everything within the panel.
I'm currently using this code:
Code:
Private Function TakeScreenShot(ByVal Control As Control) As Bitmap
       Dim tmpImg As New Bitmap(Control.Width, Control.Height)
       Using g As Graphics = Graphics.FromImage(tmpImg)
           g.CopyFromScreen(Panel1.PointToScreen(New Point(0, 0)), New Point(0, 0), New Size(Panel1.Width, Panel1.Height))
       End Using
       Return tmpImg
   End Function

   Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
       TakeScreenShot(Panel1).Save("C:\test.jpeg", Imaging.ImageFormat.Jpeg)
   End Sub

Any ideas guys?
Any help is greatly appreciated!
This post was last modified: 04-15-2017, 07:37 AM by simx.

04-17-2017, 09:08 PM #2
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: Scrollable Panel
Use the Control DrawToBitmap method. https://msdn.microsoft.com/en-us/library...itmap.aspx

You're copying the screen, not the control currently. That will never work.


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

04-18-2017, 04:30 AM #3
simx
Member
**
Posts: 233 Threads:37 Joined: Jun 2011 Reputation: 4

RE: Scrollable Panel
Cheers Ace, I actually already found this.




Forum Jump:


Possibly Related Threads...
Thread Author Replies Views Last Post
   Slide panel out of form Crystalii 9 5,872 11-07-2012, 12:14 AM
Last Post: _HAWK_
   Scrollable collection! [GDI+] _HAWK_ 2 1,407 10-30-2011, 04:58 PM
Last Post: _HAWK_


Users browsing this thread: 1 Guest(s)