Current location: Hot Scripts Forums » Programming Languages » Windows .NET Programming » [SOLVED] [2005] VB6-like AutoRefesh for PictureBox control?


[SOLVED] [2005] VB6-like AutoRefesh for PictureBox control?

Reply
  #1 (permalink)  
Old 04-16-08, 03:14 PM
tim8w tim8w is offline
Wannabe Coder
 
Join Date: Nov 2004
Posts: 183
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy [SOLVED] [2005] VB6-like AutoRefesh for PictureBox control?

I have a PictureBox control where the user can doodle. It works great until the control gets refreshed. I solved this problem by doing the following:

Code:
            pbPostIt.Image = New Bitmap(pbPostIt.Width, pbPostIt.Height)
Then anytime anything was draw to the PictureBox I called:

pbPostIt.Invalidate()

This worked fine until the PictureBox gets re-sized. Is there a way to copy the existing Image into the newly re-sized PictureBox?
Reply With Quote
  #2 (permalink)  
Old 04-16-08, 05:21 PM
tim8w tim8w is offline
Wannabe Coder
 
Join Date: Nov 2004
Posts: 183
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Resolved: [2005] VB6-like AutoRefesh for PictureBox control?

Figured it out. I added the following code to the Resize event:

Code:
            Dim newImage As New Bitmap(pbPostIt.Image)
            Dim pbGraphics As Graphics

            pbPostIt.Image = New Bitmap(pbPostIt.Width, pbPostIt.Height)
            pbGraphics = Graphics.FromImage(pbPostIt.Image)
            pbGraphics.DrawImage(newImage, 0, 0)
            pbPostIt.Invalidate()
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between the user control and Custom server controls bhar ASP.NET 0 07-22-06 05:42 AM
Validating a list/menu control... Clark_Kent JavaScript 3 05-16-06 12:55 AM
SHOUTCAST HOSTING CONTROL PANEL $14.99 /month! The Long Awaited Software Has Arrived! SCPanel General Advertisements 0 09-21-05 11:05 PM
Source Control Review denasinc@ ASP.NET 1 04-25-05 02:41 PM


All times are GMT -5. The time now is 02:16 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.