Click here to Skip to main content
13,349,032 members (65,749 online)
Click here to Skip to main content
Add your own
alternative version


65 bookmarked
Posted 18 Oct 2005

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

, 6 Jul 2007
Rate this:
Please Sign up or sign in to vote.
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

Sample Image - revolution.jpg


A lot of coders (including myself before) have given up working with PNG because it's not so easy to make PNG background image to work smoothly. However, PNG is a very good image format which allows you to use transparency with alpha-blending feature. This article will show you how to make PNG work and the advantage of using it in creating animation.

Secret inside

clsTungPngAnimation inherits the abstract class clsTungAnimation since we intend to have many of the same functions in clsTungPngAnimation and clsTungBmpAnimation. All these classes can be found in clsTungAnimation.cs

frmAnimation.cs (for PNG) and frmBmpAnimation.cs (for BMP) are where picture frames will appear in. If we use PNG, this function must be used to make the form transparent but still can keep alpha-blending of PNG pictures:

protected override CreateParams CreateParams
        CreateParams cp = base.CreateParams;
        cp.ExStyle |= 0x00080000; //WS_EX_LAYERED    
        return cp;

(This function is inside frmAnimation.cs)

clsBitmapTransparent.cs is used to create PNG transparent background for the form.

clsBitmapRegion.cs is used to create a region of a form from loading BMP images so that images will appear transparent.

Trung tam di dong qui tu cac cua hang lon nhat Vietnam


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


About the Author

Team Leader
Vietnam Vietnam


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


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


    • 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 ...


    • 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

You may also be interested in...


Comments and Discussions

GeneralAnother solution, but controls not seen Pin
eusta26-Nov-07 11:02
membereusta26-Nov-07 11:02 
GeneralRe: Another solution, but controls not seen Pin
eusta27-Nov-07 5:57
membereusta27-Nov-07 5:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180111.1 | Last Updated 6 Jul 2007
Article Copyright 2005 by nguyenthanhtungtinbk
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid