1 Attachment(s)
Iterate through all layout and rename them from left to right
Hello everyone, I'm using Autocad api and C# to create an addin on autocad. I want to list all layout name to listbox then rename them begin 01 (ex. 01, 02, 03...) from left to right but when I create new layout (layout1) and move it to top, the list box show all layouts names no change by oder from left to right. Anyone give me an idea please? Thanks!
Re: Iterate through all layout and rename them from left to right
When populating your Form's 'Layout list' pane, you're likely getting the Layout names from the ACAD_LAYOUT Dictionary, without first sorting by Layout.TabOrder (Int).
If your Form's modeless and want it to update dynamically, then you'll need to hook the LayoutManager.LayoutsReordered Event.
Cheers
Re: Iterate through all layout and rename them from left to right
Duplicate thread:
https://forums.autodesk.com/t5/net/i.../td-p/10757309
Perhaps OrderBy() will help:
Code:
layoutList.OrderBy(x => x.TabOrder).ToList();