GETPIXEL API

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Serdar C.

    GETPIXEL API

    ok i searched the internet for this api and i found the
    usage of getpixel api like this:
    getpixel(exampl e.hdc,x,y)
    but i cant find any property about this "hdc".. that does
    that hdc 's equal in vb.net??? thanx for helping..
  • Ken Tucker

    #2
    Re: GETPIXEL API

    Hi,

    The graphics object has a gethdc method. You must manually release
    the hdc when you are done with it.

    Private Sub Form1_Paint(ByV al sender As Object, ByVal e As
    System.Windows. Forms.PaintEven tArgs) Handles MyBase.Paint

    Dim g As Graphics = e.Graphics

    Dim hdc As IntPtr = g.GetHdc

    ' Do something with the hdc

    g.ReleaseHdc(hd c)

    End Sub

    Ken
    ------------------
    "Serdar C." <serdarc@intera ktif.gen.tr> wrote in message
    news:023d01c36c 6a$267b64e0$a00 1280a@phx.gbl.. .[color=blue]
    > ok i searched the internet for this api and i found the
    > usage of getpixel api like this:
    > getpixel(exampl e.hdc,x,y)
    > but i cant find any property about this "hdc".. that does
    > that hdc 's equal in vb.net??? thanx for helping..[/color]


    Comment

    • Skevmeister

      #3
      Re: GETPIXEL API

      I have never used the getpixelapi, but hdc normally means that it requires a
      handle into the object that you are trying to manipulate.

      Normall you would have to calls one to get the Windows Handle and return it
      as a long and then pass that long through the call



      "Serdar C." <serdarc@intera ktif.gen.tr> wrote in message
      news:023d01c36c 6a$267b64e0$a00 1280a@phx.gbl.. .[color=blue]
      > ok i searched the internet for this api and i found the
      > usage of getpixel api like this:
      > getpixel(exampl e.hdc,x,y)
      > but i cant find any property about this "hdc".. that does
      > that hdc 's equal in vb.net??? thanx for helping..[/color]


      Comment

      • Skevmeister

        #4
        Re: GETPIXEL API

        OK, Back again.




        Shows an example for this function, and an explanation of the hdc (Handle
        for a Device Context)

        Hope this helps.

        Alixx

        "Serdar C." <serdarc@intera ktif.gen.tr> wrote in message
        news:023d01c36c 6a$267b64e0$a00 1280a@phx.gbl.. .[color=blue]
        > ok i searched the internet for this api and i found the
        > usage of getpixel api like this:
        > getpixel(exampl e.hdc,x,y)
        > but i cant find any property about this "hdc".. that does
        > that hdc 's equal in vb.net??? thanx for helping..[/color]


        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: GETPIXEL API

          Hello,

          "Serdar C." <serdarc@intera ktif.gen.tr> schrieb:[color=blue]
          > ok i searched the internet for this api and i found the
          > usage of getpixel api like this:
          > getpixel(exampl e.hdc,x,y)
          > but i cant find any property about this "hdc".. that does
          > that hdc 's equal in vb.net??? thanx for helping..[/color]

          If you want a hDC to the form, use this code:

          \\\
          Dim g As Graphics = Me.CreateGraphi cs()
          Dim hDC As IntPtr = g.GetHdc
          ..
          ..
          ..
          g.ReleaseHdc(hD C)
          g.Dispose()
          ///

          HTH,
          Herfried K. Wagner
          --
          MVP · VB Classic, VB .NET
          Die Website von H. Wagner zu .NET, Visual Basic .NET und Classic Visual Basic.



          Comment

          • Armin Zingler

            #6
            Re: GETPIXEL API

            "Serdar C." <serdarc@intera ktif.gen.tr> schrieb[color=blue]
            > ok i searched the internet for this api and i found the
            > usage of getpixel api like this:
            > getpixel(exampl e.hdc,x,y)
            > but i cant find any property about this "hdc".. that does
            > that hdc 's equal in vb.net??? thanx for helping..[/color]

            Pass the return value of Graphics.GetHdc . You get a graphics object in sub
            OnPaint/Paint event (e.graphics) or create a new one using
            MyControl.Creat eGraphics. (call it's dispose method after calling getpixel)


            --
            Armin

            Comment

            • Serdar C.

              #7
              GETPIXEL API

              Thanx So Much For Helping MY Program Is Working Now :)
              ur #1!

              Comment

              • Cor

                #8
                Re: GETPIXEL API (not an answer is already given, just a try for a joke)

                Everybody did give an answer except the specialist the Über Geek


                Comment

                Working...