GcContainerとGcTabControlでズームを行うとスクロールバーが消えることがある

文書番号 : 38995     文書種別 : 不具合     登録日 : 2015/07/08     最終更新日 : 2015/11/27
文書を印刷する
対象製品
MultiTouch for Windows Forms 1.0J
状況
修正済み
詳細
GcZoomまたはGcApplicationZoomコンポーネントを使用している場合、下記の条件をすべて満たした状態で画面をズームすると、GcContainerやGcTabControlのスクロールバーが表示されなくなります。

・GcZoomやGcApplicationZoomコンポーネントにGcContainerZoomPolicyまたはGcTabPageZoomPolicyが適用されている
・GcContainerとGcTabPageのAutoScrollプロパティがTrueに設定されている
・GcContainerとGcTabPageのスクロールバーが表示されている状態で、右端もしくは下端にドラッグされている
回避方法
この問題はService Pack 3(v1.0.2015.1127)で修正されました。
Service Pack 3で提供しているPlusPakZoomPolicyのGcContainerZoomPolicyを適用することで問題を解決できます。
不具合を修正した最新のサービスパックは、アップデートページ からダウンロードできます。

または、以下のようにズームポリシーを修正することでも問題を回避することが可能です。
PlusPakZoomPolicyの中でGcContainerZoomPolicyの継承先をZoomPolicyからScrollableControlZoomPolicyに変更します。

[Visual Basic]
変更前:
Public Class GcContainerZoomPolicy
  Inherits ZoomPolicy

変更後:
Public Class GcContainerZoomPolicy
  Inherits ScrollableControlZoomPolicy

[C#]
変更前:
public class GcContainerZoomPolicy : ZoomPolicy

変更後:
public class GcContainerZoomPolicy : ScrollableControlZoomPolicy

なお、上記の変更を行った状態でGcFlowLayoutContainerZoomPolicyを使用するとGcFlowLayoutContainerのレイアウトが崩れる場合があります。これは、GcFlowLayoutContainerZoomPolicyがGcContainerZoomPolicyを継承しているためです。

そのため、GcFlowLayoutContainerZoomPolicyを使用している場合には、以下のようにGcFlowLayoutContainerZoomPolicyも併せて修正してください。

1.PlusPakZoomPolicy.vb/csにある"GcFlowLayoutContainerZoomPolicy"クラスのコードをコメントアウトする。
2.次のコードを追加する。
3.プロジェクトをビルドする。

[Visual Basic]
Public Class GcFlowLayoutContainerZoomPolicy
  Inherits GcContainerZoomPolicy
  Private _autoScrollCache As New HashSet(Of ScrollableControl)()
  Public Overrides ReadOnly Property TargetType() As Type
    Get
      Return GetType(GcFlowLayoutContainer)
    End Get
  End Property
  Public Overrides Sub Initialize(control As Control)
    control.SuspendLayout()
    Dim flowLayoutContainer = TryCast(control, GcFlowLayoutContainer)
    If flowLayoutContainer.AutoScroll Then
      _autoScrollCache.Add(flowLayoutContainer)
      flowLayoutContainer.AutoScroll = False
    End If
    MyBase.Initialize(control)
  End Sub
  Public Overrides Sub Terminate(control As Control)
    MyBase.Terminate(control)
    Dim flowLayoutContainer = TryCast(control, GcFlowLayoutContainer)
    If _autoScrollCache.Contains(flowLayoutContainer) Then
      flowLayoutContainer.AutoScroll = True
      _autoScrollCache.Remove(flowLayoutContainer)
    End If
    control.ResumeLayout()
  End Sub
End Class

[C#]
  public class GcFlowLayoutContainerZoomPolicy : GcContainerZoomPolicy
  {
    HashSet _autoScrollCache = new HashSet();
    public override Type TargetType
    {
      get { return typeof(GcFlowLayoutContainer); }
    }
    public override void Initialize(Control control)
    {
      control.SuspendLayout();
      var flowLayoutContainer = control as GcFlowLayoutContainer;

      if (flowLayoutContainer.AutoScroll)
      {
        _autoScrollCache.Add(flowLayoutContainer);
        flowLayoutContainer.AutoScroll = false;
      }
      base.Initialize(control);
    }
    public override void Terminate(Control control)
    {
      base.Terminate(control);
      var flowLayoutContainer = control as GcFlowLayoutContainer;
      if (_autoScrollCache.Contains(flowLayoutContainer))
      {
        flowLayoutContainer.AutoScroll = true;
        _autoScrollCache.Remove(flowLayoutContainer);
      }
      control.ResumeLayout();
    }
  }
キーワード
MTTK11174