Capture part of the PocketPC-screen?

  • Thread starter Thread starter Danyel Meyer - dialog-it GmbH
  • Start date Start date
D

Danyel Meyer - dialog-it GmbH

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
 
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
 
I was looking for some posts on capturing screens when I came across ur post. Where do I get sample codes for obtaining screen shots

----- Danyel Meyer - dialog-it GmbH dialog-it. wrote: ----

Hallo

Being quite dissapointed of the transparent-images-issue I´m just working a
a workaround. The aim is to draw a rectangle with a SolidBrush in the neede
background-color somewhere outside the visible screen, and then drawing a
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 scree
(through a ectgle-struure) and put it to some stream in order to reuse it i
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 t
capture some region of the screen..

Many thanks in advance
--
Danyel Meye
-------------------------------------------
dialog-it Gmb
Röllinghäuser Strasse 55
31061 Alfeld/Lein

Tel +49 (0) 5181 900 81
Fax +49 (0) 5181 900 81
E-Mail danyel.meyer <at> dialog-it.d
 
Back
Top