Well, okay... no need to capture from the screen.
I have found a method that might be of interest for some of you, so I´ll
share ma idea:
----8<----
Public Function FakeTransparent(ByRef bmp As Bitmap, ByVal bgcolor _
As Color) As Bitmap
Dim tmpBMP As New Bitmap(bmp.Width, bmp.Height)
Dim attr As New System.Drawing.Imaging.ImageAttributes
Dim g As System.Drawing.Graphics = Graphics.FromImage(tmpBMP)
Dim fillRct As New Rectangle(0, 0, bmp.Width, bmp.Height)
Dim brsh As SolidBrush = New SolidBrush(bgcolor)
g.FillRectangle(brsh, fillRct)
Dim c As Color = bmp.GetPixel(1, 1)
attr.SetColorKey(c, c)
Dim dstRect As New Rectangle(0, 0, bmp.Width, bmp.Height)
g.DrawImage(bmp, dstRect, 0, 0, bmp.Width, bmp.Height, _
GraphicsUnit.Pixel, attr)
Return tmpBMP
End Function
---->8----
Hope that´ll be helpfull for someone. It works quite well until now and
gives a simple possibility to change backcolor of an image at runtime and
then use it e.g. in a PictureBox.
Any suggestions to make the function more usefull are greatly appreciated
--
Danyel Meyer
-------------------------------------------
dialog-it GmbH
Röllinghäuser Strasse 55a
31061 Alfeld/Leine
Tel +49 (0) 5181 900 814
Fax +49 (0) 5181 900 815
E-Mail danyel.meyer <at> dialog-it.de
"Danyel Meyer - dialog-it GmbH dialog-it.de>" <info<at> schrieb im
Newsbeitrag news:%(E-Mail Removed)...
> Hallo!
>
> Being quite dissapointed of the transparent-images-issue I´m just working
at
> a workaround. The aim is to draw a rectangle with a SolidBrush in the
needed
> background-color somewhere outside the visible screen, and then drawing an
> image on it, with Imageattributes.setColorKey set to pixel (1,1).
> Now I need to find a possibility how to capture a given region of the
screen
> (through a ectgle-struure) and put it to some stream in order to reuse it
in
> a Bitmap constructor...
>
> Any ideas on that?
> I have found some examples on screen capturing, but they do not work for
me,
> as they use a handle to a control that is to be captured, but I just want
to
> capture some region of the screen...
>
> Many thanks in advance,
> --
> Danyel Meyer
> -------------------------------------------
> dialog-it GmbH
> Röllinghäuser Strasse 55a
> 31061 Alfeld/Leine
>
> Tel +49 (0) 5181 900 814
> Fax +49 (0) 5181 900 815
> E-Mail danyel.meyer <at> dialog-it.de
>
>