Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Copy picturebox contents to another form

Posted on 2006-04-29
6
Medium Priority
?
177 Views
Last Modified: 2010-05-01
Hi Experts
I have a picturebox on a form containing about 20 textboxs and labels.
 How can i copy this to another form? Using vb6
Thank you
0
Comment
Question by:isnoend2001
  • 3
  • 3
6 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16570911
You want to copy the controls to another form?  Or just a ~picture~ of the controls to another form?
0
 

Author Comment

by:isnoend2001
ID: 16570976
Hi
Thanks for your reply
I do not need the controls on another form just the picture of the controls with the textboxs and contents
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16577284
It would be something like...

Option Explicit
   
Private Declare Function BitBlt Lib "gdi32" _
    (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, _
    ByVal nWidth As Long, ByVal nHeight As Long, _
    ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, _
    ByVal dwRop As Long) As Long

Private Sub Form_Load()
    Me.ScaleMode = vbPixels
End Sub

Private Sub Command1_Click()
    Dim f2 As New Form2
    f2.ScaleMode = vbPixels
    f2.Picture1.Width = Me.Picture1.Width
    f2.Picture1.Height = Me.Picture1.Height
    f2.Picture1.BorderStyle = 0 ' none
    f2.Picture1.Appearance = 0 ' flat
    f2.Picture1.AutoRedraw = True
    f2.Show
    f2.WindowState = vbMinimized
    DoEvents
       
    BitBlt f2.Picture1.hdc, 0, 0, Picture1.Width, Picture1.Height, Me.Picture1.hdc, 0, 0, vbSrcCopy

    f2.WindowState = vbNormal
End Sub

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:isnoend2001
ID: 16579477
Hi Idle_mind
Your example works however it only copies the first 5 letters in the top left label from source picbox  to top left of destination picturebox
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1000 total points
ID: 16580271
Make sure you have the ScaleMode of BOTH forms set to vbPixels.
0
 

Author Comment

by:isnoend2001
ID: 16580762
Hi
I have both set to vbPixels, same problem.
I have decided I do not need half the info from the first picture Box. I'm just going to manually put put the
one's i need on the second form and populate them on the 2nd form load. Eg:name, address, job address etc
Thanks for your response
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question