bitblt Function in VB 2005

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

    bitblt Function in VB 2005

    Is there a way to use the windows bitblt function in a VB 2005 app? bitblt
    requires device context parameters for the source and destination controls
    but those are not used in VB 2005. Is there some way around this? I have a
    program that uses a timer ... when it fires I want to copy a small block on
    the screen to a particular location.

    Thanks



  • Patrice

    #2
    Re: bitblt Function in VB 2005

    Have you checked the System.Drawing namespace ?

    Basically .NET is about providing access to OS capabilities as a library of
    classes (that do not necessarily model the underlying API). For device
    context, try System.Drawing. Graphics...

    --
    Patrice

    "fripper" <young@indiana. edu> a écrit dans le message de
    news:ObGHWgvNGH A.1180@TK2MSFTN GP09.phx.gbl...[color=blue]
    > Is there a way to use the windows bitblt function in a VB 2005 app?[/color]
    bitblt[color=blue]
    > requires device context parameters for the source and destination controls
    > but those are not used in VB 2005. Is there some way around this? I have[/color]
    a[color=blue]
    > program that uses a timer ... when it fires I want to copy a small block[/color]
    on[color=blue]
    > the screen to a particular location.
    >
    > Thanks
    >
    >
    >[/color]


    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: bitblt Function in VB 2005

      "fripper" <young@indiana. edu> schrieb:[color=blue]
      > Is there a way to use the windows bitblt function in a VB 2005 app?
      > bitblt requires device context parameters for the source and destination
      > controls but those are not used in VB 2005. Is there some way around
      > this? I have a program that uses a timer ... when it fires I want to copy
      > a small block on the screen to a particular location.[/color]

      If you cannot use the 'Graphics' object to blit the bitmap, you can use a
      'Graphics' object to get and release a device context handle (methods
      'GetHdc', 'ReleaseHdc').

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://classicvb.org/petition/>

      Comment

      • Dennis

        #4
        RE: bitblt Function in VB 2005

        Here's a bit of code using bitblt and the Graphics object..should work in
        2005 but don't know since I use 2003:

        Private Function CopyRect(ByVal Src As Graphics, ByVal RectF As Rectangle)
        As Bitmap
        'Create Empty BitMap in Memory
        Dim srcBmp As New Bitmap(RectF.Wi dth, RectF.Height, Src)
        Dim srcMem As Graphics = Graphics.FromIm age(srcBmp)
        'Get Device contexts for Source and Memory Graphics Objects
        Dim hdcSrc As IntPtr = Src.GetHdc
        Dim hdcMem As IntPtr = srcMem.GetHdc
        'Get The Picture inside the Rectangle
        BitBlt(hdcMem, 0, 0, RectF.Width, RectF.Height, hdcSrc, RectF.X,
        RectF.Y, 13369376)
        'Return Clone of the BitMap
        Dim rb As Bitmap = CType(srcBmp.Cl one(), Bitmap)
        'Clean Up
        Src.ReleaseHdc( hdcSrc)
        srcMem.ReleaseH dc(hdcMem)
        srcMem.Dispose( )
        srcMem.Dispose( )
        Return rb
        End Function
        --
        Dennis in Houston


        "fripper" wrote:
        [color=blue]
        > Is there a way to use the windows bitblt function in a VB 2005 app? bitblt
        > requires device context parameters for the source and destination controls
        > but those are not used in VB 2005. Is there some way around this? I have a
        > program that uses a timer ... when it fires I want to copy a small block on
        > the screen to a particular location.
        >
        > Thanks
        >
        >
        >
        >[/color]

        Comment

        Working...