如果以上自定义不能满足你的需求,你可以实现一个自定义的IInterfaceRenderer ,比如下面的代码:
- public class MyEnhancedInterfaceRenderer : FarPoint.Win.Spread.IInterfaceRenderer
- {
- FarPoint.Win.Spread.EnhancedInterfaceRenderer enhR = new FarPoint.Win.Spread.EnhancedInterfaceRenderer();
- #region IInterfaceRenderer Members
- public void PaintButton(System.Drawing.Graphics g, int x, int y, int width, int height, FarPoint.Win.Spread.TabStripButton button, bool mouseOver, bool pressed, bool isLeftToRight, bool enabled)
- {
- enhR.PaintButton(g, x, y, width, height, button, mouseOver, pressed, isLeftToRight, enabled);
- }
- public void PaintGrayArea(System.Drawing.Graphics g, int x, int y, int width, int height)
- {
- g.DrawString("", new Font("Arial", 14, FontStyle.Bold), Brushes.Red, 300, 50);
- }
- public void PaintRangeGroupArea(System.Drawing.Graphics g, int x, int y, int width, int height)
- {
- enhR.PaintRangeGroupArea(g, x, y, width, height);
- }
- public void PaintRangeGroupButton(System.Drawing.Graphics g, int x, int y, int width, int height, FarPoint.Win.Spread.GroupState groupState, bool rowGroup, bool isLeftToRight)
- {
- // 在这里实现自定义Button的逻辑
- //enhR.PaintRangeGroupButton(g, x, y, width, height, groupState, rowGroup, isLeftToRight);
- }
- public void PaintRangeGroupLevelBox(System.Drawing.Graphics g, int x, int y, int width, int height, int groupLevel, bool rowGroup, bool isLeftToRight)
- {
- enhR.PaintRangeGroupLevelBox(g, x, y, width, height, groupLevel, rowGroup, isLeftToRight);
- }
- public void PaintRangeGroupLine(System.Drawing.Graphics g, System.Drawing.Point startPoint, System.Drawing.Point endPoint)
- {
- enhR.PaintRangeGroupLine(g, startPoint, endPoint);
- }
- public void PaintRangeGroupPoint(System.Drawing.Graphics g, System.Drawing.Point point)
- {
- enhR.PaintRangeGroupPoint(g, point);
- }
- public void PaintScrollBox(System.Drawing.Graphics g, int x, int y, int width, int height)
- {
- enhR.PaintScrollBox(g, x, y, width, height);
- }
- public void PaintSheetTab(System.Drawing.Graphics g, int sheet, string text, int x, int y, int width, int height, bool mouseOver, bool focused, FarPoint.Win.Spread.TabStripPlacement placement,
- bool isLeftToRight, bool enabled, System.Drawing.Font font, System.Drawing.Font activeFont)
- {
- enhR.PaintSheetTab(g, sheet, text, x, y, width, height, mouseOver, focused, placement,
- isLeftToRight, enabled, font, activeFont);
- }
- public void PaintSheetTabPartial(System.Drawing.Graphics g, int sheet, string text, int x, int y, int width, int height, bool mouseOver, bool focused, FarPoint.Win.Spread.TabStripPlacement placement,
- bool isLeftToRight, bool enabled, System.Drawing.Font font, System.Drawing.Font activeFont)
- {
- enhR.PaintSheetTabPartial(g, sheet, text, x, y, width, height, mouseOver, focused, placement,
- isLeftToRight, enabled, font, activeFont);
- }
- public void PaintSpecialSheetTab(System.Drawing.Graphics g, int x, int y, int width, int height, bool mouseOver, FarPoint.Win.Spread.TabStripPlacement placementbStrip, bool isLeftToRight, bool enabled, System.Drawing.Font font,
- System.Drawing.Font activeFont)
- {
- enhR.PaintSpecialSheetTab(g, x, y, width, height, mouseOver, placementbStrip, isLeftToRight, enabled, font,
- activeFont);
- }
- public void PaintSplitBar(System.Drawing.Graphics g, int x, int y, int width, int height)
- {
- enhR.PaintSplitBar(g, x, y, width, height);
- }
- public void PaintSplitBarCrossover(System.Drawing.Graphics g, int x, int y, int width, int height)
- {
- enhR.PaintSplitBarCrossover(g, x, y, width, height);
- }
- public void PaintSplitBox(System.Drawing.Graphics g, int x, int y, int width, int height)
- {
- enhR.PaintSplitBox(g, x, y, width, height);
- }
- public void PaintTabStripBackground(System.Drawing.Graphics g, int x, int y, int width, int height, FarPoint.Win.Spread.TabStripPlacement placement)
- {
- enhR.PaintTabStripBackground(g, x, y, width, height, placement);
- }
- #endregion
- }
复制代码 |