Important alert: (current site time 7/16/2013 2:34:55 AM EDT)
 

winzip icon

ART2GUI - A tribute to the VISUAL in VB6 by Light Templer

Email
Submitted on: 12/6/2006 11:50:08 AM
By: Light Templer 
Level: Intermediate
User Rating: By 38 Users
Compatibility: VB 5.0, VB 6.0
Views: 23570
(About the author)
 
     This usercontrol is a very interactive replacement for old VB shape control. Interactive just in IDE, the end user of an app gets the nice design only. But the programmer maybe gets the most interactive VB usercontrol ever ;-) ! Adjust gradient parameters, postions, designs directly on the screen, no need to use the property box for every single value. Thx to Carles P.V. we have fantastic gradients and thx to Lavolpe we have MANY fancy forms for modern screen designs. Anti-aliased circles, endless combinations of colors with shapes are inviting to play arround with. All put together in a selfcontained, ownerdrawn and documented usercontrol (without any subclassing or timers) by Light Templer. Enjoy ;-) _________ UPDATE 1: (1) Fixed the error raised when drop a new control error onto form with 'Break on all Errors' switch activated. (2) Added a VB5 "version" - Its totally the same control just stripped out the usercontrol property VB5 don't have (ClipBehavior). Sorry for just a simple demo form here. _________ UPDATE 2: Rebuild the demo form and added a 2nd (more serious) demo as requested. _________ UPDATE 3: Fixed the problem coming from german VB version (storage format of single var properties in .frm demo file) with a universal small function to get the value in all cases. _________ UPDATE 4: Finally got this strange error of don't working on some systems! A BIG sorry! Now it should be fine on every VB / SP version.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 17 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

7/4/2006 12:34:56 PMFoundations Software

Nice submission

Useful as colorful buttons however click event would need to be added.
(If this comment was disrespectful, please report it.)

 
7/4/2006 12:43:48 PMOption Explicit

You know I'm gonna be in nerd heaven with this one... absolutely brilliant submission. Glad to see you haven't totally abandoned VB6 in your efforts to master vb.net. A phenomenal ownerdrawn self-contained usercontrol.
(If this comment was disrespectful, please report it.)

 
7/4/2006 6:58:02 PMferd(z)

If i only have this idea a long time ago ...

(If this comment was disrespectful, please report it.)

 
7/5/2006 1:22:26 AMT Jackson

VB5 users don't bother. :(
(If this comment was disrespectful, please report it.)

 
7/5/2006 2:44:20 AMLight Templer

Thank you for any votes!
(But comments are welcome, too ;-) )
Regards from sad soccer-Germany ;-)
LiTe
(If this comment was disrespectful, please report it.)

 
7/5/2006 3:17:15 AMLight Templer

UPS - there ARE comments! Maybe they were in PSC pipe when I wrote my note, sry ;-)
LiTe
(If this comment was disrespectful, please report it.)

 
7/5/2006 3:42:02 AMRobert Rayment

Clever stuff *****. I notice that not all the buttons show up when Edit is selected on the smaller non-rectanglular shapes. Can't understand why Trent cannot run in VB5 - haven't found any specific VB6 instructions. Even sadder soccer-England!
(If this comment was disrespectful, please report it.)

 
7/5/2006 4:17:07 AMLight Templer

Thx Robert! And you 're right: FIRST design the gradients, THAN the shape arround! Because of its done by see-thru regions, its not (easy) possible to draw the grabbers outside the shape.
____ There are NO VB6 elements used here and no W2K or XP API calls, so this uc should run from WIN95 up to Vista and from VB5 to VB6. On trouble: Plz give me details here.
Kind regards - LiTe
(If this comment was disrespectful, please report it.)

 
7/5/2006 5:57:31 AMRichard Mewett

Very original and inventive. The most interactive VB usercontrol ever? Seems like the answer is Yes! *****
(If this comment was disrespectful, please report it.)

 
7/5/2006 6:04:03 AMRobert Rayment

LiTe: I was referring to T Jackson's comment. I have VB6 - no problem.
(If this comment was disrespectful, please report it.)

 
7/5/2006 8:05:12 AMTerriTop

This blows me away!!! Being a very graphical person anyhow this simply makes GUI devlopment even more "visual" in VB6....Nice Job!! TerriTop
(If this comment was disrespectful, please report it.)

 
7/5/2006 9:23:12 AMOption Explicit

Trent (T Jackson) you gotta get your hands on a free copy of VB6, you seem to be missing out on all the cool submissions in this world!

Regards from soccer-apathetic U.S. :D


