solokin1 Posted February 28, 2003 Posted February 28, 2003 hi, I just recently switched over to VB.Net in the midst of my coding a Diablo II-clone, and I have noticed that there is no BitBlt function, so I tried using the GDI DrawImage method. This works fine if I am loading a bitmap from disk into a picturebox, but I cannot then copy a selected rectangle from that picturebox into another picturebox! It says that there is no image in the previous picture box, and so it can't copy the selected portion! Is there something I;m doing wrong or should i use directdraw9 or what? Help requested before I physically burn my copy of VB.NET :) SOloKing Quote
*Gurus* divil Posted February 28, 2003 *Gurus* Posted February 28, 2003 Anything you draw on a picturebox is essentially temporary. It isn't stored anywhere, it's just displayed on the screen. This is important for performance purposes. If you want to do something like you are trying to do, you need to create an offscreen bitmap. This is easy enough using the Bitmap class. You can get a graphics object from that bitmap using Graphics.FromImage() and draw on it. Once you have drawn on it you are free to assign it to a picturebox if you like, to display it. You do this with the picturebox's Image property. If you want to use DrawImage to draw a portion of your offscreen bitmap to another Graphics object, you can also do so. Several overloads for Graphics.Drawimage allow you to specify a source rectangle to blt from. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Leaders snarfblam Posted June 16, 2003 Leaders Posted June 16, 2003 There is also another problem with the Drawimage function as far as games go: it is slower that bitblt. It appears to be just as slow as the VB6 .paintpicture method. You can still use bitblt in VB.net the same way as you do in vb6. The only difference is that you need the GetDC() windows API function to get the handle to the device context for a control, since it is not provided as a property. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.