Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
When I used the following code to simulate the window equal distribution, I found that if I switch between multiple documents by using the command, the window switching works successfully. However, when I activate other documents, the start interface will cover the display of other documents. If the start interface is minimized, this problem won't occur.
How should I fix this bug ,so how can I make the start interface minimized from the beginning?
Thank you first!
[CommandMethod(nameof(SizeDocumentWindowTest), CommandFlags.Session)]
public static void SizeDocumentWindowTest()
{
//Size the Document window
Document acDoc = Acaop.DocumentManager.MdiActiveDocument;
var count = Acaop.DocumentManager.Count;
if (Acaop.DocumentManager.Count == 0)
return;
acDoc.Window.WindowState = Window.State.Maximized;
var size = acDoc.Window.GetSize();
$"size:{size}".Print();
$"count:{count}".Print();
acDoc.Window.WindowState = Window.State.Minimized;
var width = size.Width / count;
int i = 0;
foreach (var item in Acaop.DocumentManager)
{
if (item is not Document doc)
continue;
if (string.IsNullOrEmpty(doc.Name))
$"doc:{doc.Name}".Print();
Acaop.DocumentManager.MdiActiveDocument = doc;
doc.Window.WindowState = Window.State.Normal;
doc.Window.DeviceIndependentLocation = new System.Windows.Point(width * i, 0);
doc.Window.DeviceIndependentSize = new Size(width, size.Height);
i++;
}
Acaop.DocumentManager.MdiActiveDocument = acDoc;
}
Solved! Go to Solution.