CorelDRAW CPG 扩展开发: CPG(Corel Plug-in Gallery)是 CorelDRAW 的一个扩展机制,可以开发自定义的插件和工具。
|
1 day ago | |
---|---|---|
01_lycpg64 | 1 month ago | |
02_WelcomeScreen | 1 month ago | |
03_ClearFill | 1 month ago | |
04_ToolsBox | 2 months ago | |
05_ToolsBox_CreateDialog | 2 months ago | |
06_cdrPDF2Clip | 5 days ago | |
07_VBA_CallCPG | 5 days ago | |
08_SmartGroup | 5 days ago | |
09_BoundaryGroup | 1 day ago | |
TypeLibs | 2 months ago | |
VGCoreAuto | 2 months ago | |
base | 4 weeks ago | |
bin | 2 months ago | |
img | 1 month ago | |
README.md | 1 month ago |
CorelDRAW CPG 扩展开发: CPG(Corel Plug-in Gallery)是 CorelDRAW 的一个扩展机制,可以开发自定义的插件和工具。
VGCoreAuto.tlb
这个文件就够vgcoreauto.tlb
的包装器实现: vgcoreauto.tlh
vgcoreauto.tli
这两个文件可以查看类型库的接口定义下载 MSVC2022_X64_mini.7z
压缩包解压到任意目录下, 推荐 C:\MSVC2022
配置 MSVC2022
运行环境,参考如下
INCLUDE=C:\MSVC2022\include
LIB=C:\MSVC2022\lib
Path=C:\MSVC2022\bin;%PATH%
Release
在 lycpg64
中 (编译器: Microsoft Visual C++ 2022)cl.exe /nologo /W3 /EHsc /Ox /DNDEBUG /IC:\MSVC2022\include /ITypeLibs /c 01_lycpg64\main.cpp /Fo.\main.obj
link.exe /dll /nologo /LIBPATH:C:\MSVC2022\lib /out:lycpg64.dll Gdi32.lib user32.lib Kernel32.lib .\main.obj
lycpg64.dll
CPG插件, 编译示例图,改名成 lycpg64.cpg
,然后复制到 CorelDRAW\Draw\Plugins64
目录03_ClearFill
修复CorelDRAW 2020 使用错误答疑解惑网址: https://github.com/fersatgit/SmartDepart/issues/1
STDMETHODIMP CVGAppPlugin::raw_StartSession()
{
try
{
m_pApp->AddPluginCommand(_bstr_t("ClearFill"), _bstr_t("Clear Fill"), _bstr_t("Clears fill from selected objects"));
// CorelDRAW X6 使用 VGCore::CommandBarControlPtr ctl
// CorelDRAW 2020 SDK 使用 VGCore::ICUIControlPtr ctl
// https://github.com/fersatgit/SmartDepart/issues/1 // 感谢 fersatgit 修复CorelDRAW 2020 使用错误
VGCore::ICUIControlPtr ctl = m_pApp->CommandBars->Item[_bstr_t("Standard")]->Controls->AddCustomButton(VGCore::cdrCmdCategoryPlugins, _bstr_t("ClearFill"), 1, VARIANT_FALSE);
// _bstr_t bstrPath(m_pApp->Path + _bstr_t("Plugins64\\ClearFill.bmp"));
ctl->SetIcon2(_bstr_t("guid://d2fdc0d9-09f8-4948-944c-4297395c05b7"));
m_lCookie = m_pApp->AdviseEvents(this);
}
catch(_com_error &e)
{
MessageBox(NULL, e.Description(), _T("Error"), MB_ICONSTOP);
}
return S_OK;
}
05_ToolsBox_CreateDialog
增加LOGO, CQL语法使用,悬浮窗口,返回父窗口CreateDialogParam
和 SetWindowLongPtr
SetFocus(GetParent(hDlg));
cl.exe /nologo /W3 /EHsc /Ox /DNDEBUG /I..\TypeLibs /c ToolsBox.cpp ToolsBox.obj
rc.exe -fo.\ToolsBox.res ToolsBox.rc
link.exe /dll /nologo /out:lycpg64.dll Gdi32.lib user32.lib Kernel32.lib ToolsBox.obj ToolsBox.res
char buf[256] = { 0 };
sprintf(buf, "@Outline.Color.rgb[.r='%d' And .g='%d' And .b='%d']", r, g, b);
auto cql = _bstr_t(buf);
// MessageBox(NULL, cql, "cql 轮廓颜色", MB_ICONSTOP);
auto sr = cdr->ActivePage->Shapes->FindShapes(_bstr_t(), cdrNoShape, VARIANT_TRUE, cql);
sr->CreateSelection();
06_cdrPDF2Clip
分离按钮功能到单独cpp文件 cdrPDF2Clip.cpp
和 cdrapp.cpp
,添加 Makefile
用来编译Makefile
用来编译,参考视频nmake
nmake install
nmake clean