彩票走势图

Spread Studio for .NET使用教程:为控件创建自定义皮肤

原创|使用教程|编辑:郝浩|2013-06-09 13:52:15.000|阅读 425 次

概述:通过将皮肤应用到Spread组件,可以快速自定义Spread工作表外观。Spread也提供一些内置的皮肤用来创建常见的格式。您可以创建自己的自定义皮肤,并将其保存以便再次使用。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

相关链接:

通过将皮肤应用到Spread组件,可以快速自定义Spread工作表外观。Spread也提供一些内置的皮肤用来创建常见的格式。您可以创建自己的自定义皮肤,并将其保存以便再次使用,和模版的使用原理相同。

免费下载Spread Studio for .NET最新版

使用快捷方式:

  1. 使用SpreadSkin对象的构造函数,并设置其参数指定皮肤的设置。
  2. 使用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);

VB

 

' Create a custom skin.
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 int As New FarPoint.Win.Spread.EnhancedInterfaceRenderer
int.ArrowColorDisabled = Color.Green
int.ArrowColorEnabled = Color.LightSeaGreen
int.ScrollBoxBackgroundColor = Color.Aqua
int.TabShape = FarPoint.Win.Spread.EnhancedInterfaceRenderer.SheetTabShape.RoundedRectangle
int.TabStripButtonStyle = FarPoint.Win.Spread.EnhancedInterfaceRenderer.ButtonStyles.Enhanced
int.TabStripButtonFlatStyle = FlatStyle.Popup
int.SheetTabBorderColor = Color.Aquamarine
int.SheetTabLowerActiveColor = Color.DarkSeaGreen
int.SheetTabLowerNormalColor = Color.DarkOliveGreen
int.SheetTabUpperActiveColor = Color.ForestGreen
int.SheetTabUpperNormalColor = Color.LightSeaGreen
int.SplitBarBackgroundColor = Color.Aquamarine
int.SplitBarDarkColor = Color.DarkGreen
int.SplitBarLightColor = Color.LightGreen
int.SplitBoxBackgroundColor = Color.Green
int.SplitBoxBorderColor = Color.LimeGreen
int.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", int, ScrollBarR, focusrend, gsr, ds, chstyle, rowhstyle, corner)
skin.Apply(FpSpread1)

标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@cahobeh.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP