Drawing Graphics Objects using GDI+ in VB6.0

Posted on 2004-05-01
Last Modified: 2007-12-19
I need someone's help in drawing graphics objects like Lines, Rectangles, Ellipses using GDI+ dll in VB6.0. I have explored the web and found a few sample application and wrapper classes but I need simple code for drawing graphics objects only. I need a way to handle these objects with VB6 Image control.

Also I need to merge multiple Transparent GIF images into one image overlaped on each other but retaining the transparency.

Please help me out urgently.

Question by:CyberKings2003
  • 2
  • 2

Accepted Solution

LunaSkye earned 125 total points
ID: 10967110
Here is a good article on using GDI+ Type library and Directly calling from VB6, It also explains the danger in doing this.

A Link is referenced in the article that demonstrates this.


Expert Comment

ID: 11199914
How about:
         or    Pset(x,y)
         or    Circle(x,y),r

Expert Comment

ID: 11199923
You can put a picture box in an image control, if you insist to use image control...any way, pictureBox does a lot more!

Expert Comment

ID: 11250677
If you want to use GDI+ you have to get the DLL with all the GDI+ Functions in it.

This is available at Microsoft:

Once you have this, you have to do standard function declaration in vb.. Such as
"Public Delcare Function XXXXX Lib "GdiPlus.dll" (etc...."

The only problem is that this library was written for .Net.. It uses function overloading.. Meaning that there can be MANY functions of the same name, the only difference is that one will have different arguments. In .NET the entire function signature is made up of name and arguments.  Not just name like COM stuff (vb6)

Also, .NET uses constructors.. COM doesnt.. This measn that when you craete objects, there can be parameters passed in to create them.. whereas in COM (vb6) you have Set x = New Object.. no room for constructor parameters..

Because of this, it is necessary to write a "Wrapper" class in VB..  This would account for all the different instances in the .NET world of GDIPLUS.. it would expose fucntions to you in VB6 that would have different names (Comply with COM rules), and then pass the correct things on to the GDIPLUS Library.

I hope this helps..


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need VBS version of Excel date conversion 4 64
vb script Microsoft Word tables portion of based on bookmark, count and add rows 1 47
Validating VB6 Function 19 56
Help me. 3 43
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now