(If this comment was disrespectful, please report it.)

 
7/5/2006 10:11:10 AMZhu JinYong

Can anyone make any practical GUI examples using this control?5 Stars to Light T.
(If this comment was disrespectful, please report it.)

 
7/5/2006 10:23:29 AMHeriberto Mantilla Santamaria

my God is really cool but in some occasions the edition mode doesn't work in the IDE, anyway my 5 goals.

Regards, I'm sad for Germany also but more for my country Colombia that neither to the World cup was.
(If this comment was disrespectful, please report it.)

 
7/5/2006 12:10:42 PMMario Villanueva

Wow!!! Interesting submition. 5* (for the interactive thing!)
(If this comment was disrespectful, please report it.)

 
7/5/2006 12:28:15 PMLight Templer

Heriberto, in what occasions? Edit mode is always possible. Plz give me some details to follow you.
(If this comment was disrespectful, please report it.)

 
7/5/2006 12:43:56 PMBroken Arrow

Templer!!! Are you a human at all!!! You have gotten more than 5 million balls ;)
(If this comment was disrespectful, please report it.)

 
7/5/2006 1:06:58 PMRobert Rayment

LiTe: It has been brought to my attention that what VB5 lacks is the SP1,2,,,6 updates for VB6. This means that some VB6 progs may run on VB5 but other's wont. Even in VB6 there could be problems if it has not been updated with the service packs. What I dont know is what SPs are necessary for what bits of code. Some of the updates seem to be particular for databases but others are not!!
(If this comment was disrespectful, please report it.)

 
7/5/2006 3:56:55 PMHeriberto Mantilla Santamaria

Hi LiTe, I can see the edit mode but it's very slow to show (30sec or more).

You can check out this part, my PC is AMD 2.4GHz, 512RAM, OS WinXP SP2 and VB6.
(If this comment was disrespectful, please report it.)

 
7/6/2006 4:56:23 AMRiccardo Cohen

Light Templer nice, from what I heard, but having a little problem with using this. First right or left click do nothing (no edit; it is just like I am clicking on pictures/images). Second adding a new shape to this window results in a Runtime error '9': Subscript out of range... and this redirects to Sub PaintMemToDC (Paint it!).
Regards Riccardo
(If this comment was disrespectful, please report it.)

 
7/6/2006 6:05:14 AMLight Templer

Riccardo, (1) plz give me details to your used VB version with servicepack level and Win OS. (2) Clicking in IDE! onto EVERY control gives you the context menu. This doesn't work on your system? We will get this to run for you, be sure ;-) Regards - LiTe
(If this comment was disrespectful, please report it.)

 
7/6/2006 6:22:44 AMRiccardo Cohen

First: ok
Second: remains :-)
(If this comment was disrespectful, please report it.)

 
7/6/2006 7:48:30 AMT Jackson

There's quite a few VB6 projects that I can manually load and there's a heck of a lot that I can't. I get immediate compile errors with this UC straight after I place it on a form.
(If this comment was disrespectful, please report it.)

 
7/6/2006 9:51:28 AMRiccardo Cohen

- Windows Version: Windows Xp 5.1.2600 Service Pack 2 Build 2600.
- Visual Basic Version: 6.0 (SP6)
Btw. did't read the IDE message on the first, but works great. Only one error remains, when new control is added.

Regards Riccardo.
(If this comment was disrespectful, please report it.)

 
7/6/2006 10:50:50 AMLight Templer

Riccardo, with UPDATE-1 this problem is fixed. Comes from different IDE behavior setting on error handling. _____
T Jackson, I have added a VB5 "version" for you.
Plz let me know if any other problems exists, thx folks!
LiTe
(If this comment was disrespectful, please report it.)

 
7/6/2006 10:51:14 AMOption Explicit

I knew about Carles radial gradients already! A nice piece of code. But what was the problem you were having with it? I sometimes get an error when I try to apply a radial gradient to a very narrow area (not in your code, rather in my projects using Carles' original radial gradient code).
(If this comment was disrespectful, please report it.)

 
7/6/2006 11:04:39 AMT Jackson

Still the same. I get the usual invalid key when I try and load the project. Compile error with UC.
(If this comment was disrespectful, please report it.)

 
7/6/2006 11:04:51 AMLight Templer

It wasn't a bug, it was to the parameter definition: Original solution was to draw the circle 'inside' the given rectangle, resulting in empty corners. New version is 'arround' the rectangle so the whole area is filled.
And I was happy ;-)
(If this comment was disrespectful, please report it.)

 
7/6/2006 11:47:34 AMjames kahl

