create bitmap with tranparent region

W

Willie jan

Hi,

i try to create a bitmap with transparent regions, but it does not work.
the transparent region turns out to be black.
anybody some ideas??


Dim bmap As Bitmap(100,100,Imaging.PixelFormat.Format32bppPArgb)
Dim g As Graphics = Graphics.FromImage(bmap)
g.Clear(Color.Transparent)
g.DrawRectangle(New Pen(Color.Blue, 10), New Rectangle(10, 10, 80,80))
g.dispose

'do something with the bitmap....
 
K

Ken Tucker [MVP]

Hi,

Dim bm As New Bitmap(100, 100)



Dim g As Graphics = Graphics.FromImage(bm)

g.FillRectangle(Brushes.Blue, 0, 0, 100, 100)

g.FillRectangle(Brushes.Green, 10, 10, 10, 10)

g.FillEllipse(Brushes.Green, 50, 50, 20, 20)

bm.MakeTransparent(Color.Green)

g.Dispose()



Ken

-----------------------------

Hi,

i try to create a bitmap with transparent regions, but it does not work.
the transparent region turns out to be black.
anybody some ideas??


Dim bmap As Bitmap(100,100,Imaging.PixelFormat.Format32bppPArgb)
Dim g As Graphics = Graphics.FromImage(bmap)
g.Clear(Color.Transparent)
g.DrawRectangle(New Pen(Color.Blue, 10), New Rectangle(10, 10, 80,80))
g.dispose

'do something with the bitmap....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top