CAD可停靠面板PaletteSet问题
本意是想利用PaletteSet做一个可以自动隐藏的浮动条。如何使PaletteSet加载后处于浮动状态,并且显示设置的最小尺寸。
public static void Xxx1()
{
_ps1 = new PaletteSet("1");
var s = new Size(800, 100);
_ps1.Size = s;
_ps1.MinimumSize = new Size(800, 100);
UserControl x1 = new Pldhhzdw();
_ps1.Add("2", x1);
_ps1.Dock = DockSides.None;
_ps1.TitleBarLocation = PaletteSetTitleBarLocation.Left;
_ps1.Visible = true;
}
可是加载后总是会自动停靠,请问怎么解决。谢谢!
要求显示效果如图
就如CAD的图层面板那样,打开就是处于浮动状态
我也用vb.net做了一个类似的,用的也是PaletteSet,先设计了一个用户自定义控件后,编程加入到autocad。与楼上的差不多,后图纸存盘。图面上有很多块参考,我用如下程序遍历模型空间内的所有快参考,请问在哪些情况下遍历不到块参考?
Public Function GetBlockNames() As String()
Dim list As ArrayList = New ArrayList
Dim db As Database = Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase
Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager
Dim docLock As DocumentLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument()
Dim ta As Transaction = tm.StartTransaction()
Try
Dim bt As BlockTable = ta.GetObject(db.BlockTableId, OpenMode.ForRead)
Dim btr As BlockTableRecord = ta.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForRead)
For Each id As ObjectId In btr
Dim obj As DBObject = ta.GetObject(id, OpenMode.ForRead)
If TypeOf obj Is BlockReference Then
Dim br As BlockReference = CType(obj, BlockReference)
list.Add(br.Name)
End If
Next
ta.Commit()
Dim arr As String()
If list.Count = 0 Then
Return Nothing
End If
ReDim arr(list.Count - 1)
For i As Integer = 0 To list.Count - 1 Step 1
arr(i) = CType(list(i), String)
Next
Return arr
Catch
ta.Abort()
Return Nothing
Finally
docLock.Dispose()
ta.Dispose()
End Try
End Function
无意中弄好了,感谢各个网友的回复复制代码这样就不会自动停靠。
留存一下。
谢谢回复,这个试过,没有作用
貌似这个面板总是停靠的,你要浮动的话可能需要用普通对话框了;
有个DockEnabled属性,设置为None试试看
AutoCAD的图层对话框应该不是面板,是普通的对话框 自己做了一个
嵌套块参考能遍历到吗?也即块参考里面的块参考? 学习学习学习了 PaletteSet在vs2010+cad2014下面,说没有引用,这是怎么回事?请教
页:
[1]