-
Form based on picture
Hi there!
I am creating a windows form based on a picture. As you know, this was possible
on VB6 (API), using a image from the HD, and then, detecting the first pixel
(GetPixel),it will loop (nested) by all the pixels and any pixel that was
equal to the (0,0) pixel was combined (CombineRgn) and the translated to
transparent, forming a region. Then, that region was associated to the form
(handle - SetWindowRgn Me.Hwnd), forming a form with the picture. I was using
these API:
SetWindowRgn;CreateRectRgn,CombineRgn and GetPixel
and the constant RGN_OR - That creates a union between the regions.
Well, i know about the class Region, but, i am having problems like comparing
the pixels. When i do this:
Dim transparentcolor As Color
TransparentColor = ImageT.GetPixel(0, 0)
For x = 0 To picWidth - 1
For y = 0 To picHeight - 1
Dim ActualColor As Color = ImageT.GetPixel(y, x)
If ActualColor = transparentColor Then
End If
When doing this, VB.NET says the "=" operand is not valid. I am using the
right object to do this effect? I am going well?
I will apreciate some tips to do this effect.
Best regards
Shapenko
-
Re: Form based on picture
You cannot use the '=' operator to compare color because colors are
structures.
Try ActualColor.Equals(TransparentColor) or something to that effect. . .
--
Jacob Grass
Microsoft .NET MVP
"Shapenko" <poland@poland.com> wrote in message
news:3bee91dd$1@147.208.176.211...
>
> Hi there!
>
> I am creating a windows form based on a picture. As you know, this was
possible
> on VB6 (API), using a image from the HD, and then, detecting the first
pixel
> (GetPixel),it will loop (nested) by all the pixels and any pixel that was
> equal to the (0,0) pixel was combined (CombineRgn) and the translated to
> transparent, forming a region. Then, that region was associated to the
form
> (handle - SetWindowRgn Me.Hwnd), forming a form with the picture. I was
using
> these API:
>
> SetWindowRgn;CreateRectRgn,CombineRgn and GetPixel
>
> and the constant RGN_OR - That creates a union between the regions.
>
> Well, i know about the class Region, but, i am having problems like
comparing
> the pixels. When i do this:
>
> Dim transparentcolor As Color
>
> TransparentColor = ImageT.GetPixel(0, 0)
>
> For x = 0 To picWidth - 1
> For y = 0 To picHeight - 1
> Dim ActualColor As Color = ImageT.GetPixel(y, x)
>
> If ActualColor = transparentColor Then
>
> End If
>
> When doing this, VB.NET says the "=" operand is not valid. I am using the
> right object to do this effect? I am going well?
>
> I will apreciate some tips to do this effect.
>
> Best regards
>
> Shapenko
>
>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks