Click here to Skip to main content
15,905,508 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How to see CPU use (%) Pin
Paul Conrad14-May-07 8:53
professionalPaul Conrad14-May-07 8:53 
GeneralRe: How to see CPU use (%) Pin
Zaegra15-May-07 3:14
Zaegra15-May-07 3:14 
AnswerRe: How to see CPU use (%) Pin
Dave Kreskowiak14-May-07 8:44
mveDave Kreskowiak14-May-07 8:44 
QuestionTimer control running in the background Pin
steve_rm14-May-07 8:05
steve_rm14-May-07 8:05 
AnswerRe: Timer control running in the background Pin
SimulationofSai14-May-07 9:36
SimulationofSai14-May-07 9:36 
GeneralRe: Timer control running in the background Pin
steve_rm14-May-07 15:52
steve_rm14-May-07 15:52 
GeneralRe: Timer control running in the background Pin
Dave Kreskowiak14-May-07 16:36
mveDave Kreskowiak14-May-07 16:36 
QuestionHelp for Packet drop/pass Pin
Sunil KC14-May-07 7:34
Sunil KC14-May-07 7:34 
AnswerRe: Help for Packet drop/pass Pin
Dave Kreskowiak14-May-07 8:38
mveDave Kreskowiak14-May-07 8:38 
QuestionHow to Hide Members of Base Class Pin
Probeer Das14-May-07 7:16
Probeer Das14-May-07 7:16 
AnswerRe: How to Hide Members of Base Class Pin
nlarson1114-May-07 8:30
nlarson1114-May-07 8:30 
GeneralRe: How to Hide Members of Base Class Pin
Probeer Das15-May-07 3:21
Probeer Das15-May-07 3:21 
QuestionSetting value for resources Pin
ctlqt1214-May-07 5:45
ctlqt1214-May-07 5:45 
AnswerRe: Setting value for resources Pin
Dave Kreskowiak14-May-07 8:36
mveDave Kreskowiak14-May-07 8:36 
QuestionStretchBlt to a PictureBox ? Pin
Beginner_HC14-May-07 4:24
Beginner_HC14-May-07 4:24 
AnswerRe: StretchBlt to a PictureBox ? Pin
Dave Kreskowiak14-May-07 4:43
mveDave Kreskowiak14-May-07 4:43 
Beginner_HC wrote:
Public Class Form1
Dim srcImage As New Bitmap("MyPicture.bmp", True)
Dim Graph As Graphics = Me.CreateGraphics
Dim desHdc As IntPtr = Graph.GetHdc()

Dim srcHdc As IntPtr = CreateCompatibleDC(IntPtr.Zero)
Dim hBitmapSrc As IntPtr = srcImage.GetHbitmap()


This is a REALLY bad idea. Make this stuff class-scoped will cause you severe problems later on. You should ALWAYS Create, Use, then Destroy your graphics object only when you need them and only for as long as you need them. Caching one like this doesn't do you any good because some operations will only be commited when the Graphics object is finally destroyed.

What are you trying to do with this code again? You OP wasn't very clear about what your doing with this. What's the ultimate goal here?


A guide to posting questions on CodeProject[^]

Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


GeneralRe: StretchBlt to a PictureBox ? Pin
Beginner_HC14-May-07 5:34
Beginner_HC14-May-07 5:34 
GeneralRe: StretchBlt to a PictureBox ? Pin
Dave Kreskowiak14-May-07 8:34
mveDave Kreskowiak14-May-07 8:34 
GeneralRe: StretchBlt to a PictureBox ? Pin
Beginner_HC15-May-07 8:51
Beginner_HC15-May-07 8:51 
QuestionOOPS Pin
Rafeeque Ahmed14-May-07 4:03
Rafeeque Ahmed14-May-07 4:03 
AnswerRe: OOPS Pin
Dave Kreskowiak14-May-07 4:37
mveDave Kreskowiak14-May-07 4:37 
GeneralRe: OOPS Pin
leckey14-May-07 9:26
leckey14-May-07 9:26 
GeneralRe: OOPS Pin
Dave Kreskowiak14-May-07 9:48
mveDave Kreskowiak14-May-07 9:48 
GeneralRe: OOPS Pin
Paul Conrad14-May-07 9:54
professionalPaul Conrad14-May-07 9:54 
GeneralRe: OOPS Pin
leckey14-May-07 10:32
leckey14-May-07 10:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.