an excellent piece of work that can be utilized in many ways to put asome pizazz into any application. You get my 5 as usual. Keep it up.
(If this comment was disrespectful, please report it.)

 
7/6/2006 1:32:24 PMLight Templer

T Jackson, are you sure you used the special version in VB5 subdir? This one is build and saved in VB5 last Servicepack ... ! So what can I do more?
(If this comment was disrespectful, please report it.)

 
7/6/2006 2:09:50 PMRobert Rayment

LiTe: Not sure what you've done with the latest version. It makes an error log file (it did before but it could be made to work) with invalid GradArea Properties. It runs but nothing happens when right-clicking on the shapes. Also the VB5 version says it must start in Sub Main.
(If this comment was disrespectful, please report it.)

 
7/6/2006 3:12:40 PMRobert Rayment

LiTe: On right-clicking a shape it goes to the UC MouseDown but .flgEditMode=False not True so nothing happens?
(If this comment was disrespectful, please report it.)

 
7/6/2006 3:39:46 PMLight Templer

Robert, thx for info, but I 've just downloaded last ZIP to get this sure: I don't have any problems even with error handling set to 'Break on all'. Any more hints? To check VB5 version I need my machine at the office with VB5 so its tomorrow. Sorry for any trouble, seems difficult to compare to other IDE enviroments, but we 'll get this! ;-)
(If this comment was disrespectful, please report it.)

 
7/6/2006 4:11:48 PMLight Templer

Just checked VB5 version with VB6: Easy to get this run, just select Form1 to start modul in project properties.
(If this comment was disrespectful, please report it.)

 
7/7/2006 3:09:45 AMRobert Rayment

LiTe: Apart from producing an error log file on first loading it is all OK now.
(If this comment was disrespectful, please report it.)

 
7/7/2006 5:27:13 AMLight Templer

=== NEW UPLOAD OF UPDATE 1 ===
(1) The start object of the VB5 demo is changed now to Form1.
(2) I checked last submission from front and back, starting with new projects in empty folders and using the demo project, switching error handling in IDE both ways: Sorry, I didn't get any errors, Robert. So NO CHANGE in VB6 part.
(If this comment was disrespectful, please report it.)

 
7/7/2006 6:25:38 AMdreamvb

Nise idea should come in very ufull for something. do you think it maybe ok for me to use this in a Bussiness Card app I am makeing? 5 form me*****
(If this comment was disrespectful, please report it.)

 
7/7/2006 7:28:23 AMjjprogrammer

Your commitment to helping others is astounding and increasingly rare among the programming community. This alone would get my vote. Great UC. --Heavy-hearted diehard U.S. soccer fan.(yes, there are many!)
(If this comment was disrespectful, please report it.)

 
7/7/2006 7:53:09 AMLight Templer

To dreamvb: Its on PSC and so its in public domin. Feel free to use it in your project. ;-)
To all: Once more, many thx for kind words and votes!
Regards - LiTe

(If this comment was disrespectful, please report it.)

 
7/7/2006 12:39:05 PMJakeBullet

WOW!!! Very nice and nice clean codeing. Don't quite know what to do with it just yet but I will find something. 5 big cool balls from me. VB6 Lives!
(If this comment was disrespectful, please report it.)

 
7/7/2006 12:42:01 PMJohnGalt

looks like awesome work! unfortunately, I'm having the same issue with the form errors and generated log that a few others have mentioned (I'm using VB6). The log has about 30 errors. Here's the first: "Line 113: Property GradArea-Position1 in ucArt2Gui5 had an invalid value."
(If this comment was disrespectful, please report it.)

 
7/7/2006 2:25:04 PMLight Templer

John, seems really puzzeld this one! Plz try this: Start a new project with an empty form, include Art2GUI and drop it onto this form to play arround with it. Maybe including of the demo form is possible, too ...
(If this comment was disrespectful, please report it.)

 
7/9/2006 7:16:16 PMaz1d

Hey Lite, I thought you didn't want to use vb6? When did you change over from 5?

Pretty incredible uc. Can't think of any of my projects to use it in yet, but hopefully it will inspire me.
-az1d
(If this comment was disrespectful, please report it.)

 
7/10/2006 3:11:00 AMLight Templer

az1d, I 've changed to VB6 one year ago and since vb.net 2005 I live in both of this worlds. ;-)
btw: Today I will upload UPDATE 2, hoping all bugs are fixed ...
Kind regards - LiTe
(If this comment was disrespectful, please report it.)

 
7/10/2006 10:42:05 AMCarles P.V.

LiTe, glad to *see* you again, and glad to see so nice use of ALL gradient routines :-) Moreover, what I consider really original is how you manage 'Edit' mode, allowing user to 'define' appearance in a WYSIWYG way, without making use of any extra property-page module. My 5*! -- Regards
(If this comment was disrespectful, please report it.)

 
7/11/2006 4:17:04 AMLight Templer

After trying to reproduce any error and mailing with many people: I have no way to fix something I cannot see. And I checked my code very deep - tried it with the downloaded ZIP - no error for me, seems all fine ...


(If this comment was disrespectful, please report it.)

 
7/11/2006 4:51:53 PMSteppenwolfe

Lite, (and others), .frm file is corrupted, this is reason for the problem. Simply add a new form, copy all controls from original and paste to new. Then remove old form and save the new one as frmDemo, then it works fine.
(If this comment was disrespectful, please report it.)

 
7/19/2006 8:35:47 AMLight Templer

(Back from vacances)
John, no problem to re-upload that. But whats going wrong here? Its very strange: Seems like some people gets the problem with the corrupted form file and many don't have a problem with it. Speaking for myself: Downloading it into a new empty folder, unzipping, doubleclicking the vbp: Bingo - no error, no logfile ...
Any ideas?
(If this comment was disrespectful, please report it.)

 
7/19/2006 8:29:46 PMSteppenwolfe

Hi Lite
What did you zip it with? What os are you using? What sp for vb? Could be a number of things.. but after changing form, errors did not return. Email me if you want to pre-test new rev.
(If this comment was disrespectful, please report it.)

 
7/20/2006 7:24:13 AMLight Templer

Hope ZIP with UPDATE-2 gives freedom to this strange effect of partial errors on demo form ;-)
Plz give me feedback, thx!
Regards - LiTe
(If this comment was disrespectful, please report it.)

 
7/20/2006 11:09:43 AMRichard Mewett

LiTe - I think I have worked out the problem! There is no corruption of the form at all - the problem is that in Germany you use a "," rather than a "." for decimal seperator. Therefore your floating point properties (GradArea-Position etc) are invalid when loaded on some machines - such as mine in the UK.
(If this comment was disrespectful, please report it.)

 
7/20/2006 11:11:07 AMRichard Mewett

btw Nice update - and the "problem" is easily fixed with a little tweaking in Notepad :)
(If this comment was disrespectful, please report it.)

 
7/20/2006 12:19:50 PMLight Templer

Richard, your the best! Many thx to work this out! btw: An ugly thing - that means switching to strings to save single var ... :-(

(If this comment was disrespectful, please report it.)

 
7/20/2006 3:06:32 PMJohnGalt

Just did a mass replace of commas with periods in the forms per RM's above suggestion. Now VB doesn't throw errors anymore; however, the colored ball handles still don't appear in the development environment for me -- just the usual square handles that surround every object.
(If this comment was disrespectful, please report it.)

 
7/20/2006 5:11:19 PMSteppenwolfe

Richard - this still does not explain why.. when I move all controls to a new form, I no longer get any error messages, care to explain the logic here?
(If this comment was disrespectful, please report it.)

 
7/20/2006 5:25:54 PMSteppenwolfe

Also, running code fixer on this project came up with the 'corrupted file' message, hence the warning..
(If this comment was disrespectful, please report it.)

 
7/20/2006 5:34:25 PMRichard Mewett

^John, I think the explantion is simple. When you copy the Controls VB is unable to determine LiTes original properties, hence the pasted Controls use the defaults. The new form therefore does not contain invalid properties - they are saved in the format of the users locale. I can't comment on Code Fixer, I don't use it (MZ-Tools is the only code scanner I have ever needed).
(If this comment was disrespectful, please report it.)

 
7/20/2006 6:06:36 PMJohnGalt

Apparently all I needed to do was restart VB and reload the edited forms -- now everything's peachy. At any rate, for those having similar trouble, follow Richard's advice if you want to run LiTe's demo (replace all commas with periods in the form using an external text editor). Anyway, genius stuff, LiTe. Now that I've got it running, I can finally give you your much-deserved vote.
(If this comment was disrespectful, please report it.)

 
7/20/2006 8:27:32 PMZhu JinYong

I don't agree what Richard mention 'the problem is that in Germany you use a "," rather than a "." for decimal seperator'.The root problem is Lite's mis-spell 'GradArea-Color','GradArea-Position' and 'GradArea-GradGamma'.They are GradAreaColor,GradAreaPosition,GradAreaGradGamma.
(If this comment was disrespectful, please report it.)

 
7/21/2006 5:54:26 AMLight Templer

Hi Zhu, thanks for your idea to get this fixed. Problem is: It have to be a difference in VB versions because of not everybody has this problem. 'GradArea-Position', spelled with a '-' is a legal property name in VB and the fact that changing the .frm file with a text editor (from ',' to '.' for single values) is enough to avoid the error is the best proof. I will upload a version using strings with a universal conversion and we can forget this ;-)
btw: Has somebody suggestions to the features, is something important missing?
Kind regards - LiTe
(If this comment was disrespectful, please report it.)

 
7/21/2006 7:13:59 AMOption Explicit

