<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>OberonPlace.com Forums - Blogs</title>
		<link>http://forum.oberonplace.com/blog.php</link>
		<description>This forum is devoted to OberonPlace products, CorelDRAW, graphics, user community, and software development</description>
		<language>en</language>
		<lastBuildDate>Wed, 22 May 2013 09:27:58 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://forum.oberonplace.com/images/misc/rss.jpg</url>
			<title>OberonPlace.com Forums - Blogs</title>
			<link>http://forum.oberonplace.com/blog.php</link>
		</image>
		<item>
			<title>Docker or Macro Installer</title>
			<link>http://forum.oberonplace.com/blog.php?b=14275</link>
			<pubDate>Sun, 21 Oct 2012 00:26:35 GMT</pubDate>
			<description>*Introduction* 
 
Now that we have a docker or macro we may wish to install the macro or docker on one or several machines. While you could use the manual approach a simple installer would be nice so that a user could just run it and have the files installed for them. In this post we will build a...</description>
			<content:encoded><![CDATA[<div><b>Introduction</b><br />
<br />
Now that we have a docker or macro we may wish to install the macro or docker on one or several machines. While you could use the manual approach a simple installer would be nice so that a user could just run it and have the files installed for them. In this post we will build a simple installer that will install the docker or macro.<br />
<br />
<b>Needed Software</b><br />
<br />
To create the installer we are going to need a couple of pieces of software, the good news is that they are both free. <br />
<br />
First we need some software to create the actual installer. The software of my choice is: <a href="http://nsis.sourceforge.net/Main_Page" target="_blank">NSIS (Nullsoft Scriptable Install System)</a> Yes this is an older product and has not been updated since 2009, but it still works well even on Windows 8. So go ahead, download and install it. <br />
<br />
Second we need an editor to edit our script that tells NSIS how to create the installer. You could use notepad but I like to have a little syntax formatting and color so I recommend: <a href="http://notepad-plus-plus.org/" target="_blank">Notepad++</a><br />
<br />
<b>Creating an Installer</b><br />
<br />
Installing a docker / macro is normally pretty simple as it is a single .gms file or the docker folder. However, trying to tell a user the exact path this file needs to be placed can be difficult, and if the user is on Windows 7 or 8 the difficultly increases because of the permissions issues. Making an installer can really simplify the process. <br />
<br />
To keep things nice and organized create a new folder with the name of your macro / docker. I normally make the folder on my desktop for easy access<br />
<br />
In this example we will be making an installer for the modified version of Oberon's Color Replacer. You can find the GMS file here:  <a href="http://forum.oberonplace.com/showthread.php?t=1053&amp;page=5" target="_blank">Color Replacer Advanced Remake</a> Place the lf_ColorReplacer29.3.8.gms file into your newly created folder. I also created a simple .ico file with CorelDRAW so the .exe file that is created will have a unique icon. <br />
<br />
Finally place the MakeGMSInstallX4-X6.nsi file into the same folder. Open the file in Notepad++. You might look at all the code and start to get dizzy, don't worry, we are only going to focus on the first couple of lines. <br />
<br />
Find the line that says: !define MyName &quot;MacroName&quot; and change the MacroName to lf_ColorReplacer29.3.8. This needs to match the name of your .gms file or the name of the folder that would have your files for a docker. <br />
<br />
Next we modify: !define Icon &quot;Icon&quot;, change Icon to the name of the icon you created. I named my Icon the same thing so I change this to lf_ColorReplacer29.3.8 also, if this file cannot be found the installer will look for icon.ico, I have included the icon.ico file in the zip file at the end of this article.<br />
<br />
Finally we have: BrandingText &quot;My Company Here&quot;, change to your company name or personal name or whatever text you would like to show in the installer. <br />
<br />
Save the file. Close the editor. Now find the .nsi file we just modified and right click. If you have installed NSIS you should the option to Compile NSIS Script. Go for it! You should get a dialog that says it completed successfully and you will get a newly created .exe file. This .exe file is your installer. <br />
<br />
Run the .exe and you should get a dialog to select the components to install.<blockquote><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=19" border="0" alt="" /></blockquote>All that code in the .nsi file is to detect which versions of CorelDRAW you have running on the machine, and if any CorelDRAW is open to notify you to close it before installing. As you can see from the screenshot I only have CorelDRAW X6 64-bit on this machine. <br />
<br />
Check which versions you want the macro to install to and click Install. If the file is already there you should get a warning to overwrite, if no file is there the installer should complete successfully. It should be just that easy.<br />
<br />
<b>Docker Installer</b><br />
<br />
To create a docker installer use the MakeDockerInstallX4-X6.nsi file, and have your docker folder in the same folder as the .nsi file. The docker name should be changed to match the name of the docker folder so it can find the files. You can have as many files as you like in the folder, the installer will grab them all.<br />
<br />
<b>Conclusion</b><br />
<br />
In this post we created an installer to install the lf_ColorReplacer29.3.8 macro. Feel free to modify the .nsi file to make the script smarter. I would love to see what others could come up with. <br />
<br />
In the below zipped file you will find the Docker and GMS .nsi files along with two icons and the lf_ColorReplacer29.3.8 gms file. <br />
<br />
<a href="http://www.v-cut.com/files/public/corel/InstallerX4_X6.zip" target="_blank">InstallerX4_X6</a></div>

]]></content:encoded>
			<dc:creator>shelbym</dc:creator>
			<guid isPermaLink="true">http://forum.oberonplace.com/blog.php?b=14275</guid>
		</item>
		<item>
			<title>Adding an Icon with your XSLT File</title>
			<link>http://forum.oberonplace.com/blog.php?b=202</link>
			<pubDate>Mon, 16 Apr 2012 20:47:31 GMT</pubDate>
			<description>*Introduction* 
 
We will be using the same XSLT files that we created last week, so if you  have not read last week’s post you may wish to do that first. 
 
