|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Making Bitmaps and Graphics objects - two waysI'm guessing there is a difference that I'm just not aware of. Can someone enlighten me? Thanks 'This works (4 lines) Dim TmpBitmapGraphics As Graphics = PictureBoxPic.CreateGraphics Dim TmpBitmap As New Drawing.Bitmap(PictureBoxPic.ClientSize.Width, PictureBoxPic.ClientSize.Height, TmpBitmapGraphics) TmpBitmapGraphics.Dispose() 'Did the above to preserver the PixelFormat TmpBitmapGraphics = Graphics.FromImage(TmpBitmap) 'This also works (2 lines) Dim TmpBitmap As New Drawing.Bitmap(PictureBoxPic.ClientSize.Width, PictureBoxPic.ClientSize.Height) Dim TmpBitmapGraphics As Graphics = Graphics.FromImage(TmpBitmap) **Developer** wrote:
Show quoteHide quote > Stumbling through I find both of the following appear to work the same. 'Set it to the picture boxes graphics object> > I'm guessing there is a difference that I'm just not aware of. > > Can someone enlighten me? > > > > Thanks > > > > > > 'This works (4 lines) > > Dim TmpBitmapGraphics As Graphics = PictureBoxPic.CreateGraphics > > Dim TmpBitmap As New Drawing.Bitmap(PictureBoxPic.ClientSize.Width, > PictureBoxPic.ClientSize.Height, TmpBitmapGraphics) > > TmpBitmapGraphics.Dispose() 'Did the above to preserver the PixelFormat > > TmpBitmapGraphics = Graphics.FromImage(TmpBitmap) > > 'This also works (2 lines) > > Dim TmpBitmap As New Drawing.Bitmap(PictureBoxPic.ClientSize.Width, > PictureBoxPic.ClientSize.Height) > > Dim TmpBitmapGraphics As Graphics = Graphics.FromImage(TmpBitmap) > > 1. Dim TmpBitmapGraphics As Graphics = PictureBoxPic.CreateGraphics 2. Dim TmpBitmap As New Drawing.Bitmap(PictureBoxPic.ClientSize.Width, PictureBoxPic.ClientSize.Height, TmpBitmapGraphics) 'Kill this object (this has the same effect as if you never did line 1 3. TmpBitmapGraphics.Dispose() 'Did the above to preserver the PixelFormat ' Set the object to something totally new. 4. TmpBitmapGraphics = Graphics.FromImage(TmpBitmap) So it seems like this way of doing it is pretty pointless, since you create the object and then just kill it right after. ..
> Except Line 2 used it. Not sure about the effect though. Can an image in a > 'Set it to the picture boxes graphics object > 1. Dim TmpBitmapGraphics As Graphics = PictureBoxPic.CreateGraphics > > 2. Dim TmpBitmap As New Drawing.Bitmap(PictureBoxPic.ClientSize.Width, > PictureBoxPic.ClientSize.Height, TmpBitmapGraphics) > > 'Kill this object (this has the same effect as if you never did line 1 picturebox have different DPI? Or does it match the screen? Show quoteHide quote > 3. TmpBitmapGraphics.Dispose() 'Did the above to preserver the PixelFormat > > ' Set the object to something totally new. > 4. TmpBitmapGraphics = Graphics.FromImage(TmpBitmap) > > So it seems like this way of doing it is pretty pointless, since you > create the object and then just kill it right after.
Printing using margins
Subclassed Textbox OnLeave Overrides StreamWriter and BinaryWriter (same problem better explained) StreamWriter and BinaryWriter Additional information: Cast from string "" to type 'Double' is not valid. error Variable declarations.... in VB.Net Visual Basic 2005 PostMessage ComboBox IIS filtering data view with row filter using boolean value |
|||||||||||||||||||||||