扩展 AutoCAD 内置选项卡对话框
使用“类向导”或其他方法创建从 子类化的选项卡。在对话框的属性中,将对话框的样式更改为“子”,将边框更改为“调整大小”。实现 的覆盖。将对话框的所有源文件中出现的所有 with 替换为。对于选项卡扩展名,删除已分配的选项卡对象(请参阅下面的示例)。CDialogPostNcDestroy()CDialogCAdUiTabExtensionPostNcDestroy() 在处理程序中 添加对 的调用,其中 是应用程序的基本文件名,是要添加到的可扩展选项卡式对话框的已发布名称。AcRx::kInitAppMsgacrxEntryPoint()acedRegisterExtendedTab("MYAPPNAME.ARX", "DIALOGNAME")MYAPPNAMEDIALOGNAME 在其中实现一个处理程序并添加选项卡。的参数是一个指针。使用 member 函数获取正在初始化的对话框的名称,如果应用程序想要添加到此对话框,请调用 的成员函数以添加选项卡。如果对话框是可调整大小的,并且您希望调整某些控件的大小,请在调用 之后添加调整大小的代码。AcRx::kInitDialogMsgacrxEntryPoint()(void*)appIdacrxEntryPoint()CAdUiTabExtensionManagerGetDialogName()CAdUiTabExtensionManagerAddTab()CAdUiTabExtensionManagerAddTab() 例如: extern "C" AcRx::AppRetCode acrxEntryPoint(
AcRx::AppMsgCode msg, void* appId)
{
switch (msg) {
case AcRx::kInitAppMsg:
acrxDynamicLinker->unlockApplication(appId);
acrxDynamicLinker->registerAppMDIAware(appId);
initApp();
break;
case AcRx::kUnloadAppMsg:
unloadApp();
break;
case AcRx::kInitDialogMsg:
// A dialog is initializing that we are interested in adding
// tabs to.
addMyTabs((CAdUiTabExtensionManager*)pkt);
break;
default:
break;
}
return AcRx::kRetOK;
}
void initApp()
{
InitMFC();
// Do other initialization tasks here.
acedRegCmds->addCommand(
"MYARXAPP",
"MYARXAPP",
"MYARXAPP",
ACRX_CMD_MODAL,
&MyArxAppCreate);
// Here is where we register the fact that we want to add
// a tab to the Options dialog.
acedRegisterExtendedTab("MYARXAPP.ARX", "OptionsDialog");
}
// CMyTab1 is subclassed from CAcUiTabExtension.
static CMyTab1* pTab1;
void addMyTabs(CAdUiTabExtensionManager* pXtabManager)
{
// Allocate an extended tab if it has not been done already
// and add it through the CAdUiTabExtensionManager.
pTab1 = new CMyTab1;
pXtabManager->AddTab(_hdllInstance, IDD_TAB1,
"My Tab1", pTab1);
// If the main dialog is resizable, add your control
// resizing directives here.
pTab1->StretchControlXY(IDC_EDIT1, 100, 100);
}
然后,对于类实现:CMyTab1 void CMyTab1::PostNcDestroy()
// Override to delete added tab.
{
delete pTab1;
pTab1 = NULL;
CAcUiTabExtension::PostNcDestroy();
}
父主题: |
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-31 06:16
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.