MESCIUS SPREAD for Windows Forms 15.0J > 開発者ガイド > スタイル > スキン > コントロールのカスタムスキンの作成 |
SPREADには、一般的なフォーマットを作成するためのいくつかの組み込みスキンが付属していますが、独自のカスタムスキンを作成して、テンプレート同様に保存および再利用することもできます。
スキンの基本モデルの詳細については、「Style モデル」を参照してください。
SpreadSkinクラスのインスタンスを作成し、コンストラクタの引数でスキンの各属性を指定します。SpreadSkinクラスのApplyメソッドを使用して、スキンをコントロールに適用します。
次のサンプルコードは、カスタムスキンを作成し、コントロールに適用します。
C# |
コードのコピー
|
---|---|
// カスタムスキンを作成します。 fpSpread1.Sheets.Count = 3; FarPoint.Win.Spread.StyleInfo chd = new FarPoint.Win.Spread.StyleInfo(); chd.BackColor = Color.LightGreen; FarPoint.Win.Spread.StyleInfo cds = new FarPoint.Win.Spread.StyleInfo(); cds.BackColor = Color.LightGreen; FarPoint.Win.Spread.StyleInfo rhd = new FarPoint.Win.Spread.StyleInfo(); rhd.BackColor = Color.LightGreen; FarPoint.Win.Spread.StyleInfo def = new FarPoint.Win.Spread.StyleInfo(); FarPoint.Win.Spread.GradientSelectionRenderer gsr = new FarPoint.Win.Spread.GradientSelectionRenderer(); gsr.Color1 = Color.Green; gsr.Color2 = Color.LightGreen; gsr.Opacity = 50; def.BackColor = Color.Honeydew; FarPoint.Win.Spread.EnhancedInterfaceRenderer int1 = new FarPoint.Win.Spread.EnhancedInterfaceRenderer(); int1.ArrowColorDisabled = Color.Green; int1.ArrowColorEnabled = Color.LightSeaGreen; int1.ScrollBoxBackgroundColor = Color.Aqua; int1.TabShape = FarPoint.Win.Spread.EnhancedInterfaceRenderer.SheetTabShape.RoundedRectangle; int1.TabStripButtonStyle = FarPoint.Win.Spread.EnhancedInterfaceRenderer.ButtonStyles.Enhanced; int1.TabStripButtonFlatStyle = FlatStyle.Popup; int1.SheetTabBorderColor = Color.Aquamarine; int1.SheetTabLowerActiveColor = Color.DarkSeaGreen; int1.SheetTabLowerNormalColor = Color.DarkOliveGreen; int1.SheetTabUpperActiveColor = Color.ForestGreen; int1.SheetTabUpperNormalColor = Color.LightSeaGreen; int1.SplitBarBackgroundColor = Color.Aquamarine; int1.SplitBarDarkColor = Color.DarkGreen; int1.SplitBarLightColor = Color.LightGreen; int1.SplitBoxBackgroundColor = Color.Green; int1.SplitBoxBorderColor = Color.LimeGreen; int1.TabStripBackgroundColor = Color.Aquamarine; FarPoint.Win.Spread.NamedStyle chstyle = new FarPoint.Win.Spread.NamedStyle("ColumnHeaders", "HeaderDefault", chd); FarPoint.Win.Spread.NamedStyle corner = new FarPoint.Win.Spread.NamedStyle("CornerHeaders", "HeaderDefault", cds); FarPoint.Win.Spread.NamedStyle rowhstyle = new FarPoint.Win.Spread.NamedStyle("RowHeaders", "HeaderDefault", rhd); FarPoint.Win.Spread.NamedStyle ds = new FarPoint.Win.Spread.NamedStyle("Default", "DataAreaDefault", def); FarPoint.Win.Spread.MarqueeFocusIndicatorRenderer focusrend = new FarPoint.Win.Spread.MarqueeFocusIndicatorRenderer(Color.LightSeaGreen, 2); FarPoint.Win.Spread.EnhancedScrollBarRenderer ScrollBarR = new FarPoint.Win.Spread.EnhancedScrollBarRenderer(Color.Green, Color.LightGreen, Color.Green, Color.Aqua, Color.DarkGreen, Color.DarkSeaGreen, Color.Turquoise, Color.SpringGreen, Color.Teal, Color.PaleGreen, Color.ForestGreen); FarPoint.Win.Spread.SpreadSkin skin = new FarPoint.Win.Spread.SpreadSkin("MySkin", int1, ScrollBarR, focusrend, gsr, ds, chstyle, rowhstyle, corner); skin.Apply(fpSpread1); |
Visual Basic |
コードのコピー
|
---|---|
' カスタムスキンを作成します。 FpSpread1.Sheets.Count = 3 Dim chd As New FarPoint.Win.Spread.StyleInfo chd.BackColor = Color.LightGreen Dim cds As New FarPoint.Win.Spread.StyleInfo cds.BackColor = Color.LightGreen Dim rhd As New FarPoint.Win.Spread.StyleInfo rhd.BackColor = Color.LightGreen Dim def As New FarPoint.Win.Spread.StyleInfo Dim gsr As New FarPoint.Win.Spread.GradientSelectionRenderer gsr.Color1 = Color.Green gsr.Color2 = Color.LightGreen gsr.LinearGradientMode = Drawing2D.LinearGradientMode.BackwardDiagonal gsr.Opacity = 50 def.BackColor = Color.Honeydew Dim int1 As New FarPoint.Win.Spread.EnhancedInterfaceRenderer int1.ArrowColorDisabled = Color.Green int1.ArrowColorEnabled = Color.LightSeaGreen int1.ScrollBoxBackgroundColor = Color.Aqua int1.TabShape = FarPoint.Win.Spread.EnhancedInterfaceRenderer.SheetTabShape.RoundedRectangle int1.TabStripButtonStyle = FarPoint.Win.Spread.EnhancedInterfaceRenderer.ButtonStyles.Enhanced int1.TabStripButtonFlatStyle = FlatStyle.Popup int1.SheetTabBorderColor = Color.Aquamarine int1.SheetTabLowerActiveColor = Color.DarkSeaGreen int1.SheetTabLowerNormalColor = Color.DarkOliveGreen int1.SheetTabUpperActiveColor = Color.ForestGreen int1.SheetTabUpperNormalColor = Color.LightSeaGreen int1.SplitBarBackgroundColor = Color.Aquamarine int1.SplitBarDarkColor = Color.DarkGreen int1.SplitBarLightColor = Color.LightGreen int1.SplitBoxBackgroundColor = Color.Green int1.SplitBoxBorderColor = Color.LimeGreen int1.TabStripBackgroundColor = Color.Aquamarine Dim chstyle As New FarPoint.Win.Spread.NamedStyle("ColumnHeaders", "HeaderDefault", chd) Dim corner As New FarPoint.Win.Spread.NamedStyle("CornerHeaders", "HeaderDefault", cds) Dim rowhstyle As New FarPoint.Win.Spread.NamedStyle("RowHeaders", "HeaderDefault", rhd) Dim ds As New FarPoint.Win.Spread.NamedStyle("Default", "DataAreaDefault", def) Dim focusrend As New FarPoint.Win.Spread.MarqueeFocusIndicatorRenderer(Color.LightSeaGreen, 2) Dim ScrollBarR As New FarPoint.Win.Spread.EnhancedScrollBarRenderer(Color.Green, Color.LightGreen, Color.Green, Color.Aqua, Color.DarkGreen, Color.DarkSeaGreen, Color.Turquoise, Color.SpringGreen, Color.Teal, Color.PaleGreen, Color.ForestGreen) Dim skin As New FarPoint.Win.Spread.SpreadSkin("MySkin", int1, ScrollBarR, focusrend, gsr, ds, chstyle, rowhstyle, corner) skin.Apply(FpSpread1) |