LiTe all I can say is that I never experienced a problem (U.S., original VB6 Professional, no updates). So I've been following this debate, but it hasn't affected me. Sounds like Richard figured it out though. Let's get the discussion back to this fabulous piece of code, where it belongs!
(If this comment was disrespectful, please report it.)

 
7/21/2006 9:10:07 AMLight Templer

Option Explicit, many thx for kind words!
Hope thats it, too.
Question: Does anybody know how to change an uc so VB lables and image controls are able to be ON TOP of the uc?
(If this comment was disrespectful, please report it.)

 
7/21/2006 4:20:59 PMCarles P.V.

LiTe, you refer to windowless controls. Simply set intrinsic UC Windowless = True. But this way you only get a rectangular area to play with. If you also want to play with 'transparency' region (non-rectangular *shapes*), then you need to make use of both BackStyle and MaskPicture (on-the-fly monochrome bitmap) properties (plus MaskColor). Never tried, so hope this is the 'how to'. I guess next step could be semitransparency :-)
(If this comment was disrespectful, please report it.)

 
7/22/2006 4:59:36 AMLight Templer

Hi Carles, thank you for this guide! Sounds a little bit like a job for "Mr. Region" LaVolpe ;-) Maybe I 'll send Keith an email ... Imho it should be possible to resuse ART2GUIs region for this 1 bit transparency mask. Would extend the possibilities of usage alot. Kind regards - LiTe
(If this comment was disrespectful, please report it.)

 
7/22/2006 6:04:43 AMLight Templer

RESULT: It was a short trip to reach the limits of ucs: The properties 'EditAtDesignTime' and 'Windowless' are not allowed at the same time ...
Right now I see now way to skip this and to switch to 'Windowless' mode only when starting the app. It seems easier to substitue the label control by something new, too ... ;-)
(If this comment was disrespectful, please report it.)

 
7/29/2006 11:53:57 PMRde

Just one word LiTe - VeryVeryNiceIndeed
(If this comment was disrespectful, please report it.)

 
8/12/2006 12:19:34 PMEric Coleman

does not work, I get errors when loading the project, there is no default form, you can't close the second form which is bad for a demo, and gradients and regions have been done before.
(If this comment was disrespectful, please report it.)

 
12/5/2006 4:16:51 AMNoName

I can't believe this is a contest winner. It doesn't even work. What's missing?
(If this comment was disrespectful, please report it.)

 
12/5/2006 8:52:24 AMLight Templer

NoName, I sent you an email to get details to your problem. Art2GUI runs fine on VB6 SP6 German edition and many others. The bug MS built into format of .frm files (a localization problem: 1.5 is 1,5 in Europe which is very bad for single and double vars on reading...) is fixed by last update. Anybody: Plz contact me if there are onay more problems here. Regards - LiTe
(If this comment was disrespectful, please report it.)

 
12/6/2006 2:56:11 PMLight Templer

NoName leaves cyberspace forever a few minutes after posting this. His email account was a temp account ... ________ Anyway: This one missing statement (only a .Refresh to the usercontrol after drawing) is neccessary on some systems. (And no problem on the other ;-) ) I there are any more problems/questions: Plz let me know! Regards - LiTe
(If this comment was disrespectful, please report it.)

 
12/7/2006 1:06:16 AMMMVS

Wow! you're a natural!
(If this comment was disrespectful, please report it.)

 
12/30/2006 6:26:33 AMRob C

Hi,
I'm in Australia.
XP Pro SP1
VB6 SP5
I get error in IDE, when 'opening' the demo forms. They both give log files with similar errors -
Line 119: Property GradArea-Position1 in ucArt2Gui5 had an invalid value.
Regards,
(If this comment was disrespectful, please report it.)

 
12/30/2006 6:58:03 AMRob C

PS
Did Richard's solution, and it now 'opens' fine.

Thanks for sharing.
(If this comment was disrespectful, please report it.)

 
12/11/2007 12:50:42 PMPaul Rosebush

The only problem I have found is the inability to place a label control on top of a shape, label always goes to the background...shame. Thanks for sharing though
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.