Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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.

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted

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

  • Leaders
Posted

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);

:)

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

  • 2 weeks later...
Posted
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?

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted
Exactly what I was looking for. I was looking in the wrong place for that method. Issue Resolved.

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...