We added a menu item to the Dockers menu for our new custom .NET docker, each new item added gets a default icon assigned to it as shown in...</description>
			<content:encoded><![CDATA[<div><b>Introduction</b><br />
<br />
We will be using the same XSLT files that we created last week, so if you  have not read last week’s post you may wish to do that first.<br />
<br />
We added a menu item to the Dockers menu for our new custom .NET docker, each new item added gets a default icon assigned to it as shown in the following screenshot:<blockquote><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=18&amp;d=1334609340" border="0" alt="Name:  menu.png
Views: 808
Size:  6.1 KB" style="margin: 2px" /></blockquote>This icon is boring and if you have a long list of custom dockers they all start to blur together.  An easy way to fix this is to define an icon in our XSLT file. Today I will show one example of how you can do this.<br />
<br />
<b>Creating a Custom Icon</b><br />
<br />
To create our custom icon we are going to use the built in icon editor.  First we want a temporary place to store our icon, so let’s create a new toolbar.  You can do this by going to the menu and selecting: Tools | Customize | Customization | Command Bars, on the right side click the New button and a command bar named New Toolbar 1 should be created.  Now, we need a command so that we can draw an icon, from the left side click on Commands, just below Command bars. From the dropdown list select Macros, you should get a list of macros and notice they all have the same icon. You can grab whichever one you would like, as we are only using the toolbar as a place holder, and drag it over to the New Toolbar 1. After you have dropped it, the icon should now show on the toolbar. Click on the icon to make sure it selected and then click the Appearance tab in the options dialog. It should look something like this:<blockquote><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=17&amp;d=1334609320" border="0" alt="Name:  Appearance.PNG
Views: 861
Size:  54.7 KB" style="margin: 2px" /></blockquote>Using the editor we can now draw our new icon. The editor takes a bit to get used to, but it has the advantage that your icon will be the correct size, and limited to the correct colors. You may also use the import drop down to show a list of common icons to start from, you may even import an icon.<br />
<br />
<i>Note: If you import an icon, the colors may change; this is because you are limited to the color palette you see in the editor.</i><br />
<br />
Once your done click OK, and you should now have your New Toolbar 1 with your icon on it. <br />
<br />
<b>Export Workspaces</b><br />
<br />
Now that we have our icon we need to convert it so that it is usable in our XSLT file, they easiest way to do this is simply to export our workspace. To do this, right click on the New Toolbar 1 | Customize | Workspace | Export Workspaces… So that you do not have tons of code to dig through we are only going to export the New Toolbar 1 we created, click the plus icon next to Toolbars and find it in the list and check it, click Save.  Notice it now wants to save a XSLT file, yeah! Name it whatever you wish and click save. <br />
<br />
Using a Text Editor, open the XSLT file you just created. The icon will be very easy to spot as it is the large block of letters enclosed in the &lt;userSmallBitamp&gt;&lt;/userSmallBitamp&gt; tags. Copy the tags and everything in between.<br />
<br />
<b> Modifying our XSLT File</b><br />
<br />
Open the AppUI.xslt file you created in last week’s example and find the section with the comment:<br />
<br />
<font color="green">&lt;!-- Define the button which shows the docker --&gt;</font><br />
<br />
The next line should begin with &lt;itemData guid…, we need to go the end of this line and change the /&gt; to just a &gt; hit your enter key and type &lt;/itemData&gt; Now inbetween these two paste the text from the workspace file. When you are done you should have something like this. <i>(I used the template file you should have your values for &lt;&lt;GUID A&gt;&gt; and such.)</i><blockquote><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=15&amp;d=1334605921" border="0" alt="Name:  Icon_Code.PNG
Views: 868
Size:  60.7 KB" style="margin: 2px" /></blockquote><b>Results</b><br />
<br />
Fire up CorelDRAW with your newly modified XSLT file and hopefully we have good results. You may have to press F8 to reset the workspace to pick up the changes if you are modifying a docker you have already installed. <blockquote><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=16&amp;d=1334608325" border="0" alt="Name:  docker_icon.png
Views: 873
Size:  5.8 KB" style="margin: 2px" /></blockquote><b>Conclusion</b><br />
<br />
By exporting the workspace we are able to convert our icon to XML so that we may use it in our XSLT file, now we have a custom icon to go with our custom .NET Docker entry on the Dockers menu. One note, that this will not add an icon to the docker tab itself, currently it is not possible to add an icon to the tab.<br />
<br />
<b>Coming up Next…</b><br />
<br />
How to create an installer for your custom dockers or macros...</div>

]]></content:encoded>
			<dc:creator>shelbym</dc:creator>
			<guid isPermaLink="true">http://forum.oberonplace.com/blog.php?b=202</guid>
		</item>
		<item>
			<title>Using XSLT files instead of VBA</title>
			<link>http://forum.oberonplace.com/blog.php?b=169</link>
			<pubDate>Mon, 09 Apr 2012 21:30:20 GMT</pubDate>
			<description>*Introduction* 
 
