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:
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)
The clarion declaration looks like this:
ShowColorDialog PROCEDURE(LONG lastSelectedColor),LONG,NAME('ShowColorDialog'),PASCAL,RAW,DLL(TRUE)
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.
|Updated:||September 20, 2011|