私は現在、ドッキングパネル/フォームのビジュアルスタジオを再作成しようとしています。異なるウィンドウビューを扱うために同じシステムを別のプロジェクトに適用したいが、まずそれを再作成したい。MdiChildとNormalの間で子フォームを切り替えることはできますか?
これまでは、MainFormとnullの間でMDiParentプロパティを切り替えていましたが、Visual Studioに見られるスムーズな遷移を再作成できませんでした。それはいつもジャッキーです。私はMouseUPイベントを見つける時間の半分です。私はスイッチをめったに働かせないようにしています(私は現在、Location changeイベントを使用しています)。
フォームを移動するには、この便利なコードブロックを使用しています。
#region Form Movement
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
[System.Runtime.InteropServices.DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[System.Runtime.InteropServices.DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
private void MoveForm()
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
#endregion
ドック/アンドックを処理するには、このコードを使用しています。
private void DockToMain()
{
Point f = Form1.Main.PointToClient(this.Location);
Point newP = new Point(f.X - 25, f.Y - 51);
try { this.MdiParent = Form1.Main; } catch { }
this.Location = newP;
}
private void UnDockFromMain()
{
Point f = Form1.Main.PointToScreen(this.Location);
Point newP = new Point(f.X + 25, f.Y + 51);
try { this.MdiParent = null; } catch { }
this.Location = newP;
}
Winformsの中ドックパネル/フォームを再作成する方法はありますか?私はここでも正しい道にいるのですか?それとも私が見ていないよりよい方法はありますか?
UIは本当に難しいです。だから、このhttps://github.com/xceedsoftware/wpftoolkitのようなものは良いです。アバロンドック、ちょうどfyi。 – Will
"これは常にjanky_です" "janky'を定義してください。"あなたは実際にどのような行動をしていますか?ドッキングの正しい場所を取得するには、Form ...を使用したくない場合は、MdiParentフォームの[MdiClient](https://stackoverflow.com/a/604275/2330053)コントロールを見つけて、それを使用します。 –
フォームドック、spazzes、ドッキング解除、または画面外に移動 –