Previously we have used VBA to load our .NET custom docker into the CorelDRAW UI. This article will show how this may also be done using XSLT files, very similar to the example Hendrik provided in his Custom Docker article: Custom add-ons and dockers in CorelDRAW...</description>
			<content:encoded><![CDATA[<div><b>Introduction</b><br />
<br />
Previously we have used VBA to load our .NET custom docker into the CorelDRAW UI. This article will show how this may also be done using XSLT files, very similar to the example Hendrik provided in his Custom Docker article: <a href="http://coreldraw.com/blogs/insider/pages/custom-dockers-in-coreldraw.aspx" target="_blank">Custom add-ons and dockers in CorelDRAW</a><br />
<br />
<b>The &quot;Addons&quot; Folder</b><br />
<br />
You customizations will need to be in the Addons folder, for X6 64-bit that folder is found here: “C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Programs64\Addons”. You will want to create a folder and give it a meaningful name; since I will be using the SM_Selection docker from a previous post I will name my folder SM_Selection.  You also need to tell the addons folder which products you wish your docker to be available to. To do this you just create a blank text file and name it: Coreldrw.addon , make sure if you have file extensions hidden that you have not accidently name the file Coreldrw.addon.txt :-) If you want your docker accessible to PHOTO-PAINT, you would use CorelPP.addon and for CorelDESIGNER use Designer.addon.<br />
<br />
<i>*Note – You might be asking what is the SM_, they are just my initials. If you plan on sharing your work, you may wish to name your macros like this because someone else may also have a macro called Selection. It is also an easy way to tell the author of the macro so you know whom to yell at when something doesn’t work. ;-)</i><br />
<br />
<b>Customizing UI via XSLT Files</b><br />
<br />
We need to generate three unique GUID’s, again you can use the tool included with Visual Studio or use an online generator: <a href="http://www.guidgenerator.com/" target="_blank">www.guidgenerator.com</a> once you have your GUID’s plug them into the proper places on the Templates. If you want details about what each of these actual do, please refer back to Hendrik’s article he gives excellent detail.<br />
<br />
Lets get the .GMS file set up first, rename the TemplatedotNetDocker.gms file to the name you have chosen, I am renaming to SM_Selection.gms. You may be asking why do we need the GMS file I thought we were not going to use VBA, the GMS file does not add the docker to the UI, instead it is the code behind the button that lets us easily open and close the docker we are adding with the XSLT files. This way it acts just like a normal docker. After the .gms file is renamed open the VBA Editor and rename the project also to your selected name. Replace the &lt;&lt;TemplatedotNetDocker&gt;&gt; with the name of your docker and the &lt;&lt;GUID C&gt;&gt; with one of the GUID's you generated.<br />
<br />
To add our custom .NET docker we will need two XSLT files. First an APPUI.xslt file which defines items such as buttons, menu items, menu flyouts, and dockers. Second a UserDRAW.xslt file which adds these customizations to the current UI. I have provided a Template of each file below. Just as with the .gms file plug in the GUID and names as needed.<br />
<br />
Here is a small piece of the XSLT file:<br />
<font color="blue"><font face="courier"><font size="-1"><br />
      &lt;itemData <font color="red">guid</font>=&quot;cbdb5570-ccb0-4c52-b715-a93be68f08ad&quot;<br />
                 <font color="red">type</font>=&quot;wpfhost&quot;<br />
                 <font color="red">hostedType</font>=&quot;C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Programs64\Addons\SM_Selection\SM_Selection_VB.dll,SM_Selection_VB.Docker&quot;<br />
        <font color="red">enable</font>=&quot;true&quot;/&gt;<br />
</font></font></font><br />
It seems to work best putting the full path here, it doesn't have to be in the addons folder for the .dll, but since everything else is there it is nice to keep it all in one place.<br />
<br />
<b>Conclusion</b><br />
<br />
An advantage of the XSLT approach to adding the docker is that you may name it whatever you like, if you use the VBA as in the previous article your docker would be named SM_Selection_VB.Docker, with the XSLT we just name is SM_Selection which is much nicer. I hope you all find success in this approach, it is my preferred method to adding dockers.<br />
<br />
<b>Coming up Next…</b><br />
<br />
How to add an icon in your XSLT file...<br />
<br />
<b>Template XSLT Files and GMS</b><br />
<br />
<a href="http://www.v-cut.com/files/public/corel/TemplatedotNetDocker.zip" target="_blank">Template dotNet Docker</a></div>

]]></content:encoded>
			<dc:creator>shelbym</dc:creator>
			<guid isPermaLink="true">http://forum.oberonplace.com/blog.php?b=169</guid>
		</item>
		<item>
			<title>Custom .NET Dockers in CorelDRAW X6</title>
			<link>http://forum.oberonplace.com/blog.php?b=166</link>
			<pubDate>Mon, 02 Apr 2012 04:38:58 GMT</pubDate>
			<description>*Introduction* 
 
In the previous blog post we showed an example of a custom WPF control that was hosted in the UI of CorelDRAW. In this post we are going to take a Custom Web Docker that Hendrik had provided as an example and rewrite it as a Custom WPF .NET Docker. If you have never made a custom...</description>
			<content:encoded><![CDATA[<div><b>Introduction</b><br />
<br />
In the previous blog post we showed an example of a custom WPF control that was hosted in the UI of CorelDRAW. In this post we are going to take a Custom Web Docker that Hendrik had provided as an example and rewrite it as a Custom WPF .NET Docker. If you have never made a custom docker his article is a wonderful place to start. You may find it here: <a href="http://coreldraw.com/blogs/insider/pages/custom-dockers-in-coreldraw.aspx" target="_blank">Custom add-ons and dockers in CorelDRAW</a><br />
<br />
<b>WPF User Control Library</b><br />
<br />
Once again I will be using Visual Studio Professional. I will be posting all code samples this time in VB.NET as they were downloaded the most often in the last blog post. I will however include a C# version of the source code for those that prefer it. <br />
<br />
To begin Open Visual Studio and Start a New Project | Visual Basic | Windows | WPF User Control Library. I named my project SM_Selection_VB, but feel free to name it whatever you like.  Rename the UserControl1.xaml to Docker.xaml, double click on the Docker.xaml.vb and rename the public class UserControl1 to Docker. In the Solution Explorer right click your project name, in my case SM_Selection_VB and select add reference. If you have done the previous example the CorelDRAW interop assemblies will be listed in the Recent tab, if not the 64-bit location is:<blockquote><font face="courier"><font size="-1">C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Programs64\Assemblies</font></font></blockquote>You need to add a reference to both the Corel.Interop.CorelDRAW.dll and Corel.Interop.VGCore.dll. That should be it for setup we are all ready to get started coding.<br />
<br />
<b>XAML</b><br />
<br />
Since we are creating a docker we will use the DesignHeight and DesignWidth, I have found that DesignWidth is best set to 225, and the height can be whatever fits your content best, in this case I went with a DesignHeight of 500.<br />
<br />
Replace the Grid, with a StackPanel and then we can drag our needed labels, textboxes, and buttons from the Toolbox to our XAML, if you prefer you could of course type all the XAML by hand. I like to rename all the controls so they are easily identified. When you are done, you should have something that looks like the XAML below:<blockquote><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=10&amp;d=1333338454" border="0" alt="Name:  Docker_XAML.PNG
Views: 1841
Size:  48.2 KB" style="margin: 2px" /></blockquote><b>Visual Basic</b><br />
<br />
Now that we are done with the XAML we need to code it up, this time we shall use Visual Basic. Again, keeping the code very basic, we have a Sub for each button that we created and our Sub for the SelectionChange event, you will only need WithEvents if you are listening for these types of events. All the selection of our shapes is done with a little CQL, which makes it very simple. When you are done, your code will look something like this:<blockquote><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=11&amp;d=1333339271" border="0" alt="Name:  Docker_VB.PNG
Views: 1865
Size:  36.3 KB" style="margin: 2px" /></blockquote><b>Note:</b> I did not post the full code due to space, if you want to see all the code please download the source files.<br />
<br />
Save your work, and Build the solution to generate the .dll, I move the .dll to my Addons folder, but it can be placed anywhere you wish. Just remember where you put it because you will need to reference it in your VBA code.<br />
<br />
<b>Add Custom Docker</b><br />
<br />
Adding the docker is very similar to adding or WPF Custom Control; expect that we will need a unique GUID to identify the docker by. You can generate a GUID from the tool included with Visual Studio, Create GUID, or if you prefer use an online tool such as: <a href="http://www.guidgenerator.com/" target="_blank">http://www.guidgenerator.com/</a> the important thing to remember is that you need to generate a new GUID for each new Custom .NET Docker you create.<br />
<br />
The following VBA code, creates the docker in the UI, and makes an entry for our Docker in the Windows | Dockers menu.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="alt2" dir="ltr" style="
		margin: 0px;
		padding: 6px;
		border: 1px inset;
		width: 640px;
		height: 130px;
		text-align: left;
		overflow: auto">Sub addSelectionVB()
    Dim dockerAssembly As String
    dockerAssembly = &quot;C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Programs64\Addons\SM_Selection\SM_Selection_VB.dll&quot;
    
    Call FrameWork.AddDocker(&quot;6139b731-672f-4131-88e4-3a30833b349d&quot;, &quot;SM_Selection_VB.Docker&quot;, dockerAssembly)
    Call FrameWork.CommandBars(&quot;Dockers&quot;).Controls.AddToggleButton(&quot;6139b731-672f-4131-88e4-3a30833b349d&quot;, 0, False)
End Sub</pre>
</div>The newly create docker should look similar to this:<blockquote><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=12&amp;d=1333340321" border="0" alt="Name:  Selection_Docker.PNG
Views: 1895
Size:  20.1 KB" style="margin: 2px" /></blockquote><b>Conclusion</b><br />
<br />
Congratulations you have just created your very first Custom WPF .NET Docker for CorelDRAW X6. As always if you have question feel free to ask them in the forums. <br />
<br />
<b>Coming up Next…</b><br />
<br />
Adding a Custom Docker or Control via XSLT instead of VBA<br />
<br />
<b>Full Visual Studio 2010 Source Code</b><br />
<br />
If you would like to look at the full source code, I am providing both C# and VB.NET examples.<br />
<br />
<a href="http://www.v-cut.com/files/public/corel/SM_Selection_CSharp.zip" target="_blank">SM_Selection_CSharp.zip</a><br />
<a href="http://www.v-cut.com/files/public/corel/SM_Selection_VB.zip" target="_blank">SM_Selection_VB.zip</a></div>

]]></content:encoded>
			<dc:creator>shelbym</dc:creator>
			<guid isPermaLink="true">http://forum.oberonplace.com/blog.php?b=166</guid>
		</item>
		<item>
			<title>Custom .NET Controls in CorelDRAW X6</title>
			<link>http://forum.oberonplace.com/blog.php?b=165</link>
			<pubDate>Mon, 26 Mar 2012 03:24:46 GMT</pubDate>
			<description>*Introduction* 
 
