我有这个代码,我通过使用aced. h中定义的原始命令将其移植到VBA。类型似乎是正确的,除非当然我错过了一些非常巨大的东西。这些努力总是给AutoCAD带来致命的错误...当然,我知道这不是首选方法,但我真的很想拥有这个颜色对话框界面。
这是代码
- ' This is the definition of acedSetColorDialogTrueColor as found in aced.h
- ' acedSetColorDialogTrueColor(
- ' AcCmColor& color,
- ' Adesk::Boolean bAllowMetaColor,
- ' const AcCmColor& curLayerColor,
- ' AcCm::DialogTabs tabs = (AcCm::DialogTabs)(AcCm::kACITab | AcCm::kTrueColorTab| AcCm::kColorBookTab));
- '
- ' My understanding is that AcCmColor& is a pointer to the AcCmColor object(AcadAcCmColor in VBA)
- ' Constants are directly from aced.h
- Private Declare Function acedSetColorDialogTrueColor Lib "acad.exe" (ByVal pColor As Long, _
- ByVal bAllowMetaColor As Boolean, ByVal pCurLayerColor As Long, ByVal DialogTabs As Integer) As Boolean
- Private Const kACITab = 1
- Private Const kTrueColorTab = 2
- Private Const kColorBookTab = 4
- Public Function GetAcadTrueColor(MtaCol As Boolean) As Object
- Dim SelectColor As AcadAcCmColor 'This is returned from the call
- Dim LayColor As New AcadAcCmColor ' This is sent to the call, thus I initialize it first without regard to the color
- On Error Resume Next
- If acedSetColorDialogTrueColor(ObjPtr(SelectColor), MtaCol, ObjPtr(LayColor), kACITab Or kTrueColorTab Or kColorBookTab) Then
- Set GetAcadTrueColor = SelectColor 'return AcadAcCmColor
- End If
- End Function
我已经看到许多其他人也会喜欢这个功能的地方,所以如果它能准确完成,那将是一件好事。
本帖以下内容被隐藏保护;需要你回复后,才能看到! 游客,如果您要查看本帖隐藏内容请 回复 |