61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
![]() |
using System;
|
|||
|
using CPF.Drawing;
|
|||
|
using CPF.Input;
|
|||
|
using CPF.ReoGrid.Graphics;
|
|||
|
using CPF.ReoGrid.Interaction;
|
|||
|
using CPF.ReoGrid.Rendering;
|
|||
|
|
|||
|
namespace CPF.ReoGrid.Views
|
|||
|
{
|
|||
|
internal class LeadHeaderView : View
|
|||
|
{
|
|||
|
public LeadHeaderView(ViewportController vc) : base(vc)
|
|||
|
{
|
|||
|
this.sheet = vc.worksheet;
|
|||
|
}
|
|||
|
|
|||
|
public override void Draw(CellDrawingContext dc)
|
|||
|
{
|
|||
|
bool flag = this.bounds.Width <= 0f || this.bounds.Height <= 0f || this.sheet.controlAdapter == null;
|
|||
|
if (!flag)
|
|||
|
{
|
|||
|
IGraphics graphics = dc.Graphics;
|
|||
|
ControlAppearanceStyle controlStyle = this.sheet.workbook.controlAdapter.ControlStyle;
|
|||
|
graphics.FillRectangle(this.bounds, controlStyle.Colors[ControlAppearanceColors.LeadHeadNormal]);
|
|||
|
Color startColor = this.sheet.isLeadHeadSelected ? controlStyle.Colors[ControlAppearanceColors.LeadHeadIndicatorStart] : controlStyle.Colors[ControlAppearanceColors.LeadHeadSelected];
|
|||
|
Color endColor = controlStyle.Colors[ControlAppearanceColors.LeadHeadIndicatorEnd];
|
|||
|
dc.Renderer.DrawLeadHeadArrow(this.bounds, startColor, endColor);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override bool OnMouseDown(Point location, MouseButtons buttons, InputModifiers modifiers)
|
|||
|
{
|
|||
|
OperationStatus operationStatus = this.sheet.operationStatus;
|
|||
|
OperationStatus operationStatus2 = operationStatus;
|
|||
|
if (operationStatus2 == OperationStatus.Default)
|
|||
|
{
|
|||
|
bool flag = this.sheet.selectionMode > WorksheetSelectionMode.None;
|
|||
|
if (flag)
|
|||
|
{
|
|||
|
this.sheet.SelectRange(RangePosition.EntireRange);
|
|||
|
bool flag2 = buttons == MouseButtons.Right;
|
|||
|
if (flag2)
|
|||
|
{
|
|||
|
this.sheet.controlAdapter.ShowContextMenuStrip(ViewTypes.LeadHeader, location);
|
|||
|
}
|
|||
|
return true;
|
|||
|
}
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
public override bool OnMouseMove(Point location, MouseButtons buttons)
|
|||
|
{
|
|||
|
this.sheet.controlAdapter.ChangeCursor(CursorStyle.Selection);
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
protected Worksheet sheet;
|
|||
|
}
|
|||
|
}
|