?
Solved

Drawing Graphics Objects using GDI+ in VB6.0

Posted on 2004-05-01
5
Medium Priority
?
4,056 Views
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.



0
Comment
Question by:CyberKings2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 6

Accepted Solution

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

http://www.vbaccelerator.com/home/VB/Code/vbMedia/Using_GDI_Plus/GDIPlus_Helper/article.asp

A Link is referenced in the article that demonstrates this.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=42861&lngWId=1

-Andrew
0
 
LVL 2

Expert Comment

by:kouroshparsa
ID: 11199914
How about:
                Picture.line(x1,y1)-(x2,y2).vbred,BF
         or    Pset(x,y)
         or    Circle(x,y),r
0
 
LVL 2

Expert Comment

by:kouroshparsa
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!
0
 
LVL 6

Expert Comment

by:LunaSkye
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:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=BFC0B436-9015-43E2-81A3-54938B6F4614

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

-Andrew
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month13 days, 2 hours left to enroll

777 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