GcResizeコンポーネントによるリサイズ時に、GcShapeButtonのフォントサイズが変更されない
対象製品
PlusPak for Windows Forms 8.0J
状況
修正済み
詳細
GcResizeコンポーネントを使用してリサイズを行う場合、GcShapeButtonResizePolicyを使用してもGcShapeButtonコントロールのフォントサイズが変更されません。
本現象はGcApplicationResizeコンポーネント、GcResizePanelコントロールを使用した場合にも発生します。
本現象はGcApplicationResizeコンポーネント、GcResizePanelコントロールを使用した場合にも発生します。
回避方法
この問題はService Pack 1(v8.0.5015.918)で修正されました。
不具合を修正した最新のサービスパックは、アップデートページ からダウンロードできます。
Service Pack 2より前のバージョンでは次の方法で回避可能です。
下記のコードを使用してユーザー定義のリサイズポリシーを作成し追加することで回避できます。
回避方法を適用する場合は、「ResizePolicy コレクションエディター」で"GcShapeButtonResizePolicy(組み込み)"のEnableプロパティをFalseに設定してください。
ユーザー定義のリサイズポリシーの使い方については、製品ヘルプの次の章を参照してください。
+[PlusPak の使い方]
+[レイアウト]
+[GcResize コンポーネント]
+[リサイズポリシー]
+[リサイズポリシーの使い方]
[ユーザー定義のリサイズポリシー]
[Visual Basic]
Imports GrapeCity.Win.Buttons
Imports GrapeCity.Win.Components
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms
Public Class CustomGcShapeButtonResizePolicy
Inherits ResizePolicy
Public Overloads Overrides ReadOnly Property TargetType() As Type
Get
Return GetType(GcShapeButton)
End Get
End Property
ReadOnly _startSizeModes As New Dictionary(Of GcShapeButton, GcShapeButtonSizeMode)()
Public Overloads Overrides Sub Initialize(control As Control)
Dim gcShapeButton As GcShapeButton = TryCast(control, GcShapeButton)
If Not _startSizeModes.ContainsKey(gcShapeButton) Then
If gcShapeButton.SizeMode = GcShapeButtonSizeMode.AutoSize OrElse gcShapeButton.SizeMode = GcShapeButtonSizeMode.CenterImage OrElse gcShapeButton.SizeMode = GcShapeButtonSizeMode.Normal Then
_startSizeModes.Add(gcShapeButton, gcShapeButton.SizeMode)
End If
End If
MyBase.Initialize(control)
End Sub
Public Overloads Overrides Sub ResizeLayout(control As Control, infos As ResizeLayoutInfo)
Dim gcShapeButton As GcShapeButton = TryCast(control, GcShapeButton)
If Math.Min(infos.TargetFactorX, infos.TargetFactorY) > 1 Then
If gcShapeButton.SizeMode = GcShapeButtonSizeMode.AutoSize OrElse gcShapeButton.SizeMode = GcShapeButtonSizeMode.CenterImage OrElse gcShapeButton.SizeMode = GcShapeButtonSizeMode.Normal Then
gcShapeButton.SizeMode = GcShapeButtonSizeMode.Zoom
End If
Else
If _startSizeModes.ContainsKey(gcShapeButton) Then
gcShapeButton.SizeMode = _startSizeModes(gcShapeButton)
_startSizeModes.Remove(gcShapeButton)
End If
End If
MyBase.ResizeLayout(control, infos)
End Sub
End Class
[C#]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using GrapeCity.Win.Buttons;
using GrapeCity.Win.Components;
namespace CS
{
public class CustomGcShapeButtonResizePolicy: ResizePolicy
{
public override Type TargetType
{
get
{
return typeof(GcShapeButton);
}
}
readonly Dictionary _startSizeModes = new Dictionary();
public override void Initialize(Control control)
{
GcShapeButton gcShapeButton = control as GcShapeButton;
if (!_startSizeModes.ContainsKey(gcShapeButton))
{
if (gcShapeButton.SizeMode == GcShapeButtonSizeMode.AutoSize ||
gcShapeButton.SizeMode == GcShapeButtonSizeMode.CenterImage ||
gcShapeButton.SizeMode == GcShapeButtonSizeMode.Normal
)
{
_startSizeModes.Add(gcShapeButton, gcShapeButton.SizeMode);
}
}
base.Initialize(control);
}
public override void ResizeLayout(Control control, ResizeLayoutInfo infos)
{
GcShapeButton gcShapeButton = control as GcShapeButton;
if (Math.Min(infos.TargetFactorX, infos.TargetFactorY) > 1)
{
if (gcShapeButton.SizeMode == GcShapeButtonSizeMode.AutoSize ||
gcShapeButton.SizeMode == GcShapeButtonSizeMode.CenterImage ||
gcShapeButton.SizeMode == GcShapeButtonSizeMode.Normal
)
{
gcShapeButton.SizeMode = GcShapeButtonSizeMode.Zoom;
}
}
else
{
if (_startSizeModes.ContainsKey(gcShapeButton))
{
gcShapeButton.SizeMode = _startSizeModes[gcShapeButton];
_startSizeModes.Remove(gcShapeButton);
}
}
base.ResizeLayout(control, infos);
}
}
}
不具合を修正した最新のサービスパックは、アップデートページ からダウンロードできます。
Service Pack 2より前のバージョンでは次の方法で回避可能です。
下記のコードを使用してユーザー定義のリサイズポリシーを作成し追加することで回避できます。
回避方法を適用する場合は、「ResizePolicy コレクションエディター」で"GcShapeButtonResizePolicy(組み込み)"のEnableプロパティをFalseに設定してください。
ユーザー定義のリサイズポリシーの使い方については、製品ヘルプの次の章を参照してください。
+[PlusPak の使い方]
+[レイアウト]
+[GcResize コンポーネント]
+[リサイズポリシー]
+[リサイズポリシーの使い方]
[ユーザー定義のリサイズポリシー]
[Visual Basic]
Imports GrapeCity.Win.Buttons
Imports GrapeCity.Win.Components
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms
Public Class CustomGcShapeButtonResizePolicy
Inherits ResizePolicy
Public Overloads Overrides ReadOnly Property TargetType() As Type
Get
Return GetType(GcShapeButton)
End Get
End Property
ReadOnly _startSizeModes As New Dictionary(Of GcShapeButton, GcShapeButtonSizeMode)()
Public Overloads Overrides Sub Initialize(control As Control)
Dim gcShapeButton As GcShapeButton = TryCast(control, GcShapeButton)
If Not _startSizeModes.ContainsKey(gcShapeButton) Then
If gcShapeButton.SizeMode = GcShapeButtonSizeMode.AutoSize OrElse gcShapeButton.SizeMode = GcShapeButtonSizeMode.CenterImage OrElse gcShapeButton.SizeMode = GcShapeButtonSizeMode.Normal Then
_startSizeModes.Add(gcShapeButton, gcShapeButton.SizeMode)
End If
End If
MyBase.Initialize(control)
End Sub
Public Overloads Overrides Sub ResizeLayout(control As Control, infos As ResizeLayoutInfo)
Dim gcShapeButton As GcShapeButton = TryCast(control, GcShapeButton)
If Math.Min(infos.TargetFactorX, infos.TargetFactorY) > 1 Then
If gcShapeButton.SizeMode = GcShapeButtonSizeMode.AutoSize OrElse gcShapeButton.SizeMode = GcShapeButtonSizeMode.CenterImage OrElse gcShapeButton.SizeMode = GcShapeButtonSizeMode.Normal Then
gcShapeButton.SizeMode = GcShapeButtonSizeMode.Zoom
End If
Else
If _startSizeModes.ContainsKey(gcShapeButton) Then
gcShapeButton.SizeMode = _startSizeModes(gcShapeButton)
_startSizeModes.Remove(gcShapeButton)
End If
End If
MyBase.ResizeLayout(control, infos)
End Sub
End Class
[C#]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using GrapeCity.Win.Buttons;
using GrapeCity.Win.Components;
namespace CS
{
public class CustomGcShapeButtonResizePolicy: ResizePolicy
{
public override Type TargetType
{
get
{
return typeof(GcShapeButton);
}
}
readonly Dictionary
public override void Initialize(Control control)
{
GcShapeButton gcShapeButton = control as GcShapeButton;
if (!_startSizeModes.ContainsKey(gcShapeButton))
{
if (gcShapeButton.SizeMode == GcShapeButtonSizeMode.AutoSize ||
gcShapeButton.SizeMode == GcShapeButtonSizeMode.CenterImage ||
gcShapeButton.SizeMode == GcShapeButtonSizeMode.Normal
)
{
_startSizeModes.Add(gcShapeButton, gcShapeButton.SizeMode);
}
}
base.Initialize(control);
}
public override void ResizeLayout(Control control, ResizeLayoutInfo infos)
{
GcShapeButton gcShapeButton = control as GcShapeButton;
if (Math.Min(infos.TargetFactorX, infos.TargetFactorY) > 1)
{
if (gcShapeButton.SizeMode == GcShapeButtonSizeMode.AutoSize ||
gcShapeButton.SizeMode == GcShapeButtonSizeMode.CenterImage ||
gcShapeButton.SizeMode == GcShapeButtonSizeMode.Normal
)
{
gcShapeButton.SizeMode = GcShapeButtonSizeMode.Zoom;
}
}
else
{
if (_startSizeModes.ContainsKey(gcShapeButton))
{
gcShapeButton.SizeMode = _startSizeModes[gcShapeButton];
_startSizeModes.Remove(gcShapeButton);
}
}
base.ResizeLayout(control, infos);
}
}
}
キーワード
PPWI20002