Click here to Skip to main content
15,885,985 members
Articles / Mobile Apps / Smartwatch

Create animation in dotNet with alpha-blending PNG images by calling API

Rate me:
Please Sign up or sign in to vote.
3.87/5 (94 votes)
6 Jul 2007 106K   7.3K   65  
This article shows you the advantage of PNG images with alpha-blending feature in creating animation and demonstates how to use PNG images in Framework.NET application by calling API
Imports Microsoft.VisualBasic
Imports System
Imports System.Runtime.InteropServices

Namespace movepng
    Class Win32
        Public Enum Bool
            [False] = 0

            [True] = 1

        End Enum

        Public Structure Point
            Public x As Integer

            Public y As Integer


            Public Sub New(x As Integer, y As Integer)
                Me.x = x
                Me.y = y
            End Sub
        End Structure

        Public Structure Size
            Public cx As Integer

            Public cy As Integer


            Public Sub New(cx As Integer, cy As Integer)
                Me.cx = cx
                Me.cy = cy
            End Sub
        End Structure

        Public Structure BLENDFUNCTION
            Public BlendOp As Byte

            Public BlendFlags As Byte

            Public SourceConstantAlpha As Byte

            Public AlphaFormat As Byte

        End Structure

        Public Const ULW_ALPHA As Integer = 2

        Public Const AC_SRC_OVER As Byte = 0

        Public Const AC_SRC_ALPHA As Byte = 1


        <DllImportAttribute("user32.dll")> _
        Public Shared Function UpdateLayeredWindow(handle As IntPtr, hdcDst As IntPtr, ByRef pptDst As Point, ByRef psize As Size, hdcSrc As IntPtr, ByRef pprSrc As Point, crKey As Integer, ByRef pblend As BLENDFUNCTION, dwFlags As Integer) As Bool
        End Function

        <DllImportAttribute("user32.dll")> _
        Public Shared Function GetDC(handle As IntPtr) As IntPtr
        End Function

        <DllImportAttribute("user32.dll", ExactSpelling:=True)> _
        Public Shared Function ReleaseDC(handle As IntPtr, hDC As IntPtr) As Integer
        End Function

        <DllImportAttribute("gdi32.dll")> _
        Public Shared Function CreateCompatibleDC(hDC As IntPtr) As IntPtr
        End Function

        <DllImportAttribute("gdi32.dll")> _
        Public Shared Function DeleteDC(hdc As IntPtr) As Bool
        End Function

        <DllImportAttribute("gdi32.dll")> _
        Public Shared Function SelectObject(hDC As IntPtr, hObject As IntPtr) As IntPtr
        End Function

        <DllImportAttribute("gdi32.dll")> _
        Public Shared Function DeleteObject(hObject As IntPtr) As Bool
        End Function
    End Class
End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Team Leader
Vietnam Vietnam



PERSONAL DETAILS


Full Name : Nguyen Thanh Tung
Sex : Male
Date of Birth : October 06, 1983
Nationality : Vietnamese


PERSONAL PROFILE

Trustworthy, efficient, capable work under pressure, outgoing person and capable work in a team.



AREA OF EXPERTISE



    • Proficient in Programming: .Net 1.0/1.1/2.0/3.0/3.5 (C#, VB.Net, ASP.Net,
      AJAX, WCF, WWF), VB4/5/6, ASP, PHP, HTML, CSS, Script, XML.
      Experience with Vs Source Safe, Team System, MsBuild, SVN/CVS. Knowledge about
      UnitTest, Test-Driven development.
    • Experience with Databases: SQL Server 2000/2005, MySQL
      4.x/5.x/6.x, Oracle, PostgreSQL, Ms. Access.
    • Experience in EIS: ERP, CRM, SCM ...
    • Experience with Microsoft Products: CRM3/4, Sharepoint
      2003/2007 ...
    • Proficient in OS: Linux (Redhat, Fedora, Mandrake, Suse), Windows (2000/2003
      Server, XP, Vista).
    • Proficient in Graphics (Flash, Photoshop, 3DMax …); Microsoft Office, Visio,
      Microsoft Project.
    • Proficient in Network Devices: Router, Switch, Firewall Server, Mail Server,
      FTP Server, DNS, VPN.
      Experience in Servers: IBM, HP, Sun, Dell ...
    • Familiar with OO and SOA concepts.
    • Knowledge about project management: CMMI, Agile and Scrum, Software
      Engineering, System Analysis and Design, IT Project Management. 
    • Knowledge in Accounting and Finance: Financial Statement, Income
      Statement ...




    MAIN PROJECTS DONE IN THE PAST

    • SMS Gateway.
    • POP3-IMAP-SMTP App.
    • Products Management Sys.
    • Hedge Fund Management Sys.
    • Motion detection.
    • 3D games engine (C# using OpenGL Lib).
    • Video Conference.
    • Information Retrieval.
    • Microsoft CRM3/4
    • Microsoft Sharepoint Portal 2003/2007
    • CMS
    • E-Commerce


Comments and Discussions