I'm using the DockWindow on an MDI WinForms app. The Customer Search form is the first one to open.
When I open another form I'd like it to appear to the right of Customer Search. For some reason its appearing to the left.
The code below shows how I open it. Setting the MDIParent adds it to the DocumentWindows collection.
How can I get the Account form to appear to the right of Customer Search. (And any forms opened after that also must appear to the right.)
FormAccount? form = null;
foreach (HostWindow window in this.dock.DockWindows.DocumentWindows)
if (window.MdiChild is FormAccount)
{
FormAccount formCandidate = (FormAccount)window.MdiChild;
if (formCandidate.BranchId == GlobalServices.Instance.ActiveBranchID && formCandidate.AccountId == (accountId == null ? GlobalServices.Instance.ActiveAccount.NamesId : accountId))
form = formCandidate;
}
if (form == null)
{
form = accountId == null ? new FormAccount(GlobalServices.Instance) : new FormAccount(GlobalServices.Instance, accountId);
form.AccountId = GlobalServices.Instance.ActiveAccountID;
form.MdiParent = this;
form.SetImageAndTitle(ETitleFormat.Account);
form.AccountFormType = EAccountFormType.Account;
form.ControlBox = false;
form.LaunchedFromIPC = launchedFromIPC;
if (sender == null)
this.WindowState = FormWindowState.Maximized;
form.Show();
}
HostWindow hw = App.MainForm.dock.GetHostWindow(form);
if (hw != null)
dock.ActivateWindow(hw);Thanks
Carl
