Form based on picture


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Form based on picture

  1. #1
    Shapenko Guest

    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





  2. #2
    Jacob Grass Guest

    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center