私は SplitContainer (正確にはNonFlickerSplitContainerの1 つ) を持っており、その両方のパネルをペイントする単一のキャンバスとして扱います。Graphics.DrawImage メソッドを使用して、パネルにビットマップを個別に描画します。最初に Panel1 を更新し、次に Panel2 を更新すると、垂直/水平の引き裂きが発生します - Panel1 の描画が終了し、次に Panel2 の描画が開始されます - これが理由です。私の問題の解決策は何ですか?ビフォア/アフター機能を備えた「ビットマップ ビデオ ストリーム」への出力として、splitContainer を使用します。Panel2_Paint が終了するまで、どうにかして UI をフリーズできますか?
private void splitContainer_Panel1_Paint(object sender, PaintEventArgs e)
{
if (frameA != null)
{
if (ORIGINAL_SIZE_SET)
e.Graphics.DrawImage(frameA, 0, 0);
else
e.Graphics.DrawImage(frameA, 0, 0, ClientSize.Width, ClientSize.Height);
}
}
private void splitContainer_Panel2_Paint(object sender, PaintEventArgs e)
{
if (frameB != null)
{
//...
if (ORIGINAL_SIZE_SET)
e.Graphics.DrawImage(frameB, x, y);
else
e.Graphics.DrawImage(frameB, x, y, ClientSize.Width, ClientSize.Height);
}
}
private Bitmap frameA = null;
private Bitmap frameB = null;
private void RefreshOutput(bool refreshClipA = true, bool refreshClipB = true)
{
if (refreshClipA)
{
frameA = GetVideoFrame(...);
//...
}
if (refreshClipB)
{
frameB = GetVideoFrame(...);
//...
}
if (refreshClipA)
splitContainer.Panel1.Refresh();
if (refreshClipB)
splitContainer.Panel2.Refresh();
}