Inspired by a recent newsgroup thread and my latest experiments in Clarion –> DotNet interop I have put together a simple program that shows you how to use the Zeta Color Editor from a clarion app!
The Zeta Color Editor is from an article in The Code Project and I have adapted it slightly to include a “Clarion Code” entry control as well as the “HTML code” it comes with. You may remember this control from the awesome InsertClarionColor addin.
This is the complete C# code used to call the Zeta Color Editor:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
using System; using System.Drawing; using System.Windows.Forms; using RGiesecke.DllExport; using ZetaColorEditor.Runtime; namespace ColorPicker { internal static class UnmanagedExports { [DllExport("ShowColorDialog", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)] static Int32 ShowColorDialog(Int32 lastSelectedColor) { string colorstr = string.Empty; using (ColorEditorForm cd = new ColorEditorForm()) { ColorConverter cc = new ColorConverter(); cd.SelectedColor = ColorTranslator.FromWin32(lastSelectedColor); if (cd.ShowDialog() == DialogResult.OK) { return ColorTranslator.ToWin32(cd.SelectedColor); } } return lastSelectedColor; } } } |
The clarion declaration looks like this:
1 2 3 |
MODULE('ColorPicker.dll') ShowColorDialog PROCEDURE(LONG lastSelectedColor),LONG,NAME('ShowColorDialog'),PASCAL,RAW,DLL(TRUE) END |
The zip file contains a clarion 8 solution (app file, etc), compiled exe for the impatient, the C# wrapper (ColorPicker.dll) and the ZetaColorEditor.dll. This should be everything you need to do your own testing. The original source for the ZetaColorEditor is found at the Code Project link at the beginning of this post, my customisations can be found at the clarion-addins google project page.
Download: | ![]() |
---|---|
Version: | 0.1 |
Updated: | September 20, 2011 |
Size: | 852.29 KB |
Downloads: | 691 |