With CorelDRAW X6 you can now create custom .NET controls that can be hosted in either a custom docker or the UI itself, including toolbars and menus. I will be doing a few posts on exactly how this is done. For this post we will build our own slider control that will change the...</description>
			<content:encoded><![CDATA[<div><b>Introduction</b><br />
<br />
With CorelDRAW X6 you can now create custom .NET controls that can be hosted in either a custom docker or the UI itself, including toolbars and menus. I will be doing a few posts on exactly how this is done. For this post we will build our own slider control that will change the line width of the selected shapes.<br />
<br />
<b>WPF User Control Library</b><br />
<br />
I will be using Visual Studio 2010 Professional to create the custom control. Start a new project, Visual C#, WPF User Control Library.<div align="center"><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=4&amp;d=1332727761" border="0" alt="Name:  NewProject.PNG
Views: 1929
Size:  97.7 KB" style="margin: 2px" /></div><br />
Rename the UserControl1.xaml to MySlider.xaml and Refactor | Rename the UserControl1 class to MySlider. Next we need to add references to the CorelDRAW interop assemblies. For the 64-bit version they are located:<br />
<blockquote><font face="courier"><font size="-1">C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Programs64\Assemblies</font></font></blockquote>You need to add a reference to both the Corel.Interop.CorelDRAW.dll and Corel.Interop.VGCore.dll. That should be it for setup we are all ready to get started coding.<br />
<br />
<b>XAML</b><br />
<br />
Click on MySlider.xaml to show the XAML. Remove the width and height, as well as the grid and then add a slider control from the toolbox. In the properties docker rename slider1 to mySlider, set the Mininum to .5, Maximum to 10, TickFrequency of .5, and check IsSnapToTickEnabled. Click the Events tab and double click the ValueChanged to generate the event in code. Your XAML should look similar to this:<blockquote><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=5&amp;d=1332728318" border="0" alt="Name:  XAML.PNG
Views: 1856
Size:  13.2 KB" style="margin: 2px" /></blockquote><b>CSharp</b><br />
<br />
Going to keep the code pretty simple, we just need to link our control to CorelDRAW and then add the code for when the slider value changes. SetOutlineProperties wants its value in inches, so we will take the value of the slider and convert it to inches with the ConvertUnits function. When you are done your code should look similar to this:<blockquote><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=6&amp;d=1332728598" border="0" alt="Name:  CSharp.PNG
Views: 1880
Size:  26.0 KB" style="margin: 2px" /></blockquote>Save your work, and Build the solution to generate the .dll, I move the .dll to my Addons folder, but it can be placed anywhere you wish. Just remember where you put it because you will need to reference it in your VBA code.<br />
<br />
<b>Add Custom Control</b><br />
<br />
To add the custom control to the UI I am going to use VBA. My VBA code looks like this:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="alt2" dir="ltr" style="
		margin: 0px;
		padding: 6px;
		border: 1px inset;
		width: 640px;
		height: 130px;
		text-align: left;
		overflow: auto">Sub addLineWidthControl()
    Dim controlAssembly As String
    controlAssembly = &quot;C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Programs64\Addons\SM_LineWidth\SM_LineWidth_CSharp.dll&quot;
    
    ' Add custom slider control
    Call FrameWork.CommandBars(&quot;Standard&quot;).Controls.AddCustomControl(&quot;SM_LineWidth_CSharp.MySlider&quot;, controlAssembly)
End Sub</pre>
</div>Run the VBA code, and the new slider should be added to the end of the standard toolbar. Draw a couple of shapes, select them and drag the slider to see what happens. If we have done things correctly the outlines of the shapes to change as you move the slider.<div align="center"><img src="http://forum.oberonplace.com/blog_attachment.php?attachmentid=8&amp;d=1332729078" border="0" alt="Name:  Slider.png
Views: 1905
Size:  23.1 KB" style="margin: 2px" /></div><br />
<b>Conclusion</b><br />
<br />
We created our very first WPF custom control for CorelDRAW X6, how very cool is that. If you have questions please post to the forum, this opens up so many new opportunities for coders, I cannot wait to see what awesome things you come up with.<br />
<br />
<b>Coming up Next…</b><br />
<br />
Custom .NET Docker Example<br />
<br />
<b>Full Visual Studio 2010 Source Code</b><br />
<br />
If you would like to look at the full source code, I am providing both C# and VB.NET examples.<br />
<br />
<a href="http://www.v-cut.com/files/public/corel/SM_LineWidth_CSharp.zip" target="_blank">SM_LineWidth_CSharp.zip</a><br />
<a href="http://www.v-cut.com/files/public/corel/SM_LineWidth_VB.zip" target="_blank">SM_LineWidth_VB.zip</a></div>

]]></content:encoded>
			<dc:creator>shelbym</dc:creator>
			<guid isPermaLink="true">http://forum.oberonplace.com/blog.php?b=165</guid>
		</item>
		<item>
			<title>Macros and CorelDRAW X6 (64-Bit)</title>
			<link>http://forum.oberonplace.com/blog.php?b=164</link>
			<pubDate>Sun, 25 Mar 2012 23:27:20 GMT</pubDate>
			<description>*Introduction* 
 
