Nate Bross Posted July 1, 2005 Posted July 1, 2005 I am trying to to a manual Double Buffer in vb.net. I have several bitmap objects, and I would like to draw each of them onto a single bitmap object, then finally draw that to the form. There is a reason for my madness, I am developing for the PocketPC and I cannot get Me.SetStyle to work. I am kind of confused with the syntax of how to do that. If someone could give a small example drawing two seprate bitmap objects onto a third. C# code is okay, I can convert but Visual Basic would be more desirable. Thanks inadvance. Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
thenerd Posted July 1, 2005 Posted July 1, 2005 Not sure for a pocket PC, but here's code for drawing a bunch of bitmaps to a bitmap and then drawing that bitmap to the form for a windows app. dim formg as graphics dim g as graphics dim backbitmap as bitmap dim bitmap1 as bitmap dim bitmap 2 as bitmap private sub form1_load(dfjkasdjf)dsfad formg = me.creategraphics backbitmap = new bitmap(form1.width,form1.height) '^ Set the size of the bitmap g = graphics.fromimage(backbitmap) bitmap1 = new bitmap("C:\location\of\bitmap1.bmp") bitmap 2 = new bitmap("C:\location\of\bitmap2.bmp") end sub private sub form1_paint(dfasdfasdf)dafsd 'or any other sub for that matter g.drawimage(bitmap1,50,50) 'bitmap, x location, y location g.drawimage(bitmap2,12,70) formg.drawimage(backbitmap,0,0) end sub Quote
Leaders Iceplug Posted July 1, 2005 Leaders Posted July 1, 2005 I use this method all of the time to draw my pictures: I have discussed it (the method) here: http://iceplug.vwebservices.com/cngdi3.htm But, what you do is you have two bitmaps and a graphics object. Bitmap backup; Bitmap somepic; Graphics gfx; somepic = new Bitmap("filename.ext"); backup = new Bitmap(width, height); gfx = Graphics.FromImage(backup); To draw somepic to backup: gfx.DrawImage(somepic, 0, 0); :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
Nate Bross Posted July 15, 2005 Author Posted July 15, 2005 I don't know if I should make a new thread or not, I doubt it. I was wondering is there a way to draw a bitmap transparently? IE. I have a bitmap with a black background and I want any black to show up transparently but the rest of my image to display at full opacity? Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Nate Bross Posted July 15, 2005 Author Posted July 15, 2005 Exactly what I was looking for. I was looking in the wrong place for that method. Issue Resolved. Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
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.