The docking bar created by .Net cannot be placed at the bottom of the menu bar in 2016/2022 tests, it can only be fixed at the topmost position. Manual swapping also cannot complete this operation.

PatternSet

PatternSet is an AutoCAD interface. Through the interface, you can set the style of the toolbar and implant your own window into the toolbar. The required WPF window type is ‘UserControl’, which is added to the CAD toolbar as a subcategory. So both can be created separately and finally connected using the interface.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
public class PatternSetWindowCommand
{
[CanBeNull] private static PaletteSet PSet { get; set; } = null;

[CommandMethod("ShowWindow")]
public void ShowWindowCommand()
{
if (PSet == null || PSet.Visible == false)
{
var window = new PatternSetWindow();

PSet = new PaletteSet("Document");
PSet.Visible = true;
ElementHost host = new()
{
AutoSize = true,
Dock = DockStyle.Top,
Child = window
};

PSet.Style = PaletteSetStyles.ShowCloseButton | PaletteSetStyles.ShowAutoHideButton | PaletteSetStyles.SingleRowDock |
PaletteSetStyles.ShowPropertiesMenu | PaletteSetStyles.SingleColDock ;
PSet.Add("TYDI_Document", host);
PSet.KeepFocus = true;
PSet.Size = new Size(600, 50);
PSet.MinimumSize = new Size(300, 50);
PSet.Dock = DockSides.Top;
PSet.RecalculateDockSiteLayout();
}
}

}

Final Effect:
Image Description
Image Description

ToolBar

The way of Toolbar is basically consistent with CUI, you only need to pass in your own command string and bmp format image.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var acadApp = (AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;


var atb = acadApp.MenuGroups.Item("ACAD").Toolbars.Add("TYDI");


var bitmapPath = @"E:\CSharpProgram\TYDIDocumentPlatform\DocumentPlatform\Resources\cCCC.bmp";
var bitmapLargePath = @"E:\CSharpProgram\TYDIDocumentPlatform\DocumentPlatform\Resources\A.bmp";

var atbItem = atb.AddToolbarButton(0, "Test06", "CCC", "LI", false);
//atbItem.SetBitmaps(bitmapPath, bitmapPath);
var atbItem2 = atb.AddToolbarButton(2, "Test02", "BBBB", "CIRLE", false);

//atbItem2.SetBitmaps(bitmapLargePath, bitmapLargePath);
//atb.AddSeparator("3");

atb.Dock(Autodesk.AutoCAD.Interop.Common.AcToolbarDockStatus.acToolbarDockTop);

atb.Visible = true;

Final Effect:
Image Description