The good news in most macros from previous versions of CorelDRAW should work great. The one exception to this are macros that use WinAPI calls. All previous macros that use WinAPI calls will need to be updated for CorelDRAW X6 (64-bit). This is only for the 64-bit version, if you...</description>
			<content:encoded><![CDATA[<div><b>Introduction</b><br />
<br />
The good news in most macros from previous versions of CorelDRAW should work great. The one exception to this are macros that use WinAPI calls. All previous macros that use WinAPI calls will need to be updated for CorelDRAW X6 (64-bit). This is only for the 64-bit version, if you are using the 32-bit version of CorelDRAW, even on a 64-bit version of Windows everything should run as expected.<br />
<br />
<b>Why the Change</b><br />
<br />
VBA has used the Long data type to represent pointer values in WinAPI calls. The Long data type is a 32-bit Integer, on a 64-bit platform the pointers are 64-bit values. As they say, you cannot put a 64-bit value in a 32-bit bucket, it will not fit. VBA needs to pass 64-bit values to the parameters and return values, not 32-bit as in the past. If VBA where passed a 64-bit value it would be truncated to a 32-bit value when making the WinAPI call and most likely lead to a crash of the host application, in our case CorelDRAW.<br />
<br />
<b>The Solution</b><br />
<br />
Microsoft has added support for 64-bit by creating the new data type, LongPtr in VBA 7.  The LongPtr data type will work correctly on both 32 and 64-bit systems as it uses a 32-bit pointer size for 32-bit platforms and a 64-bit pointer size for 64-bit platforms, pretty smart huh. <br />
<br />
VBA needs to know that you have reviewed the WinAPI calls and made the correct changes to the new LongPtr data type, so Microsoft added the keyword PtrSafe to VBA to add after the Declare statement. This way VBA know you have reviewed the call and made it safe. Without this keyword any function / subroutine with Declare will fail to compile.<br />
<b>Examples</b><br />
<br />
Here is an example of the changes that will need to be made.<blockquote><font face="courier"><font size="-1"><font color="green">‘API definition the old way</font><br />
<font color="blue">Private Declare Function</font> GetDC <font color="blue">Lib</font> &quot;USER32&quot; (<font color="blue">ByVal</font> hWnd <font color="blue">As Long</font>) <font color="blue">As Long</font><br />
<br />
<font color="green">‘API definition the new way</font><br />
<font color="blue">Private Declare</font> <b><u>PtrSafe</u></b> <font color="blue">Function</font> GetDC <font color="blue">Lib</font> &quot;USER32&quot; (<font color="blue">ByVal</font> hWnd <font color="blue">As LongPtr</font>) <font color="blue">As <b><u>LongPtr</u></b></font><br />
</font></font></blockquote>I have bolded and underlined the changes to make them easy to see. We have changed the Long data type to LongPtr, and have said that WinAPI call is now safe by using the PtrSafe keyword.<br />
<br />
Let’s look at another example:<blockquote><font face="courier"><font size="-1"><font color="green">‘API definition the old way</font><br />
<font color="blue">Declare Function</font> GetKeyState <font color="blue">Lib</font> &quot;USER32&quot; (<font color="blue">ByVal</font> vKey <font color="blue">As Long</font>) <font color="blue">As Integer</font><br />
<br />
<font color="green">‘API definition the new way</font><br />
<font color="blue">Declare</font> <b><u>PtrSafe</u></b> <font color="blue">Function</font> GetKeyState <font color="blue">Lib</font> &quot;USER32&quot; (<font color="blue">ByVal</font> vKey <font color="blue">As Long</font>) <font color="blue">As Integer</font></font></font></blockquote>Notice anything different? Here we only used the keyword PtrSafe but did not change the Long data type to LongPtr. This is because we only need to use the LongPtr data type if the function arguments or return values that are memory addresses, if they represent data you should still use the Long data type.<br />
<br />
Here is an example that uses both data types:<br />
<blockquote><font face="courier"><font size="-1"><font color="green">‘API definition the old way</font><br />
<font color="blue">Public Declare Function</font> SendMessageA <font color="blue">Lib</font> &quot;user32&quot; (<font color="blue">ByVal</font> hWnd <font color="blue">As Long</font>, <font color="blue">ByVal</font> wMsg <font color="blue">As Long</font>, <font color="blue">ByVal</font> wParam <font color="blue">As Long</font>, lParam <font color="blue">As</font> Any) <font color="blue">As Long</font><br />
<br />
<font color="green">‘API definition the new way</font><br />
<font color="blue">Public Declare</font> <b><u>PtrSafe</u></b> <font color="blue">Function</font> SendMessageA <font color="blue">Lib</font> &quot;user32&quot; (<font color="blue">ByVal</font> hWnd <font color="blue">As <b><u>LongPtr</u></b></font>, <font color="blue">ByVal</font> wMsg <font color="blue">As Long</font>, <font color="blue">ByVal</font> wParam<font color="blue"> As Long</font>, lParam <font color="blue">As</font> Any) <font color="blue">As <b><u>LongPtr</u></b></font><br />
</font></font></blockquote>If you would like some examples of common WinAPI calls and the new syntax you can use the following links:<br />
<br />
<a href="http://www.jkp-ads.com/articles/apideclarations.asp" target="_blank">Declaring API Functions In 64 Bit Office</a><br />
<a href="http://www.microsoft.com/download/en/details.aspx?id=9970" target="_blank">Office 2010 Help Files: Win32API_PtrSafe with 64-bit Support</a><br />
<br />
<b>Supporting Older Version</b><br />
<br />
This all works great for CorelDRAW X6 and VB7, but does not work with older versions, this is because older versions of VBA to not understand the new PtrSafe keyword and LongPtr data type. If you want your macro to support older version we need to add an IF Else Statement. Ah, yes, one Macro to rule them all.<br />
<br />
Here is an example:<blockquote><font face="courier"><font size="-1">#If VBA7 Then<br />
     <font color="blue">Private Declare</font> PtrSafe <font color="blue">Function</font> GetDC <font color="blue">Lib</font> &quot;USER32&quot; (<font color="blue">ByVal</font> hWnd <font color="blue">As LongPtr</font>) <font color="blue">As LongPtr</font><br />
#Else<br />
     <font color="blue">Private Declare Function</font> GetDC <font color="blue">Lib</font> &quot;USER32&quot; (<font color="blue">ByVal</font> hWnd <font color="blue">As Long</font>) <font color="blue">As Long</font><br />
#End If</font></font></blockquote><b>Summary</b><br />
<br />
Again, I want to point out that this change only affects the few macros that use WinAPI calls, and with a few simple changes you will be up and running on any version of CorelDRAW. If you have questions or need further examples please feel free to post on the forums.</div>

]]></content:encoded>
			<dc:creator>shelbym</dc:creator>
			<guid isPermaLink="true">http://forum.oberonplace.com/blog.php?b=164</guid>
		</item>
		<item>
			<title>OberonPlace Development Portal</title>
			<link>http://forum.oberonplace.com/blog.php?b=4</link>
			<pubDate>Sat, 28 Mar 2009 04:14:06 GMT</pubDate>
			<description><![CDATA[I have created a site to host online documentation for CorelDRAW, Corel DESIGNER, and Corel PHOTO-PAINT developer community. It's a wiki at http://dev.oberonplace.com/ which  right now has only place-holder pages for every object, method, and property of the object models of...]]></description>
			<content:encoded><![CDATA[<div>I have created a site to host online documentation for CorelDRAW, Corel DESIGNER, and Corel PHOTO-PAINT developer community. It's a wiki at <a href="http://dev.oberonplace.com/" target="_blank">http://dev.oberonplace.com/</a> which  right now has only place-holder pages for every object, method, and property of the object models of Draw/Designer/Photo-Paint with basic syntax of the respective methods, etc. <br />
<br />
The idea is to provide the means for the developer community to convert it into a really useful resource containing extensive and up-to-date documentation with loads of code examples, technique on usage of the applications through programming interfaces with VB, VBA, C++, C#, Delphi, and other programming languages.<br />
<br />
Feel free to browse through the object models of CorelDRAW/Designer at <a href="http://dev.oberonplace.com/CorelDRAW:Classes" target="_blank">http://dev.oberonplace.com/CorelDRAW:Classes</a> and Photo-Paint at <a href="http://dev.oberonplace.com/Photo-Paint:Classes" target="_blank">http://dev.oberonplace.com/Photo-Paint:Classes</a></div>

]]></content:encoded>
			<dc:creator>Alex</dc:creator>
			<guid isPermaLink="true">http://forum.oberonplace.com/blog.php?b=4</guid>
		</item>
		<item>
			<title>Using CorelDRAW/CorelDESIGNER for everyday tasks</title>
			<link>http://forum.oberonplace.com/blog.php?b=3</link>
			<pubDate>Tue, 22 Jul 2008 04:06:27 GMT</pubDate>
			<description>A lot of people think of graphics design when they are talking about CorelDRAW. Printed ads, brochures, web sites, etc come to mind first. I wanted to share some things I use CorelDRAW and Designer for which might give you some more ideas :) 
 
I like to build things myself. Some small (and not so...</description>
			<content:encoded><![CDATA[<div>A lot of people think of graphics design when they are talking about CorelDRAW. Printed ads, brochures, web sites, etc come to mind first. I wanted to share some things I use CorelDRAW and Designer for which might give you some more ideas :)<br />
<br />
I like to build things myself. Some small (and not so small) projects happen every now and then. Like building a cabinet, small shelf or doing major construction project like finishing a basement. And each time I'm about to tackle a new project of this sort I find myself wondering how I would have been able to plan it, had I not have CorelDRAW. I find it very easy and fast to do all the planning using CorelDRAW. Below I'll describe a complete project I completed past weekend from start to finish. <br />
<br />
I wanted to build a permanent shelf (actually three of those) for a basement storage room. I wanted these shelves to be very sturdy so I can pile a lot of junk onto them without a fear of collapse. First thing I did was to measure up all the walls in the room I wanted to place the shelves in. The room width turned out to be 110 inches. It is not really square and had a little nook (due to a stair well on the other side of the wall), so I planned to use that up by the shelf as well. There is also a drain pipe going vertically by the outer wall:<br />
<br />
<img src="http://www.oberonplace.com/images/custom/blogs/shelf_plan1.png" border="0" alt="" /><br />
<br />
After I measured everything up, I started Corel DESIGNER X4 and drew the room layout. Since I wanted the shelf to be 110&quot; wide and I wanted to draw everything on a standard Letter paper (8.5&quot;) I fugured that 1:20 document scale would be about right, so I used it (double-click the rulers and in the Ruler options dialog click &quot;Edit Scale...&quot;):<br />
<br />
<img src="http://www.oberonplace.com/images/custom/blogs/doc_scale.png" border="0" alt="" /><br />
<br />
After this is done, I can draw using real measurements (inches, feet, whatever) without having to do any calculations.<br />
<br />
So, I drew the room walls, and then planned the layout of the shelf. I decided to create a frame out of standard 2x4 consturuction studs and mount them directly onto the walls. The shelf would be constructed using 3x1 lumber resting on 2x2 sleepers which would sit on top of the frame. The shelf would be constructed of two separate pieces - one going along the far side wall and the other perpendicular to it in the nook on the left. I measured the actual wooden pieces to know their exact width, length and thickness (e.g. 2x4 is actually only 3.5&quot; wide and 1.5&quot; thick).<br />
<br />
<img src="http://www.oberonplace.com/images/custom/blogs/shelf_plan2.png" border="0" alt="" /><br />
<br />
Once this is done, I refined the drawing by aligning everything properly, distributing objects evenly (Align and Distribute comes in handly here).<br />
<br />
Then using the Dimension tool I measured each piece of my design (Designer X4 shines here with its completely redesigned Dimension tool!).<br />
<br />
Now that I know the dimensions of each plank, I calculated how much wood of each kind I need to purchase. I also used Designer to figure out how I need to cut each stud to end up with the pieces I needed and not wasting too much material. I just drew each stud I needed to purchase at their correct lengths (8' and 10' that I needed) and then just stacked the individual pieces on top of each plank to see how I would arrange the pieces to maximize the wood usage. <br />
<br />
I went to Home Depot and bought all the wood I needed, came home and cut all of it right away without even trying to assemble anything. I consulted the item list I created with precise lengths of each piece.<br />
<br />
<img src="http://www.oberonplace.com/images/custom/blogs/shelf_plan3.png" border="0" alt="" /><br />
<br />
After all the pieces were cut (I used a good quality mitre saw to ensure precise and straight cuts), I just assembled everything according to my blueprints. Here are some photos of how the assembly progressed.<br />
<br />
The main shelf:<br />
<img src="http://www.oberonplace.com/images/custom/blogs/shelf1.jpg" border="0" alt="" /><br />
<br />
The corner piece:<br />
<img src="http://www.oberonplace.com/images/custom/blogs/shelf2.jpg" border="0" alt="" /><br />
<br />
Main frame:<br />
<img src="http://www.oberonplace.com/images/custom/blogs/shelf3.jpg" border="0" alt="" /><br />
<br />
Corner shelf frame:<br />
<img src="http://www.oberonplace.com/images/custom/blogs/shelf4.jpg" border="0" alt="" /><br />
<br />
Completed shelves:<br />
<img src="http://www.oberonplace.com/images/custom/blogs/shelf5.jpg" border="0" alt="" /><br />
<br />
I was quite amazed at how well everything fit together and I didn't have to go back and forth between the basement and the garage to cut or trim pieces. The key is to measure everything carefully and then draw to scale. It's very easy to play with different designs in CorelDRAW or DESIGNER once you have drawn correct dimensions of each building piece.<br />
<br />
You can download my original Designer X4 drawing which is attached to this post. I have also saved it as CorelDRAW 12 drawing for those not having Designer, but the dimension objects are converted to curves in that file...<br />
<br />
Not so long ago I built a stand for my 225 gallon aquarium. I used CorelDRAW X4 to create the design:<br />
<img src="http://www.oberonplace.com/aqua/images/Stand-plan.png" border="0" alt="" /><br />
<br />
Almost-completed stand (you can see the actual aquarium the stand is meant for in the background):<br />
<img src="http://www.oberonplace.com/aqua/images/stand10.jpg" border="0" alt="" /><br />
<img src="http://www.oberonplace.com/aqua/images/stand11.jpg" border="0" alt="" /><br />
<br />
(If you are interested in detailed description of the progress of this project, it is documented here: <a href="http://ovas.ca/index.php?topic=28948.0" target="_blank">http://ovas.ca/index.php?topic=28948.0</a>)<br />
<br />
When we were finishing our basement last winter, I created all the blueprints in CorelDRAW X4 as well. Wall locations, doors, electrical circuits, floors. Doing everything to scale really helped estimate the costs of materials and ensure minimal waste (e.g. when putting drywall onto the ceiling, I combined 8' and 10' sheets of drywall so there are very little cut-offs).<br />
<br />
I used layers extensively to put different elements (such as walls, ceiling drywall, electrical circuits, flooring, etc) onto different layers so I could create different printouts easily for different stages of the project.<br />
<br />
Here is my general wall design:<br />
<img src="http://www.oberonplace.com/images/custom/blogs/basement-walls.png" border="0" alt="" /><br />
<br />
Ceiling drywall placement. Yellow rectangles represent 8' sheets (or pieces of), pink are 10' sheets:<br />
<img src="http://www.oberonplace.com/images/custom/blogs/basement-ceiling.png" border="0" alt="" /><br />
<br />
And an electrical diagram with different circuits marked appropriately (not that you can see it from this little thumbnail image). I actually put each ciruit elements on a different layer so I could print each circuit on a separate piece of paper for easy wiring:<br />
<img src="http://www.oberonplace.com/images/custom/blogs/basement-electrical.png" border="0" alt="" /><br />
<br />
Here is how everything turned out:<br />
<img src="http://www.oberonplace.com/images/custom/blogs/basement1.jpg" border="0" alt="" /> <img src="http://www.oberonplace.com/images/custom/blogs/basement2.jpg" border="0" alt="" /><br />
<br />
As you can see, there are many many different uses for CorelDRAW in everyday life. It doesn't have to be art related. Since I have already posted way too many pictures for one blog article, what harm will two more do? :)<br />
<br />
Once we bought our house we were shopping for appliances, furniture, electronics, etc to go in the house. We were looking for a big screen TV but weren't quite sure what size to choose, since bigger doesn't necessarily mean better and too big a TV could just overwhelm a room it is in.<br />
<br />
So I took a picture of the room as it was being built. I brought it into CorelDRAW and knowing the width of the room I scaled the picture to have certain scale. Then I got a photo of the TV I wanted from the manufacturer's web site and from the TV specs I got the dimensions of the units in different sizes and placed them inside my &quot;room&quot;. We looked at 50&quot;, 56&quot;, 61&quot; and 72&quot; TVs:<br />
<br />
<img src="http://www.oberonplace.com/images/custom/blogs/tv1.png" border="0" alt="" /><br />
<br />
After looking at all of them we decided to go with 61&quot; as it looked just right for the room:<br />
<br />
<img src="http://www.oberonplace.com/images/custom/blogs/tv2.jpg" border="0" alt="" /><br />
<br />
I guess I'll stop at that... Or else I could post pictures all day... I hope you enjoyed this long article and didn't find it too boring...</div>


<!-- attachments -->
	<div style="margin-top:10px">

		
		
		
		
			<fieldset class="fieldset">
				<legend>Attached Files</legend>
				<table cellpadding="0" cellspacing="3" border="0">
				<tr>
	<td><img class="inlineimg" src="http://forum.oberonplace.com/images/attach/des.gif" alt="File Type: des" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
	<td><a href="http://forum.oberonplace.com/blog_attachment.php?attachmentid=1&amp;d=1216694633">shelf_des_x4.des</a> (42.7 KB, 2262 views)</td>
</tr><tr>
	<td><img class="inlineimg" src="http://forum.oberonplace.com/images/attach/cdr.gif" alt="File Type: cdr" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
	<td><a href="http://forum.oberonplace.com/blog_attachment.php?attachmentid=2&amp;d=1216694644">shelf_draw_12.cdr</a> (37.9 KB, 2371 views)</td>
</tr>
				</table>
			</fieldset>
		

	</div>
<!-- / attachments -->
]]></content:encoded>
			<dc:creator>Alex</dc:creator>
			<guid isPermaLink="true">http://forum.oberonplace.com/blog.php?b=3</guid>
		</item>
		<item>
			<title>Using Corel Query Language in CorelDRAW VBA</title>
			<link>http://forum.oberonplace.com/blog.php?b=2</link>
			<pubDate>Thu, 10 Jul 2008 18:43:31 GMT</pubDate>
			<description>I have posted an article on using CQL in CorelDRAW/CorelDESIGNER. Be sure to read it at http://coreldraw.com/blogs/insider/pages/using-corel-query-language-cql-to-search-for-objects-in-coreldraw-documents.aspx</description>
			<content:encoded><![CDATA[<div>I have posted an article on using CQL in CorelDRAW/CorelDESIGNER. Be sure to read it at <a href="http://coreldraw.com/blogs/insider/pages/using-corel-query-language-cql-to-search-for-objects-in-coreldraw-documents.aspx" target="_blank">http://coreldraw.com/blogs/insider/p...documents.aspx</a></div>

]]></content:encoded>
			<dc:creator>Alex</dc:creator>
			<guid isPermaLink="true">http://forum.oberonplace.com/blog.php?b=2</guid>
		</item>
		<item>
			<title>Blogging away...</title>
			<link>http://forum.oberonplace.com/blog.php?b=1</link>
			<pubDate>Mon, 09 Jun 2008 00:56:14 GMT</pubDate>
			<description>Well, I guess the time has come for me to start my own blog. I have installed the blog addon to the forum so that eveyone can have their own blog section. Feel free to use it...</description>
			<content:encoded><![CDATA[<div>Well, I guess the time has come for me to start my own blog. I have installed the blog addon to the forum so that eveyone can have their own blog section. Feel free to use it...</div>

]]></content:encoded>
			<dc:creator>Alex</dc:creator>
			<guid isPermaLink="true">http://forum.oberonplace.com/blog.php?b=1</guid>
		</item>
	</channel>
</rss>
