質問
書いアプリです。netを使用する閉のためのレイアウトパネルに表示されるように修正しました。そしてそのサイズを変更画面ように、垂直スクロールバーが現れると、水平スクロールバーを自動的に表示されます。見でのスクロールバーすることが可能となくスクロールウィンドウを16ピクセルの幅のその他のスクロールバー).でwindows考えているようだインターネットで提供されるものとして広いの垂直スクロールバーが登場します。
そのサイズ変更のウィンドウ16ピクセル幅(最大限に出していけるようウインド域が広くしたので前のスクロールバーの登場、スクロールバーを受け始めました。現在私がリサイズで裏下かったです。
そういうものでやってみようとしたのがバグはシステムの最小の幅がどことなく粘りが大型化やdownsizgingのウィンドウをマウスでは、無tuchingのスクロールバーに関連したApi)を解除状態
は誰も知らの回避策はしてるわけではありませんので何かへの旅行Windows?
正しい解決策はありません
他のヒント
はい、私はあなたがすでに問題を正しく診断さだと思います。これは、垂直スクロールバーが表示されるとスペースを必要とする、より小さな可能なクライアント領域を作り、言う、の厄介な副作用です。コントロールにフィットするには小さすぎる、今も水平スクロールバーが表示されますすること。それは実際に双安定である、水平バーは、特定の場合にオンとオフちらつくことができます。
この影響を避けるために、レイアウトエンジンは、変化するクライアント領域を扱う、レイアウトを通る複数のパスを作成する必要があります。しかしそれは1回だけになります。賢明なサウンドをどの、これは潜在的に終わることのないループである可能性があります。私は、このためのまともな修正を知りません。あなたのユーザーは、おそらくちょうどスクロールバーの少なくとも一方を取り除くために、ウィンドウに十分な大きさのサイズを変更します。
これはバグフロントのスタッフは英語 こちらの
グの修正方法は、このテーブルレイアウトパネルautosized内の別のパネルには船のメインフォームセット閉=true
いなくなったのtablelayoutpanelスクロールするバギー使用のパネルをスクロールのtablelayoutpanelは内部のパネル
私は正確にあなたが記述行動に気づいていないが、垂直スクロールバーの外観が必要な水平スクロールバーを作るような状況に遭遇しています。
あなたは、私がListBox
でPanel
を持っている場合たとえば、スクロールバーの幅を可能にするために、パネルの内容を設定することができます:
listBox1.Width = panel2.Width - System.Windows.Forms.SystemInformation.VerticalScrollBarWidth;
HTH
私はこの問題に遭遇しました。私が使用した修正がScrollable
にし、その後false
にセットtrue
にしました。ここでListView
のResize
イベントに例があります:
private void myListView_Resize(object sender, EventArgs e)
{
this.SuspendLayout();
//Code to do various resizing stuff
//Force Scrollbar Recalculation
myListView.Scrollable = false;
myListView.Scrollable = true;
this.ResumeLayout(false);
this.PerformLayout();
}
Scrollable
は常に真ではない場合、あなたは再計算を条件付きにすることができます。
もののことを義務付けられているので、まだまだ問題です。NET4.を読みましょうを見に行って延を組み合わせのソリューションのヘルパークラスです。
最初に、ここでは私が撮影用---私のパネルを含む様々な制御できます。子の制御とそのサイズを変更できるユーザ情報に基づいた活動です。また、パネルのリサイズ横ではありません水平スクロールバーのものが取り付けられていない場合はルームを垂直に当たって、垂直スクロールバーが表示されます。さらに、垂直スクロールバーのカバーできないかに統合することができますが、たくない、ギャップんありがとうございます残りは必要ありません。
に'バグが私のヘルパークラスを固定が最初に、この水平スクロールバー、第二に、垂直スクロールバーが表示され、パネルの幅の増加を自動的に対応します。
私の前提条件は、パネルの設定AutoSize、閉をコントロールを設定するAutoSizeしています。
の溶液
のヘルパークが付きにパネル(取り扱いに塗装SizeChangedイベント)がいる。第一に、無効にな水平スクロールバーがあります。こど簡単ではありませで、この問題の解決策がここに 水平スクロールバーの回答によるKbv Subrahmanyam.第二に、塗料、SizeChangedイベントなどを背景にタイマーをチェックするだけであるために、可視性の垂直スクロールバーを変更しました。その場合、ヘルパークラスを変更右のパディングのパネルを追加または削除の余分のスペースのスクロールバーがあります。の利用の各種パネルイベントのタイマーが要求することから始まります。純公開 no イベントでのスクロールバー(ビッグデザイン探傷厚).
一度については、では何もできない変化するサイズのパネルを取り扱いにSizeChangedイベントです。悪いもの(tm)が起こります。くまのパディングによるSizeChangedイベント、Iスケジュールを変更。
とにかく、こちらのコードは、次のとおりですヘルパークラスです。で想定しておいて、当てはまるものすべてに'諸表しみながらおくつろぎます。スレッド...
/// <summary>
/// This class is intended to beat the AutoSize and AutoScroll features into submission!
///
/// Or, at least getting them to work the way I want them to (which may not be the way
/// others think they should work).
///
/// This class will force a panel that has AutoSize enabled to actually increase its
/// width as appropriate when the AutoScroll Vertical scroll bar becomes visible.
/// I like this better than attempting to 'reserve' space for the Vertical scroll bar,
/// which wastes space when the scroll bar is not needed, and leaves ugly gaps in
/// your user interface.
/// </summary>
public class AutoScrollFixer
{
/// <summary>
/// This is the panel we are 'fixing'
/// </summary>
private Panel _panel;
/// <summary>
/// This field keeps track of the original value for
/// the right padding property of the panel.
/// </summary>
private int _originalRightPadding = 0;
/// <summary>
/// We use this flag to prevent recursion problems.
/// </summary>
private bool _adjusting = false;
/// <summary>
/// This flag keeps track of the last known state of the scroll bar.
/// </summary>
private bool _lastScrollBarVisible = false;
/// <summary>
/// We use a timer to check the scroll bar state every so often.
/// This is necessary since .NET (in another stunning piece of
/// architecture from Microsoft) provides absolutely no events
/// attached to the scroll bars of a panel.
/// </summary>
private System.Windows.Forms.Timer _timer = new System.Windows.Forms.Timer();
/// <summary>
/// Construct an AutoScrollFixer and attach it to the provided panel.
/// Once created, there is no particular reason to keep a reference
/// to the AutoScrollFixer in your code. It will silently do its thing
/// in the background.
/// </summary>
/// <param name="panel"></param>
public AutoScrollFixer(Panel panel)
{
_panel = panel;
_originalRightPadding = panel.Padding.Right;
EnableVerticalAutoscroll(_panel);
_lastScrollBarVisible = _panel.VerticalScroll.Visible;
_panel.Paint += (s, a) =>
{
AdjustForVerticalScrollbar();
};
_panel.SizeChanged += (s, a) =>
{
//
// We can't do something that changes the size while handling
// a size change. So, if an adjustment is needed, we will
// schedule it for later.
//
if (_lastScrollBarVisible != _panel.VerticalScroll.Visible)
{
AdjustLater();
}
};
_timer.Tick += (s, a) =>
{
//
// Sadly, the combination of the Paint event and the SizeChanged event
// is NOT enough to guarantee that we will catch a change in the
// scroll bar status. So, as a last ditch effort, we will check
// for a status change every 500 mSecs. Yup, this is a hack!
//
AdjustForVerticalScrollbar();
};
_timer.Interval = 500;
_timer.Start();
}
/// <summary>
/// Enables AutoScroll, but without the Horizontal Scroll bar.
/// Only the Vertical Scroll bar will become visible when necessary
///
/// This method is based on this StackOverflow answer ...
/// https://stackoverflow.com/a/28583501/2175233
/// </summary>
/// <param name="panel"></param>
public static void EnableVerticalAutoscroll( Panel panel )
{
panel.AutoScroll = false;
panel.HorizontalScroll.Enabled = false;
panel.HorizontalScroll.Visible = false;
panel.HorizontalScroll.Maximum = 0;
panel.AutoScroll = true;
}
/// <summary>
/// Queue AdjustForVerticalScrollbar to run on the GUI thread after the current
/// event has been handled.
/// </summary>
private void AdjustLater()
{
ThreadPool.QueueUserWorkItem((t) =>
{
Thread.Sleep(200);
_panel.BeginInvoke((Action)(() =>
{
AdjustForVerticalScrollbar();
}));
});
}
/// <summary>
/// This is where the real work gets done. When this method is called, we will
/// simply set the right side padding on the panel to make room for the
/// scroll bar if it is being displayed, or reset the padding value to
/// its original value if not.
/// </summary>
private void AdjustForVerticalScrollbar()
{
if (!_adjusting)
{
try
{
_adjusting = true;
if (_lastScrollBarVisible != _panel.VerticalScroll.Visible)
{
_lastScrollBarVisible = _panel.VerticalScroll.Visible;
Padding p = _panel.Padding;
p.Right = _lastScrollBarVisible ? _originalRightPadding + System.Windows.Forms.SystemInformation.VerticalScrollBarWidth + 2 : _originalRightPadding;
_panel.Padding = p;
_panel.PerformLayout();
}
}
finally
{
_adjusting = false;
}
}
}
}