DotNet 4.8.1 build of DotNetBar
This commit is contained in:
328
PROMS/DotNetBar Source Code/AdvTree/Display/CellDisplay.cs
Normal file
328
PROMS/DotNetBar Source Code/AdvTree/Display/CellDisplay.cs
Normal file
@@ -0,0 +1,328 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using DevComponents.DotNetBar;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents cell display class.
|
||||
/// </summary>
|
||||
internal class CellDisplay
|
||||
{
|
||||
public CellDisplay()
|
||||
{
|
||||
}
|
||||
|
||||
private static Office2007CheckBoxItemPainter _CheckBoxPainter;
|
||||
public static Office2007CheckBoxItemPainter CheckBoxPainter
|
||||
{
|
||||
get { return _CheckBoxPainter; }
|
||||
set { _CheckBoxPainter = value; }
|
||||
}
|
||||
|
||||
public static Office2007CheckBoxColorTable ColorTable = null;
|
||||
|
||||
public static void PaintCell(NodeCellRendererEventArgs ci)
|
||||
{
|
||||
if(ci.Cell.CheckBoxVisible)
|
||||
CellDisplay.PaintCellCheckBox(ci);
|
||||
if(!ci.Cell.Images.LargestImageSize.IsEmpty)
|
||||
CellDisplay.PaintCellImage(ci);
|
||||
CellDisplay.PaintText(ci);
|
||||
}
|
||||
|
||||
public static void PaintCellCheckBox(NodeCellRendererEventArgs ci)
|
||||
{
|
||||
if(!ci.Cell.CheckBoxVisible)
|
||||
return;
|
||||
Cell cell = ci.Cell;
|
||||
Rectangle r = cell.CheckBoxBoundsRelative;
|
||||
r.Offset(ci.CellOffset);
|
||||
|
||||
if (ci.CheckBoxImageChecked != null)
|
||||
{
|
||||
Image img = ci.CheckBoxImageChecked;
|
||||
if (cell.CheckState == System.Windows.Forms.CheckState.Unchecked)
|
||||
img = ci.CheckBoxImageUnChecked;
|
||||
else if (cell.CheckState == System.Windows.Forms.CheckState.Indeterminate)
|
||||
img = ci.CheckBoxImageIndeterminate;
|
||||
if (img != null)
|
||||
ci.Graphics.DrawImage(img, r);
|
||||
}
|
||||
else if (_CheckBoxPainter != null)
|
||||
{
|
||||
Office2007CheckBoxStateColorTable ct = GetCheckBoxStateColorTable(ci);
|
||||
if (cell.CheckBoxStyle == eCheckBoxStyle.CheckBox)
|
||||
{
|
||||
_CheckBoxPainter.PaintCheckBox(ci.Graphics, r, ct, cell.CheckState);
|
||||
}
|
||||
else
|
||||
{
|
||||
_CheckBoxPainter.PaintRadioButton(ci.Graphics, r, ct, cell.Checked);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.Forms.ButtonState state = System.Windows.Forms.ButtonState.Normal;
|
||||
if (ci.Cell.Checked)
|
||||
state = System.Windows.Forms.ButtonState.Checked;
|
||||
System.Windows.Forms.ControlPaint.DrawCheckBox(ci.Graphics, r, state);
|
||||
}
|
||||
}
|
||||
|
||||
private static Office2007CheckBoxStateColorTable GetCheckBoxStateColorTable(NodeCellRendererEventArgs e)
|
||||
{
|
||||
Cell cell = e.Cell;
|
||||
|
||||
if (ColorTable != null && BarFunctions.IsOffice2007Style(e.ColorScheme.Style))
|
||||
{
|
||||
Office2007CheckBoxColorTable ct = ColorTable;
|
||||
if (!cell.GetEnabled())
|
||||
return ct.Disabled;
|
||||
//else if (cell.IsMouseDown)
|
||||
// return ct.Pressed;
|
||||
//else if (cell.IsMouseOver)
|
||||
// return ct.MouseOver;
|
||||
return ct.Default;
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorScheme cs = e.ColorScheme;
|
||||
// Create color table based on the ColorScheme object...
|
||||
Office2007CheckBoxStateColorTable ct = new Office2007CheckBoxStateColorTable();
|
||||
if (!cell.GetEnabled())
|
||||
{
|
||||
ct.CheckBackground = new LinearGradientColorTable(cs.MenuBackground, Color.Empty);
|
||||
ct.CheckBorder = cs.ItemDisabledText;
|
||||
ct.CheckInnerBorder = cs.ItemDisabledText;
|
||||
ct.CheckInnerBackground = new LinearGradientColorTable();
|
||||
ct.CheckSign = new LinearGradientColorTable(cs.ItemDisabledText, Color.Empty);
|
||||
ct.Text = cs.ItemDisabledText;
|
||||
}
|
||||
//else if (cell.IsMouseDown)
|
||||
//{
|
||||
// ct.CheckBackground = new LinearGradientColorTable(cs.MenuBackground, Color.Empty);
|
||||
// ct.CheckBorder = cs.ItemPressedBorder;
|
||||
// ct.CheckInnerBorder = cs.ItemPressedBorder;
|
||||
// ct.CheckInnerBackground = new LinearGradientColorTable(cs.ItemPressedBackground, cs.ItemPressedBackground2);
|
||||
// ct.CheckSign = new LinearGradientColorTable(cs.ItemPressedText, Color.Empty);
|
||||
// ct.Text = cs.ItemPressedText;
|
||||
//}
|
||||
//else if (cell.IsMouseOver)
|
||||
//{
|
||||
// ct.CheckBackground = new LinearGradientColorTable(cs.MenuBackground, Color.Empty);
|
||||
// ct.CheckBorder = cs.ItemHotBorder;
|
||||
// ct.CheckInnerBorder = cs.ItemHotBorder;
|
||||
// ct.CheckInnerBackground = new LinearGradientColorTable(cs.ItemHotBackground, cs.ItemHotBackground2);
|
||||
// ct.CheckSign = new LinearGradientColorTable(cs.ItemHotText, Color.Empty);
|
||||
// ct.Text = cs.ItemHotText;
|
||||
//}
|
||||
else
|
||||
{
|
||||
ct.CheckBackground = new LinearGradientColorTable(cs.MenuBackground, Color.Empty);
|
||||
ct.CheckBorder = cs.PanelBorder;
|
||||
ct.CheckInnerBorder = ColorBlendFactory.SoftLight(cs.PanelBorder, Color.White);
|
||||
ct.CheckInnerBackground = new LinearGradientColorTable(cs.MenuBackground, Color.Empty);
|
||||
ct.CheckSign = new LinearGradientColorTable(cs.ItemText, Color.Empty);
|
||||
ct.Text = cs.ItemText;
|
||||
}
|
||||
return ct;
|
||||
}
|
||||
}
|
||||
|
||||
public static void PaintCellImage(NodeCellRendererEventArgs ci)
|
||||
{
|
||||
if(ci.Cell.Images.LargestImageSize.IsEmpty)
|
||||
return;
|
||||
Rectangle r=ci.Cell.ImageBoundsRelative;
|
||||
r.Offset(ci.CellOffset);
|
||||
|
||||
Image image = CellDisplay.GetCellImage(ci.Cell);
|
||||
|
||||
if(image!=null)
|
||||
{
|
||||
Size imageSize = Dpi.ImageSize(image.Size);
|
||||
ci.Graphics.DrawImage(image, r.X + (r.Width - imageSize.Width) / 2,
|
||||
r.Y + (r.Height - imageSize.Height) / 2, imageSize.Width, imageSize.Height);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PaintText(NodeCellRendererEventArgs ci)
|
||||
{
|
||||
Cell cell = ci.Cell;
|
||||
if (cell.HostedControl == null && cell.HostedItem == null && (cell.DisplayText == "" || ci.Style.TextColor.IsEmpty) || cell.TextContentBounds.IsEmpty)
|
||||
return;
|
||||
|
||||
Rectangle bounds = ci.Cell.TextContentBounds;
|
||||
bounds.Offset(ci.CellOffset);
|
||||
|
||||
Graphics g = ci.Graphics;
|
||||
if (cell.HostedControl != null)
|
||||
{
|
||||
if (!cell.HostedControl.Visible)
|
||||
cell.HostedControl.Visible = true;
|
||||
return;
|
||||
}
|
||||
else if (cell.HostedItem != null)
|
||||
{
|
||||
BaseItem item = cell.HostedItem;
|
||||
if (item.ItemAlignment == eItemAlignment.Near)
|
||||
item.LeftInternal = bounds.X;
|
||||
else if (item.ItemAlignment == eItemAlignment.Far)
|
||||
item.LeftInternal = bounds.X + (bounds.Width - item.WidthInternal);
|
||||
else if (item.ItemAlignment == eItemAlignment.Center)
|
||||
item.LeftInternal = bounds.X + (bounds.Width - item.WidthInternal) / 2;
|
||||
if (item.DisplayRectangle.Height < bounds.Height)
|
||||
item.TopInternal = bounds.Y + (bounds.Height - item.DisplayRectangle.Height) / 2;
|
||||
else
|
||||
item.TopInternal = bounds.Y;
|
||||
item.Displayed = true;
|
||||
Region oldClip = g.Clip;
|
||||
Rectangle cb = bounds;
|
||||
cb.Inflate(2, 1);
|
||||
g.SetClip(cb, CombineMode.Intersect);
|
||||
item.Paint(ci.ItemPaintArgs);
|
||||
if (oldClip != null)
|
||||
{
|
||||
g.Clip = oldClip;
|
||||
oldClip.Dispose();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Font font = ci.Style.Font;
|
||||
if (bounds.Width > 1 && bounds.Height > 1)
|
||||
{
|
||||
//eTextFormat textFormat = ci.Style.TextFormat;
|
||||
//textFormat = textFormat & ~(textFormat & eTextFormat.HidePrefix);
|
||||
//textFormat |= eTextFormat.NoPrefix;
|
||||
if (cell.TextMarkupBody == null)
|
||||
{
|
||||
TextDrawing.DrawString(g, cell.DisplayText, font, ci.Style.TextColor, bounds, ci.Style.TextFormat);
|
||||
}
|
||||
else
|
||||
{
|
||||
DevComponents.DotNetBar.TextMarkup.MarkupDrawContext d = new DevComponents.DotNetBar.TextMarkup.MarkupDrawContext(g, font, ci.Style.TextColor, false);
|
||||
d.HotKeyPrefixVisible = !((ci.Style.TextFormat & eTextFormat.HidePrefix) == eTextFormat.HidePrefix);
|
||||
Rectangle mr = Rectangle.Empty;
|
||||
eStyleTextAlignment lineAlignment = ci.Style.TextLineAlignment;
|
||||
if (lineAlignment == eStyleTextAlignment.Center)
|
||||
{
|
||||
mr = new Rectangle(bounds.X, bounds.Y + (bounds.Height - cell.TextMarkupBody.Bounds.Height) / 2, cell.TextMarkupBody.Bounds.Width, cell.TextMarkupBody.Bounds.Height);
|
||||
}
|
||||
else if (lineAlignment == eStyleTextAlignment.Near)
|
||||
{
|
||||
mr = new Rectangle(bounds.X, bounds.Y, cell.TextMarkupBody.Bounds.Width, cell.TextMarkupBody.Bounds.Height);
|
||||
}
|
||||
else // Far
|
||||
{
|
||||
mr = new Rectangle(bounds.X, bounds.Y + (bounds.Height - cell.TextMarkupBody.Bounds.Height), cell.TextMarkupBody.Bounds.Width, cell.TextMarkupBody.Bounds.Height);
|
||||
}
|
||||
|
||||
cell.TextMarkupBody.Bounds = mr;
|
||||
cell.TextMarkupBody.Render(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Image GetCellImage(Cell cell)
|
||||
{
|
||||
Image img=cell.Images.Image;
|
||||
|
||||
bool enabled = cell.GetEnabled();
|
||||
|
||||
if (!enabled && (cell.Images.ImageDisabled != null || cell.Images.ImageDisabledIndex >= 0 || cell.Images.DisabledImageGenerated != null))
|
||||
{
|
||||
if (cell.Images.DisabledImageGenerated != null) return cell.Images.DisabledImageGenerated;
|
||||
if (cell.Images.ImageDisabled != null) return cell.Images.ImageDisabled;
|
||||
if (cell.Images.ImageDisabledIndex >= 0) return cell.Images.GetImageByIndex(cell.Images.ImageDisabledIndex);
|
||||
}
|
||||
|
||||
if(img == null && !string.IsNullOrEmpty(cell.Images.ImageKey))
|
||||
img = cell.Images.GetImageByKey(cell.Images.ImageKey);
|
||||
if (img == null && cell.Images.ImageIndex >= 0)
|
||||
img = cell.Images.GetImageByIndex(cell.Images.ImageIndex);
|
||||
|
||||
if (!enabled && img is Bitmap)
|
||||
{
|
||||
cell.Images.DisposeGeneratedDisabledImage();
|
||||
cell.Images.DisabledImageGenerated = ImageHelper.CreateGrayScaleImage(img as Bitmap);
|
||||
if (cell.Images.DisabledImageGenerated != null) return cell.Images.DisabledImageGenerated;
|
||||
return img;
|
||||
}
|
||||
|
||||
if(cell.IsMouseOver && (cell.Images.ImageMouseOver!=null || cell.Images.ImageMouseOverIndex>= 0 || !string.IsNullOrEmpty(cell.Images.ImageMouseOverKey)))
|
||||
{
|
||||
if (cell.Images.ImageMouseOver != null)
|
||||
img = cell.Images.ImageMouseOver;
|
||||
else if (cell.Images.ImageMouseOverIndex >= 0)
|
||||
img = cell.Images.GetImageByIndex(cell.Images.ImageMouseOverIndex);
|
||||
else
|
||||
img = cell.Images.GetImageByKey(cell.Images.ImageMouseOverKey);
|
||||
}
|
||||
else if(cell.Parent.Expanded && (cell.Images.ImageExpanded!=null || cell.Images.ImageExpandedIndex>= 0 || !string.IsNullOrEmpty(cell.Images.ImageExpandedKey)))
|
||||
{
|
||||
if (cell.Images.ImageExpanded != null)
|
||||
img = cell.Images.ImageExpanded;
|
||||
else if (cell.Images.ImageExpandedIndex >= 0)
|
||||
img = cell.Images.GetImageByIndex(cell.Images.ImageExpandedIndex);
|
||||
else
|
||||
img = cell.Images.GetImageByKey(cell.Images.ImageExpandedKey);
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
public static Font GetCellFont(AdvTree tree, Cell cell)
|
||||
{
|
||||
Font font=tree.Font;
|
||||
ElementStyle style=null;
|
||||
|
||||
if(cell.StyleNormal!=null)
|
||||
{
|
||||
style=cell.StyleNormal;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(tree.NodeStyle!=null)
|
||||
style=tree.NodeStyle;
|
||||
else
|
||||
style=new ElementStyle();
|
||||
|
||||
if(tree.CellStyleDefault!=null)
|
||||
style=tree.CellStyleDefault;
|
||||
else
|
||||
style=ElementStyle.GetDefaultCellStyle(style);
|
||||
}
|
||||
|
||||
if(style!=null && style.Font!=null)
|
||||
font=style.Font;
|
||||
|
||||
return font;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents information necessary to paint the cell on canvas.
|
||||
/// </summary>
|
||||
internal class CellDisplayInfo
|
||||
{
|
||||
public ElementStyle Style=null;
|
||||
public System.Drawing.Graphics Graphics=null;
|
||||
public Cell ContextCell=null;
|
||||
public Point CellOffset=Point.Empty;
|
||||
|
||||
public CellDisplayInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public CellDisplayInfo(ElementStyle style, System.Drawing.Graphics g, Cell cell, Point cellOffset)
|
||||
{
|
||||
this.Style=style;
|
||||
this.Graphics=g;
|
||||
this.ContextCell=cell;
|
||||
this.CellOffset=cellOffset;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,384 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using DevComponents.WinForms.Drawing;
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the tree color tables.
|
||||
/// </summary>
|
||||
internal class ColorTableInitializer
|
||||
{
|
||||
#region Office 2007 Blue
|
||||
public static void InitOffice2007Blue(TreeColorTable ct, ColorFactory factory)
|
||||
{
|
||||
#region Tree Selection
|
||||
TreeSelectionColors treeSelection = new TreeSelectionColors();
|
||||
ct.Selection = treeSelection;
|
||||
// Highlight full row
|
||||
SelectionColorTable selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(0xA7CDF0));
|
||||
treeSelection.FullRowSelect = selColorTable;
|
||||
// Highlight full row Inactive
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(0xE5E5E5));
|
||||
treeSelection.FullRowSelectInactive = selColorTable;
|
||||
|
||||
// Node Marker
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(64, 0x316AC5));
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(96, 0x316AC5), 1);
|
||||
treeSelection.NodeMarker = selColorTable;
|
||||
// Node marker inactibe
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(64, 0xE5E5E5));
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(96, 0x000000), 1);
|
||||
treeSelection.NodeMarkerInactive = selColorTable;
|
||||
|
||||
// Cell selection
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(new ColorStop[] {
|
||||
new ColorStop(factory.GetColor(0xFFFCD9), 0f),
|
||||
new ColorStop(factory.GetColor(0xFFE78D), .4f),
|
||||
new ColorStop(factory.GetColor(0xFFD748), .4f),
|
||||
new ColorStop(factory.GetColor(0xFFE793), 1f)
|
||||
});
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0xDDCF9B), 1);
|
||||
selColorTable.BorderCornerRadius = 2;
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(192, 0xFFF2BE), 1);
|
||||
//selColorTable = new SelectionColorTable();
|
||||
//selColorTable.Fill = new GradientFill(factory.GetColor(0xF6FBFD), factory.GetColor(0xD5EFFC), 90);
|
||||
//selColorTable.Border = new SolidBorder(factory.GetColor(0x99DEFD), 1);
|
||||
//selColorTable.InnerBorder = new SolidBorder(factory.GetColor(192, 0xFFFFFF), 1);
|
||||
treeSelection.HighlightCells = selColorTable;
|
||||
// Cell selection inactive
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(factory.GetColor(0xFAFAFB), factory.GetColor(0xE5E5E5), 90);
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0xD9D9D9), 1);
|
||||
selColorTable.BorderCornerRadius = 2;
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(228, 0xFFFFFF), 1);
|
||||
treeSelection.HighlightCellsInactive = selColorTable;
|
||||
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(factory.GetColor(0xFAFAFB), factory.GetColor(0xE5E5E5), 90);
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0xD9D9D9), 1);
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(228, 0xFFFFFF), 1);
|
||||
treeSelection.NodeHotTracking = selColorTable;
|
||||
#endregion
|
||||
|
||||
#region Expand Buttons
|
||||
TreeExpandColorTable expand = new TreeExpandColorTable();
|
||||
expand.CollapseBorder = new SolidBorder(factory.GetColor(0x000000), 1);
|
||||
expand.CollapseFill = new SolidFill(factory.GetColor(0x595959));
|
||||
expand.CollapseMouseOverBorder = new SolidBorder(factory.GetColor(0x1CC4F7), 1);
|
||||
expand.CollapseMouseOverFill = new SolidFill(factory.GetColor(0x82DFFB));
|
||||
expand.ExpandBorder = new SolidBorder(factory.GetColor(0x848484), 1);
|
||||
expand.ExpandFill = new SolidFill(factory.GetColor(0xFFFFFF));
|
||||
expand.ExpandMouseOverBorder = new SolidBorder(factory.GetColor(0x1CC4F7), 1);
|
||||
expand.ExpandMouseOverFill = new SolidFill(factory.GetColor(0xCCEDFA));
|
||||
ct.ExpandTriangle = expand;
|
||||
// Rectangle
|
||||
expand = new TreeExpandColorTable();
|
||||
expand.CollapseForeground = new SolidFill(factory.GetColor(0x000000));
|
||||
expand.CollapseBorder = new SolidBorder(factory.GetColor(0x969696), 1);
|
||||
expand.CollapseFill = new GradientFill(new ColorStop[]{
|
||||
new ColorStop(factory.GetColor(0xFFFFFF), 0f), new ColorStop(factory.GetColor(0xFFFFFF), .40f), new ColorStop(factory.GetColor(0xB6B6B6), 1f)}, 45);
|
||||
expand.CollapseMouseOverForeground = expand.CollapseForeground;
|
||||
expand.CollapseMouseOverBorder = expand.CollapseBorder;
|
||||
expand.CollapseMouseOverFill = expand.CollapseFill;
|
||||
expand.ExpandForeground = expand.CollapseForeground;
|
||||
expand.ExpandBorder = expand.CollapseBorder;
|
||||
expand.ExpandFill = expand.CollapseFill;
|
||||
expand.ExpandMouseOverForeground = expand.CollapseForeground;
|
||||
expand.ExpandMouseOverBorder = expand.CollapseBorder;
|
||||
expand.ExpandMouseOverFill = expand.CollapseFill;
|
||||
ct.ExpandRectangle = expand;
|
||||
ct.ExpandEllipse = expand;
|
||||
#endregion
|
||||
|
||||
#region Misc Tree Color
|
||||
ct.GridLines = factory.GetColor(0xE1E1E1);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Office 2007 Silver
|
||||
public static void InitOffice2007Silver(TreeColorTable ct, ColorFactory factory)
|
||||
{
|
||||
#region Tree Selection
|
||||
TreeSelectionColors treeSelection = new TreeSelectionColors();
|
||||
ct.Selection = treeSelection;
|
||||
// Highlight full row
|
||||
SelectionColorTable selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(0xA7CDF0));
|
||||
treeSelection.FullRowSelect = selColorTable;
|
||||
// Highlight full row Inactive
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(0xE5E5E5));
|
||||
treeSelection.FullRowSelectInactive = selColorTable;
|
||||
|
||||
// Node Marker
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(64, 0x316AC5));
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(96, 0x316AC5), 1);
|
||||
treeSelection.NodeMarker = selColorTable;
|
||||
// Node marker inactibe
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(64, 0xE5E5E5));
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(96, 0x000000), 1);
|
||||
treeSelection.NodeMarkerInactive = selColorTable;
|
||||
|
||||
// Cell selection
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(new ColorStop[] {
|
||||
new ColorStop(factory.GetColor(0xFFFCD9), 0f),
|
||||
new ColorStop(factory.GetColor(0xFFE78D), .4f),
|
||||
new ColorStop(factory.GetColor(0xFFD748), .4f),
|
||||
new ColorStop(factory.GetColor(0xFFE793), 1f)
|
||||
});
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0xDDCF9B), 1);
|
||||
selColorTable.BorderCornerRadius = 2;
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(192, 0xFFF2BE), 1);
|
||||
//selColorTable = new SelectionColorTable();
|
||||
//selColorTable.Fill = new GradientFill(factory.GetColor(0xF6FBFD), factory.GetColor(0xD5EFFC), 90);
|
||||
//selColorTable.Border = new SolidBorder(factory.GetColor(0x99DEFD), 1);
|
||||
//selColorTable.InnerBorder = new SolidBorder(factory.GetColor(192, 0xFFFFFF), 1);
|
||||
treeSelection.HighlightCells = selColorTable;
|
||||
// Cell selection inactive
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(factory.GetColor(0xFAFAFB), factory.GetColor(0xE5E5E5), 90);
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0xD9D9D9), 1);
|
||||
selColorTable.BorderCornerRadius = 2;
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(228, 0xFFFFFF), 1);
|
||||
treeSelection.HighlightCellsInactive = selColorTable;
|
||||
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(factory.GetColor(0xFAFAFB), factory.GetColor(0xE5E5E5), 90);
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0xD9D9D9), 1);
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(228, 0xFFFFFF), 1);
|
||||
treeSelection.NodeHotTracking = selColorTable;
|
||||
#endregion
|
||||
|
||||
#region Expand Buttons
|
||||
TreeExpandColorTable expand = new TreeExpandColorTable();
|
||||
expand.CollapseBorder = new SolidBorder(factory.GetColor(0x000000), 1);
|
||||
expand.CollapseFill = new SolidFill(factory.GetColor(0x595959));
|
||||
expand.CollapseMouseOverBorder = new SolidBorder(factory.GetColor(0x1CC4F7), 1);
|
||||
expand.CollapseMouseOverFill = new SolidFill(factory.GetColor(0x82DFFB));
|
||||
expand.ExpandBorder = new SolidBorder(factory.GetColor(0x848484), 1);
|
||||
expand.ExpandFill = new SolidFill(factory.GetColor(0xFFFFFF));
|
||||
expand.ExpandMouseOverBorder = new SolidBorder(factory.GetColor(0x1CC4F7), 1);
|
||||
expand.ExpandMouseOverFill = new SolidFill(factory.GetColor(0xCCEDFA));
|
||||
ct.ExpandTriangle = expand;
|
||||
// Rectangle
|
||||
expand = new TreeExpandColorTable();
|
||||
expand.CollapseForeground = new SolidFill(factory.GetColor(0x000000));
|
||||
expand.CollapseBorder = new SolidBorder(factory.GetColor(0x969696), 1);
|
||||
expand.CollapseFill = new GradientFill(new ColorStop[]{
|
||||
new ColorStop(factory.GetColor(0xFFFFFF), 0f), new ColorStop(factory.GetColor(0xFFFFFF), .40f), new ColorStop(factory.GetColor(0xB6B6B6), 1f)}, 45);
|
||||
expand.CollapseMouseOverForeground = expand.CollapseForeground;
|
||||
expand.CollapseMouseOverBorder = expand.CollapseBorder;
|
||||
expand.CollapseMouseOverFill = expand.CollapseFill;
|
||||
expand.ExpandForeground = expand.CollapseForeground;
|
||||
expand.ExpandBorder = expand.CollapseBorder;
|
||||
expand.ExpandFill = expand.CollapseFill;
|
||||
expand.ExpandMouseOverForeground = expand.CollapseForeground;
|
||||
expand.ExpandMouseOverBorder = expand.CollapseBorder;
|
||||
expand.ExpandMouseOverFill = expand.CollapseFill;
|
||||
ct.ExpandRectangle = expand;
|
||||
ct.ExpandEllipse = expand;
|
||||
#endregion
|
||||
|
||||
#region Misc Tree Color
|
||||
ct.GridLines = factory.GetColor(0xE1E1E1);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Office 2007 Black
|
||||
public static void InitOffice2007Black(TreeColorTable ct, ColorFactory factory)
|
||||
{
|
||||
#region Tree Selection
|
||||
TreeSelectionColors treeSelection = new TreeSelectionColors();
|
||||
ct.Selection = treeSelection;
|
||||
// Highlight full row
|
||||
SelectionColorTable selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(0xA7CDF0));
|
||||
treeSelection.FullRowSelect = selColorTable;
|
||||
// Highlight full row Inactive
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(0xE5E5E5));
|
||||
treeSelection.FullRowSelectInactive = selColorTable;
|
||||
|
||||
// Node Marker
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(64, 0x316AC5));
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(96, 0x316AC5), 1);
|
||||
treeSelection.NodeMarker = selColorTable;
|
||||
// Node marker inactibe
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(64, 0xE5E5E5));
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(96, 0x000000), 1);
|
||||
treeSelection.NodeMarkerInactive = selColorTable;
|
||||
|
||||
// Cell selection
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(new ColorStop[] {
|
||||
new ColorStop(factory.GetColor(0xFFFCD9), 0f),
|
||||
new ColorStop(factory.GetColor(0xFFE78D), .4f),
|
||||
new ColorStop(factory.GetColor(0xFFD748), .4f),
|
||||
new ColorStop(factory.GetColor(0xFFE793), 1f)
|
||||
});
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0xDDCF9B), 1);
|
||||
selColorTable.BorderCornerRadius = 2;
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(192, 0xFFF2BE), 1);
|
||||
//selColorTable = new SelectionColorTable();
|
||||
//selColorTable.Fill = new GradientFill(factory.GetColor(0xF6FBFD), factory.GetColor(0xD5EFFC), 90);
|
||||
//selColorTable.Border = new SolidBorder(factory.GetColor(0x99DEFD), 1);
|
||||
//selColorTable.InnerBorder = new SolidBorder(factory.GetColor(192, 0xFFFFFF), 1);
|
||||
treeSelection.HighlightCells = selColorTable;
|
||||
// Cell selection inactive
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(factory.GetColor(0xFAFAFB), factory.GetColor(0xE5E5E5), 90);
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0xD9D9D9), 1);
|
||||
selColorTable.BorderCornerRadius = 2;
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(228, 0xFFFFFF), 1);
|
||||
treeSelection.HighlightCellsInactive = selColorTable;
|
||||
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(factory.GetColor(0xFAFAFB), factory.GetColor(0xE5E5E5), 90);
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0xD9D9D9), 1);
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(228, 0xFFFFFF), 1);
|
||||
treeSelection.NodeHotTracking = selColorTable;
|
||||
#endregion
|
||||
|
||||
#region Expand Buttons
|
||||
TreeExpandColorTable expand = new TreeExpandColorTable();
|
||||
expand.CollapseBorder = new SolidBorder(factory.GetColor(0x000000), 1);
|
||||
expand.CollapseFill = new SolidFill(factory.GetColor(0x595959));
|
||||
expand.CollapseMouseOverBorder = new SolidBorder(factory.GetColor(0x1CC4F7), 1);
|
||||
expand.CollapseMouseOverFill = new SolidFill(factory.GetColor(0x82DFFB));
|
||||
expand.ExpandBorder = new SolidBorder(factory.GetColor(0x848484), 1);
|
||||
expand.ExpandFill = new SolidFill(factory.GetColor(0xFFFFFF));
|
||||
expand.ExpandMouseOverBorder = new SolidBorder(factory.GetColor(0x1CC4F7), 1);
|
||||
expand.ExpandMouseOverFill = new SolidFill(factory.GetColor(0xCCEDFA));
|
||||
ct.ExpandTriangle = expand;
|
||||
// Rectangle
|
||||
expand = new TreeExpandColorTable();
|
||||
expand.CollapseForeground = new SolidFill(factory.GetColor(0x000000));
|
||||
expand.CollapseBorder = new SolidBorder(factory.GetColor(0x969696), 1);
|
||||
expand.CollapseFill = new GradientFill(new ColorStop[]{
|
||||
new ColorStop(factory.GetColor(0xFFFFFF), 0f), new ColorStop(factory.GetColor(0xFFFFFF), .40f), new ColorStop(factory.GetColor(0xB6B6B6), 1f)}, 45);
|
||||
expand.CollapseMouseOverForeground = expand.CollapseForeground;
|
||||
expand.CollapseMouseOverBorder = expand.CollapseBorder;
|
||||
expand.CollapseMouseOverFill = expand.CollapseFill;
|
||||
expand.ExpandForeground = expand.CollapseForeground;
|
||||
expand.ExpandBorder = expand.CollapseBorder;
|
||||
expand.ExpandFill = expand.CollapseFill;
|
||||
expand.ExpandMouseOverForeground = expand.CollapseForeground;
|
||||
expand.ExpandMouseOverBorder = expand.CollapseBorder;
|
||||
expand.ExpandMouseOverFill = expand.CollapseFill;
|
||||
ct.ExpandRectangle = expand;
|
||||
ct.ExpandEllipse = expand;
|
||||
#endregion
|
||||
|
||||
#region Misc Tree Color
|
||||
ct.GridLines = factory.GetColor(0xE1E1E1);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Office 2007 Vista Glass
|
||||
public static void InitOffice2007VistaGlass(TreeColorTable ct, ColorFactory factory)
|
||||
{
|
||||
#region Tree Selection
|
||||
TreeSelectionColors treeSelection = new TreeSelectionColors();
|
||||
ct.Selection = treeSelection;
|
||||
// Highlight full row
|
||||
SelectionColorTable selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(0xC4E8FA));
|
||||
treeSelection.FullRowSelect = selColorTable;
|
||||
// Highlight full row Inactive
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(0xE5E5E5));
|
||||
treeSelection.FullRowSelectInactive = selColorTable;
|
||||
|
||||
// Node Marker
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(64, 0x316AC5));
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(96, 0x316AC5), 1);
|
||||
treeSelection.NodeMarker = selColorTable;
|
||||
// Node marker inactive
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new SolidFill(factory.GetColor(64, 0xE5E5E5));
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(96, 0x000000), 1);
|
||||
treeSelection.NodeMarkerInactive = selColorTable;
|
||||
|
||||
// Cell selection
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(new ColorStop[] {
|
||||
new ColorStop(factory.GetColor(0xF1F8FD), 0f),
|
||||
new ColorStop(factory.GetColor(0xD5EFFC), 1f)
|
||||
});
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0x99DEFD), 1);
|
||||
selColorTable.BorderCornerRadius = 2;
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(192, 0xF6FBFD), 1);
|
||||
//selColorTable = new SelectionColorTable();
|
||||
//selColorTable.Fill = new GradientFill(factory.GetColor(0xF6FBFD), factory.GetColor(0xD5EFFC), 90);
|
||||
//selColorTable.Border = new SolidBorder(factory.GetColor(0x99DEFD), 1);
|
||||
//selColorTable.InnerBorder = new SolidBorder(factory.GetColor(192, 0xFFFFFF), 1);
|
||||
treeSelection.HighlightCells = selColorTable;
|
||||
// Cell selection inactive
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(factory.GetColor(0xF8F8F8), factory.GetColor(0xE5E5E5), 90);
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0xD9D9D9), 1);
|
||||
selColorTable.BorderCornerRadius = 2;
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(228, 0xFAFAFB), 1);
|
||||
treeSelection.HighlightCellsInactive = selColorTable;
|
||||
|
||||
selColorTable = new SelectionColorTable();
|
||||
selColorTable.Fill = new GradientFill(factory.GetColor(0xF5FAFD), factory.GetColor(0xE8F5FD), 90);
|
||||
selColorTable.Border = new SolidBorder(factory.GetColor(0xD8F0FA), 1);
|
||||
selColorTable.InnerBorder = new SolidBorder(factory.GetColor(228, 0xF8FCFE), 1);
|
||||
treeSelection.NodeHotTracking = selColorTable;
|
||||
#endregion
|
||||
|
||||
#region Expand Buttons
|
||||
TreeExpandColorTable expand = new TreeExpandColorTable();
|
||||
expand.CollapseBorder = new SolidBorder(factory.GetColor(0x000000), 1);
|
||||
expand.CollapseFill = new SolidFill(factory.GetColor(0x595959));
|
||||
expand.CollapseMouseOverBorder = new SolidBorder(factory.GetColor(0x1CC4F7), 1);
|
||||
expand.CollapseMouseOverFill = new SolidFill(factory.GetColor(0x82DFFB));
|
||||
expand.ExpandBorder = new SolidBorder(factory.GetColor(0x848484), 1);
|
||||
expand.ExpandFill = new SolidFill(factory.GetColor(0xFFFFFF));
|
||||
expand.ExpandMouseOverBorder = new SolidBorder(factory.GetColor(0x1CC4F7), 1);
|
||||
expand.ExpandMouseOverFill = new SolidFill(factory.GetColor(0xCCEDFA));
|
||||
ct.ExpandTriangle = expand;
|
||||
// Rectangle
|
||||
expand = new TreeExpandColorTable();
|
||||
expand.CollapseForeground = new SolidFill(factory.GetColor(0x000000));
|
||||
expand.CollapseBorder = new SolidBorder(factory.GetColor(0x969696), 1);
|
||||
expand.CollapseFill = new GradientFill(new ColorStop[]{
|
||||
new ColorStop(factory.GetColor(0xFFFFFF), 0f), new ColorStop(factory.GetColor(0xFFFFFF), .40f), new ColorStop(factory.GetColor(0xB6B6B6), 1f)}, 45);
|
||||
expand.CollapseMouseOverForeground = expand.CollapseForeground;
|
||||
expand.CollapseMouseOverBorder = expand.CollapseBorder;
|
||||
expand.CollapseMouseOverFill = expand.CollapseFill;
|
||||
expand.ExpandForeground = expand.CollapseForeground;
|
||||
expand.ExpandBorder = expand.CollapseBorder;
|
||||
expand.ExpandFill = expand.CollapseFill;
|
||||
expand.ExpandMouseOverForeground = expand.CollapseForeground;
|
||||
expand.ExpandMouseOverBorder = expand.CollapseBorder;
|
||||
expand.ExpandMouseOverFill = expand.CollapseFill;
|
||||
ct.ExpandRectangle = expand;
|
||||
ct.ExpandEllipse = expand;
|
||||
#endregion
|
||||
|
||||
#region Misc Tree Color
|
||||
ct.GridLines = factory.GetColor(0xEDEDED);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using DevComponents.DotNetBar;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
internal class ColumnHeaderDisplay
|
||||
{
|
||||
internal void DrawColumnHeader(ColumnHeaderRendererEventArgs e, ElementStyleDisplayInfo di)
|
||||
{
|
||||
// Adjust the header bounds so the header is filled completely
|
||||
if (e.Tree != null && e.Tree.CellHorizontalSpacing > 0 && !e.ColumnHeader.IsFirstVisible) {
|
||||
Rectangle ob = di.Bounds;
|
||||
di.Bounds = new Rectangle(ob.X - e.Tree.CellHorizontalSpacing, ob.Y, ob.Width + e.Tree.CellHorizontalSpacing, ob.Height);
|
||||
ElementStyleDisplay.Paint(di);
|
||||
di.Bounds = ob;
|
||||
}
|
||||
else
|
||||
ElementStyleDisplay.Paint(di);
|
||||
di.Bounds.Inflate(-1, -1);
|
||||
if (di.Bounds.Width > 1 && di.Bounds.Height > 1)
|
||||
{
|
||||
if (e.ColumnHeader.IsFirstVisible)
|
||||
{
|
||||
Rectangle r = di.Bounds;
|
||||
r.Width -= 3;
|
||||
r.X += 3;
|
||||
di.Bounds = r;
|
||||
}
|
||||
|
||||
if (e.ColumnHeader.SortDirection != eSortDirection.None && !e.SortIndicatorColor.IsEmpty)
|
||||
{
|
||||
using (GraphicsPath sortShapePath = UIGraphics.GetTrianglePath(
|
||||
new Point(di.Bounds.Right - 11, di.Bounds.Y + (di.Bounds.Height - 5) / 2), 9,
|
||||
(e.ColumnHeader.SortDirection == eSortDirection.Ascending ? eTriangleDirection.Top : eTriangleDirection.Bottom)))
|
||||
{
|
||||
SmoothingMode sm = e.Graphics.SmoothingMode;
|
||||
e.Graphics.SmoothingMode = SmoothingMode.Default;
|
||||
using (SolidBrush brush = new SolidBrush(e.SortIndicatorColor))
|
||||
e.Graphics.FillPath(brush, sortShapePath);
|
||||
e.Graphics.SmoothingMode = sm;
|
||||
}
|
||||
di.Bounds.Width -= 12;
|
||||
}
|
||||
|
||||
if (e.ColumnHeader.Image != null)
|
||||
{
|
||||
Image image = e.ColumnHeader.Image;
|
||||
Rectangle r = di.Bounds;
|
||||
if (e.ColumnHeader.ImageAlignment == eColumnImageAlignment.Left)
|
||||
{
|
||||
e.Graphics.DrawImage(image, r.X,
|
||||
r.Y + (r.Height - image.Height) / 2, image.Width, image.Height);
|
||||
r.X += image.Width + 2;
|
||||
r.Width -= image.Width + 2;
|
||||
|
||||
}
|
||||
else if (e.ColumnHeader.ImageAlignment == eColumnImageAlignment.Right)
|
||||
{
|
||||
e.Graphics.DrawImage(image, r.Right - image.Width,
|
||||
r.Y + (r.Height - image.Height) / 2, image.Width, image.Height);
|
||||
r.Width -= image.Width + 2;
|
||||
}
|
||||
di.Bounds = r;
|
||||
}
|
||||
|
||||
ElementStyleDisplay.PaintText(di, e.ColumnHeader.Text, e.Tree.Font);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void PaintColumnMoveMarker(Graphics g, AdvTree tree, int columnMoveMarkerIndex, ColumnHeaderCollection columns)
|
||||
{
|
||||
if (columnMoveMarkerIndex == -1) throw new ArgumentException("columnMoveMarkerIndex must be grater or equal than 0");
|
||||
if (columns == null) throw new ArgumentNullException("columns");
|
||||
|
||||
Color lineColor = ColorScheme.GetColor("834DD5");
|
||||
Color fillColor = ColorScheme.GetColor("CCCFF8");
|
||||
Size markerSize = new Size(10, 14);
|
||||
|
||||
ColumnHeader header = null;
|
||||
|
||||
if (columnMoveMarkerIndex == columns.Count)
|
||||
header = columns.LastVisibleColumn;
|
||||
else
|
||||
header = columns[columnMoveMarkerIndex];
|
||||
Rectangle markerBounds = Rectangle.Empty;
|
||||
if (columnMoveMarkerIndex == columns.Count)
|
||||
markerBounds = new Rectangle(header.Bounds.Right - markerSize.Width, header.Bounds.Bottom - markerSize.Height, markerSize.Width, markerSize.Height);
|
||||
else if (columns[columnMoveMarkerIndex] == columns.FirstVisibleColumn)
|
||||
markerBounds = new Rectangle(header.Bounds.X, header.Bounds.Bottom - markerSize.Height, markerSize.Width, markerSize.Height);
|
||||
else
|
||||
markerBounds = new Rectangle(header.Bounds.X - markerSize.Width / 2 - tree.NodeLayout.GetCellLayout().LayoutSettings.CellHorizontalSpacing, header.Bounds.Bottom - markerSize.Height, markerSize.Width, markerSize.Height);
|
||||
if (tree.AutoScrollPosition.X != 0)
|
||||
markerBounds.Offset(tree.AutoScrollPosition.X, 0);
|
||||
using (GraphicsPath path = CreateMarker(markerBounds))
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(fillColor))
|
||||
g.FillPath(brush, path);
|
||||
using (Pen pen = new Pen(lineColor, 1))
|
||||
g.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
private static GraphicsPath CreateMarker(Rectangle markerBounds)
|
||||
{
|
||||
markerBounds.Height--;
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLine(markerBounds.X + markerBounds.Width / 2, markerBounds.Bottom, markerBounds.X, markerBounds.Bottom - markerBounds.Width / 2);
|
||||
path.AddLine(markerBounds.X, markerBounds.Bottom - markerBounds.Width / 2, markerBounds.X + markerBounds.Width / 3, markerBounds.Bottom - markerBounds.Width / 2);
|
||||
path.AddLine(markerBounds.X + markerBounds.Width / 3, markerBounds.Bottom - markerBounds.Width / 2, markerBounds.X + markerBounds.Width / 3, markerBounds.Y);
|
||||
path.AddLine(markerBounds.X + markerBounds.Width / 3, markerBounds.Y, markerBounds.Right - markerBounds.Width / 3, markerBounds.Y);
|
||||
path.AddLine(markerBounds.Right - markerBounds.Width / 3, markerBounds.Y, markerBounds.Right - markerBounds.Width / 3, markerBounds.Bottom - markerBounds.Width / 2);
|
||||
path.AddLine(markerBounds.Right - markerBounds.Width / 3, markerBounds.Bottom - markerBounds.Width / 2, markerBounds.Right, markerBounds.Bottom - markerBounds.Width / 2);
|
||||
path.CloseAllFigures();
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides data for RenderColumnHeader event.
|
||||
/// </summary>
|
||||
public class ColumnHeaderRendererEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the column header that is rendered.
|
||||
/// </summary>
|
||||
public ColumnHeader ColumnHeader = null;
|
||||
/// <summary>
|
||||
/// Target Graphics canvas.
|
||||
/// </summary>
|
||||
public Graphics Graphics;
|
||||
/// <summary>
|
||||
/// Gets the bounds of the column header.
|
||||
/// </summary>
|
||||
public Rectangle Bounds;
|
||||
/// <summary>
|
||||
/// Gets the effective style for the column.
|
||||
/// </summary>
|
||||
public ElementStyle Style = null;
|
||||
/// <summary>
|
||||
/// Gets the AdvTree control header is rendered for.
|
||||
/// </summary>
|
||||
public AdvTree Tree = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the column sort indicator.
|
||||
/// </summary>
|
||||
public Color SortIndicatorColor = Color.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ColumnHeaderRendererEventArgs class.
|
||||
/// </summary>
|
||||
public ColumnHeaderRendererEventArgs()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ColumnHeaderRendererEventArgs class.
|
||||
/// </summary>
|
||||
/// <param name="columnHeader"></param>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="bounds"></param>
|
||||
/// <param name="style"></param>
|
||||
public ColumnHeaderRendererEventArgs(AdvTree tree, ColumnHeader columnHeader, Graphics graphics, Rectangle bounds, ElementStyle style)
|
||||
{
|
||||
Tree = tree;
|
||||
ColumnHeader = columnHeader;
|
||||
Graphics = graphics;
|
||||
Bounds = bounds;
|
||||
Style = style;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents helper class for node connector display.
|
||||
/// </summary>
|
||||
public class ConnectorRendererEventArgs:EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// From node reference.
|
||||
/// </summary>
|
||||
public Node FromNode=null;
|
||||
/// <summary>
|
||||
/// From node style reference.
|
||||
/// </summary>
|
||||
public ElementStyle StyleFromNode=null;
|
||||
/// <summary>
|
||||
/// To node reference.
|
||||
/// </summary>
|
||||
public Node ToNode=null;
|
||||
/// <summary>
|
||||
/// To node style reference.
|
||||
/// </summary>
|
||||
public ElementStyle StyleToNode=null;
|
||||
/// <summary>
|
||||
/// Graphics object used for drawing.
|
||||
/// </summary>
|
||||
public System.Drawing.Graphics Graphics=null;
|
||||
/// <summary>
|
||||
/// Node offset since some node coordinates are relative.
|
||||
/// </summary>
|
||||
public Point Offset=Point.Empty;
|
||||
/// <summary>
|
||||
/// Indicates whether from node is a root node.
|
||||
/// </summary>
|
||||
public bool IsRootNode=false;
|
||||
/// <summary>
|
||||
/// Reference to node connector object that describes connector type.
|
||||
/// </summary>
|
||||
public NodeConnector NodeConnector=null;
|
||||
/// <summary>
|
||||
/// Gets or sets whether connector is link connector.
|
||||
/// </summary>
|
||||
public bool LinkConnector=false;
|
||||
/// <summary>
|
||||
/// Reference to the collection of the connector path points. Default value is null indicating there are no path points.
|
||||
/// </summary>
|
||||
public ConnectorPointsCollection ConnectorPoints=null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
internal class DragDropMarkerDisplay
|
||||
{
|
||||
public void DrawMarker(DragDropMarkerRendererEventArgs e)
|
||||
{
|
||||
Graphics g = e.Graphics;
|
||||
Rectangle bounds = e.Bounds;
|
||||
if (bounds.IsEmpty || _MarkerColor.IsEmpty) return;
|
||||
|
||||
if (bounds.Width == AdvTree.DragInsertMarkSize) // Vertical insert mark
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(_MarkerColor))
|
||||
{
|
||||
using (Pen pen = new Pen(brush, 1))
|
||||
{
|
||||
Point p = new Point(bounds.X + 4, bounds.Y);
|
||||
g.DrawLine(pen, p.X, p.Y, p.X, bounds.Bottom - 1);
|
||||
}
|
||||
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddLine(bounds.X, bounds.Y, bounds.X + 8, bounds.Y );
|
||||
path.AddLine(bounds.X + 8, bounds.Y, bounds.X + 4, bounds.Y + 4);
|
||||
path.CloseAllFigures();
|
||||
g.FillPath(brush, path);
|
||||
}
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddLine(bounds.X, bounds.Bottom, bounds.X + 8, bounds.Bottom);
|
||||
path.AddLine(bounds.X + 8, bounds.Bottom, bounds.X + 4, bounds.Bottom - 4);
|
||||
path.CloseAllFigures();
|
||||
g.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Horizontal insert mark
|
||||
using (SolidBrush brush = new SolidBrush(_MarkerColor))
|
||||
{
|
||||
using (Pen pen = new Pen(brush, 1))
|
||||
{
|
||||
Point p = new Point(bounds.X, bounds.Y + 4);
|
||||
g.DrawLine(pen, p.X, p.Y, bounds.Right - 1, p.Y);
|
||||
}
|
||||
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddLine(bounds.X, bounds.Y, bounds.X, bounds.Y + 8);
|
||||
path.AddLine(bounds.X, bounds.Y + 8, bounds.X + 4, bounds.Y + 4);
|
||||
path.CloseAllFigures();
|
||||
g.FillPath(brush, path);
|
||||
}
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddLine(bounds.Right, bounds.Y, bounds.Right, bounds.Y + 8);
|
||||
path.AddLine(bounds.Right, bounds.Y + 8, bounds.Right - 4, bounds.Y + 4);
|
||||
path.CloseAllFigures();
|
||||
g.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Color _MarkerColor;
|
||||
public Color MarkerColor
|
||||
{
|
||||
get { return _MarkerColor; }
|
||||
set { _MarkerColor = value; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides data for the NodeRenderer.RenderDragDropMarker event.
|
||||
/// </summary>
|
||||
public class DragDropMarkerRendererEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets reference to Graphics object, canvas node is rendered on.
|
||||
/// </summary>
|
||||
public System.Drawing.Graphics Graphics = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the selection bounds.
|
||||
/// </summary>
|
||||
public Rectangle Bounds = Rectangle.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DragDropMarkerRendererEventArgs class.
|
||||
/// </summary>
|
||||
public DragDropMarkerRendererEventArgs()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DragDropMarkerRendererEventArgs class.
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="bounds"></param>
|
||||
public DragDropMarkerRendererEventArgs(System.Drawing.Graphics graphics, Rectangle bounds)
|
||||
{
|
||||
Graphics = graphics;
|
||||
Bounds = bounds;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using DevComponents.AdvTree.Display;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the line connector display class.
|
||||
/// </summary>
|
||||
public class LineConnectorDisplay:NodeConnectorDisplay
|
||||
{
|
||||
/// <summary>
|
||||
/// Draws connector line between two nodes.
|
||||
/// </summary>
|
||||
/// <param name="info">Connector context information.</param>
|
||||
public override void DrawConnector(ConnectorRendererEventArgs info)
|
||||
{
|
||||
if(info.NodeConnector.LineColor.IsEmpty || info.NodeConnector.LineWidth<=0)
|
||||
return;
|
||||
|
||||
Point pStart, pEnd;
|
||||
|
||||
// FromNode is null when connector is rendered for the child node
|
||||
if (info.FromNode == null)
|
||||
{
|
||||
Rectangle cellBounds = NodeDisplay.GetNodeRectangle(eNodeRectanglePart.NodeContentBounds, info.ToNode, info.Offset);
|
||||
Rectangle expandBounds = NodeDisplay.GetNodeRectangle(eNodeRectanglePart.ExpandBounds, info.ToNode, info.Offset);
|
||||
pStart = new Point(cellBounds.X - 4, cellBounds.Y + cellBounds.Height / 2);
|
||||
pEnd = new Point(expandBounds.X + expandBounds.Width / 2, pStart.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FromNode is parent node, ToNode is last visible child node. Connector is vertical line from parent to last visible child
|
||||
Rectangle cellBounds = NodeDisplay.GetNodeRectangle(eNodeRectanglePart.NodeContentBounds, info.FromNode, info.Offset);
|
||||
Rectangle expandBounds = NodeDisplay.GetNodeRectangle(eNodeRectanglePart.ExpandBounds, info.ToNode, info.Offset);
|
||||
pStart = new Point(expandBounds.X + expandBounds.Width / 2, cellBounds.Bottom);
|
||||
pEnd = new Point(pStart.X, expandBounds.Y + expandBounds.Height / 2);
|
||||
}
|
||||
|
||||
Graphics g = info.Graphics;
|
||||
using (Pen pen = GetLinePen(info))
|
||||
{
|
||||
SmoothingMode sm = g.SmoothingMode;
|
||||
if (pen.DashStyle != DashStyle.Solid)
|
||||
g.SmoothingMode = SmoothingMode.Default;
|
||||
g.DrawLine(pen, pStart, pEnd);
|
||||
g.SmoothingMode = sm;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides information for cell rendering methods and events.
|
||||
/// </summary>
|
||||
public class NodeCellRendererEventArgs:NodeRendererEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the cell being rendered.
|
||||
/// </summary>
|
||||
public Cell Cell=null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets absolute cell bounds.
|
||||
/// </summary>
|
||||
public Rectangle CellBounds=Rectangle.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the internal cell offset.
|
||||
/// </summary>
|
||||
internal Point CellOffset=Point.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color scheme.
|
||||
/// </summary>
|
||||
internal ColorScheme ColorScheme = null;
|
||||
|
||||
internal Image CheckBoxImageChecked = null;
|
||||
internal Image CheckBoxImageUnChecked = null;
|
||||
internal Image CheckBoxImageIndeterminate = null;
|
||||
internal ItemPaintArgs ItemPaintArgs = null;
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the class.
|
||||
/// </summary>
|
||||
public NodeCellRendererEventArgs():base(null,null,Rectangle.Empty,null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the class and initializes it with default values.
|
||||
/// </summary>
|
||||
/// <param name="g">Reference to graphics object.</param>
|
||||
/// <param name="node">Reference to context node.</param>
|
||||
/// <param name="bounds">Reference to node bounds</param>
|
||||
/// <param name="style">Reference to cell style</param>
|
||||
/// <param name="cell">Reference to cell</param>
|
||||
/// <param name="cellBounds">Reference to cell bounds</param>
|
||||
public NodeCellRendererEventArgs(Graphics g, Node node, Rectangle bounds, ElementStyle style, Cell cell, Rectangle cellBounds):base(g,node,bounds,style)
|
||||
{
|
||||
this.Cell = cell;
|
||||
this.CellBounds = cellBounds;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,511 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.AdvTree
|
||||
{
|
||||
namespace Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for drawing node connectors.
|
||||
/// </summary>
|
||||
public abstract class NodeConnectorDisplay
|
||||
{
|
||||
//private bool m_RootNode=false;
|
||||
//private bool m_DrawRootAllLevels=false;
|
||||
//private bool m_EndCap=true;
|
||||
//private bool m_DrawConnectorUnderNodes=true;
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
public NodeConnectorDisplay()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws connector line between two nodes.
|
||||
/// </summary>
|
||||
/// <param name="info">Connector context information.</param>
|
||||
public virtual void DrawConnector(ConnectorRendererEventArgs info){}
|
||||
|
||||
///// <summary>
|
||||
///// Returns the connector starting coordinates.
|
||||
///// </summary>
|
||||
///// <param name="info">Connector display information.</param>
|
||||
///// <returns>Point object.</returns>
|
||||
//protected virtual Point GetStartPoint(ConnectorRendererEventArgs info)
|
||||
//{
|
||||
// Point p=Point.Empty;
|
||||
|
||||
// if(info.IsRootNode)
|
||||
// {
|
||||
// //int toMidPoint=info.ToNode.Bounds.Top+info.ToNode.Bounds.Height/2;
|
||||
// //if(info.FromNode.Bounds.Top>toMidPoint)
|
||||
// if(IsAbove(info.FromNode,info.ToNode))
|
||||
// p=new Point(info.FromNode.BoundsRelative.Left+info.FromNode.BoundsRelative.Width/2,info.FromNode.BoundsRelative.Top);
|
||||
// //else if(info.FromNode.Bounds.Bottom<toMidPoint)
|
||||
// else if(IsBelow(info.FromNode,info.ToNode))
|
||||
// p=new Point(info.FromNode.BoundsRelative.Left+info.FromNode.BoundsRelative.Width/2,info.FromNode.BoundsRelative.Bottom-1);
|
||||
// }
|
||||
|
||||
// if(p.IsEmpty)
|
||||
// {
|
||||
// // To element to the Left
|
||||
// if(this.IsOnLeftSide(info.FromNode,info.ToNode))
|
||||
// p=new Point(info.FromNode.BoundsRelative.Left,info.FromNode.BoundsRelative.Top+info.FromNode.BoundsRelative.Height/2);
|
||||
// else
|
||||
// {
|
||||
// p=new Point(info.FromNode.BoundsRelative.Right,info.FromNode.BoundsRelative.Top+info.FromNode.BoundsRelative.Height/2);
|
||||
// if(info.IsRootNode)
|
||||
// p.X--;
|
||||
// if(!NodeDisplay.DrawExpandPart(info.FromNode) && info.FromNode.ExpandVisibility==eNodeExpandVisibility.Auto)
|
||||
// p.X-=(info.FromNode.BoundsRelative.Width-info.FromNode.ContentBounds.Width);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if(!p.IsEmpty)
|
||||
// p.Offset(info.Offset.X,info.Offset.Y);
|
||||
|
||||
// return p;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Returns true if fromNode is above the toNode.
|
||||
///// </summary>
|
||||
///// <param name="fromNode">From Node object.</param>
|
||||
///// <param name="toNode">To Node object</param>
|
||||
///// <returns>True if fromNode is above toNode.</returns>
|
||||
//protected bool IsAbove(Node fromNode, Node toNode)
|
||||
//{
|
||||
// //int toMidPoint=toNode.Bounds.Top+toNode.Bounds.Height/2;
|
||||
// //if(fromNode.Bounds.Top>toMidPoint)
|
||||
// if(fromNode.BoundsRelative.Top>toNode.BoundsRelative.Bottom)
|
||||
// return true;
|
||||
// return false;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Returns true if fromNode is below toNode.
|
||||
///// </summary>
|
||||
///// <param name="fromNode">From Node object.</param>
|
||||
///// <param name="toNode">To Node object.</param>
|
||||
///// <returns>True if fromNode is below toNode.</returns>
|
||||
//protected bool IsBelow(Node fromNode, Node toNode)
|
||||
//{
|
||||
// int toMidPoint=toNode.BoundsRelative.Top+toNode.BoundsRelative.Height/2;
|
||||
// if(fromNode.BoundsRelative.Bottom<toMidPoint)
|
||||
// return true;
|
||||
// return false;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Returns whether connector is extended to underline the node.
|
||||
///// </summary>
|
||||
///// <param name="nodeStyle">Refernce to Node style.</param>
|
||||
///// <returns>True if node should be underlined by connector.</returns>
|
||||
//protected bool UnderlineNode(ElementStyle nodeStyle)
|
||||
//{
|
||||
// if(!nodeStyle.PaintBottomBorder && !nodeStyle.PaintTopBorder &&
|
||||
// !nodeStyle.PaintLeftBorder && !nodeStyle.PaintRightBorder)
|
||||
// return true;
|
||||
// return false;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Returns the connector end point. The array of end points. Two valid points will be returned if node needs to be underlined by connector.
|
||||
///// </summary>
|
||||
///// <param name="info">Connector display info.</param>
|
||||
///// <returns>Array of point objects.</returns>
|
||||
//protected Point[] GetEndPoint(ConnectorRendererEventArgs info)
|
||||
//{
|
||||
// // If to element is to the right of the from node and has left border end point is the vertical mid-point
|
||||
// // If to element is to the left of the from node and has right border end point is the vertical mid-point
|
||||
// // If there is no border end point is text bottom
|
||||
// // If this is link connector the end point is the middle bottom or top point of the node
|
||||
|
||||
// Point p=Point.Empty;
|
||||
// Point pLineEnd=Point.Empty;
|
||||
// int capWidthOffset = 0; // GetCapWidthOffset(info.NodeConnector.EndCap, info.NodeConnector.EndCapSize);
|
||||
// bool leftSide=this.IsOnLeftSide(info.FromNode,info.ToNode);
|
||||
|
||||
// if(info.LinkConnector && info.FromNode.BoundsRelative.Top>info.ToNode.BoundsRelative.Bottom)
|
||||
// p=new Point(info.ToNode.BoundsRelative.X+info.ToNode.BoundsRelative.Width/2+(leftSide?capWidthOffset:-capWidthOffset),info.ToNode.BoundsRelative.Bottom+1);
|
||||
// else if(info.LinkConnector && info.FromNode.BoundsRelative.Bottom<info.ToNode.BoundsRelative.Top)
|
||||
// p=new Point(info.ToNode.BoundsRelative.X+info.ToNode.BoundsRelative.Width/2+(leftSide?capWidthOffset:-capWidthOffset),info.ToNode.BoundsRelative.Top-info.NodeConnector.EndCapSize.Height);
|
||||
// else
|
||||
// {
|
||||
// if(leftSide)
|
||||
// {
|
||||
// // To element is to the left of from node
|
||||
// Rectangle r=info.ToNode.BoundsRelative;
|
||||
// if(info.StyleToNode==null || UnderlineNode(info.StyleToNode))
|
||||
// {
|
||||
// p=new Point(r.Right,r.Bottom);
|
||||
// if(m_EndCap)
|
||||
// p.X+=capWidthOffset;
|
||||
|
||||
// if(info.NodeConnector.UnderlineNoBorderNode)
|
||||
// {
|
||||
// Rectangle rc=NodeDisplay.GetNodeRectangle(eNodeRectanglePart.NodeContentBounds,info.ToNode,Point.Empty);
|
||||
// pLineEnd=new Point(rc.Left+1,r.Bottom);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// p=new Point(r.Right,r.Y+r.Height/2);
|
||||
// if(m_EndCap)
|
||||
// p.X+=capWidthOffset;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // To element to the right of from node
|
||||
// Rectangle r=info.ToNode.BoundsRelative;
|
||||
// if(info.StyleToNode==null || UnderlineNode(info.StyleToNode))
|
||||
// {
|
||||
// //r=NodeDisplay.GetCellRectangle(eCellRectanglePart.TextBounds,info.ToNode.Cells[0],Point.Empty);
|
||||
// //r=info.ToNode.Cells[0].TextContentBounds;
|
||||
// p=new Point(r.X,r.Bottom);
|
||||
// if(m_EndCap)
|
||||
// p.X-=capWidthOffset;
|
||||
// if(info.NodeConnector.UnderlineNoBorderNode)
|
||||
// {
|
||||
// Rectangle rc=NodeDisplay.GetNodeRectangle(eNodeRectanglePart.NodeContentBounds,info.ToNode,Point.Empty);
|
||||
// pLineEnd=new Point(rc.Right-1,r.Bottom);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// p=new Point(r.X,r.Y+r.Height/2);
|
||||
// if(m_EndCap)
|
||||
// p.X-=capWidthOffset;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// if(!p.IsEmpty)
|
||||
// p.Offset(info.Offset.X,info.Offset.Y);
|
||||
// if(!pLineEnd.IsEmpty)
|
||||
// pLineEnd.Offset(info.Offset.X,info.Offset.Y);
|
||||
|
||||
// return new Point[] {p,pLineEnd};
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Returns the offest for the node connector cap.
|
||||
///// </summary>
|
||||
///// <param name="cap">Cap type.</param>
|
||||
///// <param name="size">Cap size.</param>
|
||||
///// <returns></returns>
|
||||
//protected int GetCapWidthOffset(eConnectorCap cap,Size size)
|
||||
//{
|
||||
// int capWidthOffset=0;
|
||||
// switch(cap)
|
||||
// {
|
||||
// case eConnectorCap.Arrow:
|
||||
// capWidthOffset=size.Width+1;
|
||||
// break;
|
||||
// case eConnectorCap.Ellipse:
|
||||
// capWidthOffset=size.Width;
|
||||
// break;
|
||||
// }
|
||||
// return capWidthOffset;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Returns true if source node is on the left side of the target node.
|
||||
///// </summary>
|
||||
///// <param name="source">Reference to source node.</param>
|
||||
///// <param name="target">Reference to target node.</param>
|
||||
///// <returns>True if source is on the left side of target.</returns>
|
||||
//protected bool IsOnLeftSide(Node source, Node target)
|
||||
//{
|
||||
// if((source.BoundsRelative.Left+source.BoundsRelative.Width/2)>target.BoundsRelative.Left)
|
||||
// return true;
|
||||
// return false;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Returns new instance of pen object for node connector line. Caller is responsible for
|
||||
/// disposing of this object.
|
||||
/// </summary>
|
||||
/// <param name="info">Node connector display info.</param>
|
||||
/// <returns>New instance of Pen object.</returns>
|
||||
protected Pen GetLinePen(ConnectorRendererEventArgs info)
|
||||
{
|
||||
Pen pen = new Pen(info.NodeConnector.LineColor, info.NodeConnector.LineWidth);
|
||||
pen.DashStyle = info.NodeConnector.DashStyle;
|
||||
return pen;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Returns new instance of pen object for the end node connector line. Caller is responsible for
|
||||
///// disposing of this object.
|
||||
///// </summary>
|
||||
///// <param name="info">Node connector display info.</param>
|
||||
///// <returns>New instance of Pen object.</returns>
|
||||
//protected Pen GetEndLinePen(ConnectorRendererEventArgs info)
|
||||
//{
|
||||
// return new Pen(info.NodeConnector.LineColor,EndLineWidth);
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Returns new instance of pen object for the node underline line. Caller is responsible for
|
||||
///// disposing of this object.
|
||||
///// </summary>
|
||||
///// <param name="info">Node connector display info.</param>
|
||||
///// <returns>New instance of Pen object.</returns>
|
||||
//protected Pen GetEndUnderlinePen(ConnectorRendererEventArgs info)
|
||||
//{
|
||||
// return new Pen(info.NodeConnector.LineColor,EndLineWidth);
|
||||
//}
|
||||
|
||||
//private int EndLineWidth
|
||||
//{
|
||||
// get {return 1;}
|
||||
//}
|
||||
|
||||
// /// <summary>
|
||||
// /// Draws straight line connector between start and end point.
|
||||
// /// </summary>
|
||||
// /// <param name="info">Node connector display info.</param>
|
||||
// /// <param name="pStart">Start point.</param>
|
||||
// /// <param name="pEnd">End point.</param>
|
||||
// /// <param name="pEndUnderLine">Underline end point if any.</param>
|
||||
// protected void DrawStraightLineConnector(ConnectorRendererEventArgs info, Point pStart, Point pEnd)
|
||||
// {
|
||||
// using (Pen pen = this.GetLinePen(info))
|
||||
// {
|
||||
// if (pen.DashStyle != DashStyle.Solid)
|
||||
// {
|
||||
// SmoothingMode sm = info.Graphics.SmoothingMode;
|
||||
// info.Graphics.SmoothingMode = SmoothingMode.Default;
|
||||
// info.Graphics.DrawLine(pen, pStart, pEnd);
|
||||
// info.Graphics.SmoothingMode = sm;
|
||||
// }
|
||||
// else
|
||||
// info.Graphics.DrawLine(pen, pStart, pEnd);
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Draws straight line connector between start and end point.
|
||||
// /// </summary>
|
||||
// /// <param name="info">Node connector display info.</param>
|
||||
// /// <param name="pStart">Start point.</param>
|
||||
// /// <param name="pEnd">End point.</param>
|
||||
// /// <param name="pEndUnderLine">Underline end point if any.</param>
|
||||
// protected void DrawLineConnector(ConnectorRendererEventArgs info,Point pStart,Point pEnd, Point pEndUnderLine)
|
||||
// {
|
||||
// if(info.NodeConnector.LineWidth>1)
|
||||
// {
|
||||
// // Merge lines nicely by filling and creating path...
|
||||
// int rootLineWidth=this.EndLineWidth;
|
||||
// int lineWidth=info.NodeConnector.LineWidth;
|
||||
|
||||
// using(Brush brush=GetLineBrush(info))
|
||||
// {
|
||||
// GraphicsPath path=GetConnectingPath(pStart,pEnd,lineWidth,rootLineWidth,info.IsRootNode,!(IsAbove(info.FromNode,info.ToNode) || IsBelow(info.FromNode,info.ToNode)));
|
||||
// info.Graphics.FillPath(brush,path);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// using(Pen pen=this.GetLinePen(info))
|
||||
// {
|
||||
// info.Graphics.DrawLine(pen,pStart,pEnd);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if(!pEndUnderLine.IsEmpty)
|
||||
// {
|
||||
// using(Pen pen=this.GetEndUnderlinePen(info))
|
||||
// {
|
||||
// info.Graphics.DrawLine(pen,pEnd,pEndUnderLine);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private GraphicsPath GetConnectingPath(Point pStart, Point pEnd, int lineStartWidth, int lineEndWidth, bool bRoot, bool bRootSide)
|
||||
// {
|
||||
// int direction=1;
|
||||
// if(pStart.X>pEnd.X)
|
||||
// direction=-1;
|
||||
// lineStartWidth++;
|
||||
// lineEndWidth++;
|
||||
// GraphicsPath path=new GraphicsPath();
|
||||
// if(bRoot && !bRootSide)
|
||||
// {
|
||||
// path.AddLine(pStart.X,pStart.Y,pStart.X+lineStartWidth*direction,pStart.Y);
|
||||
//// if(direction>0)
|
||||
//// path.AddLine(pEnd.X+lineEndWidth*direction,pEnd.Y,pEnd.X,pEnd.Y);
|
||||
//// else
|
||||
//// path.AddLine(pEnd.X,pEnd.Y,pEnd.X+lineEndWidth*direction,pEnd.Y);
|
||||
// if(direction>0)
|
||||
// {
|
||||
// path.AddLine(pStart.X+lineStartWidth*direction,pStart.Y, pEnd.X, pEnd.Y);
|
||||
// path.AddLine(pEnd.X, pEnd.Y, pEnd.X, pEnd.Y + lineEndWidth*direction);
|
||||
// path.AddLine(pEnd.X, pEnd.Y + lineEndWidth*direction, pStart.X, pStart.Y);
|
||||
// }
|
||||
// else
|
||||
// path.AddLine(pEnd.X, pEnd.Y, pEnd.X, pEnd.Y + lineEndWidth*direction);
|
||||
|
||||
// path.CloseAllFigures();
|
||||
//// if(Math.Abs(pEnd.Y-pStart.Y)<=8)
|
||||
//// path.Widen(SystemPens.Highlight);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// int offsetStart=lineStartWidth/2;
|
||||
// int offsetEnd=lineEndWidth/2;
|
||||
// path.AddLine(pStart.X,pStart.Y-offsetStart,pStart.X,pStart.Y+offsetStart);
|
||||
// path.AddLine(pEnd.X,pEnd.Y+offsetEnd,pEnd.X,pEnd.Y-offsetEnd);
|
||||
// path.AddLine(pEnd.X,pEnd.Y-offsetEnd,pStart.X,pStart.Y-offsetStart);
|
||||
// path.CloseAllFigures();
|
||||
// }
|
||||
|
||||
// return path;
|
||||
// }
|
||||
|
||||
// protected Brush GetLineBrush(ConnectorRendererEventArgs info)
|
||||
// {
|
||||
// return new SolidBrush(info.NodeConnector.LineColor);
|
||||
// }
|
||||
|
||||
// protected void DrawEndLine(ConnectorRendererEventArgs info,Point pStart,Point pEnd,Point pEndUnderLine)
|
||||
// {
|
||||
// if(pEndUnderLine.IsEmpty)
|
||||
// {
|
||||
// switch(info.NodeConnector.EndCap)
|
||||
// {
|
||||
// case eConnectorCap.Ellipse:
|
||||
// {
|
||||
// using(Pen pen=this.GetEndLinePen(info))
|
||||
// {
|
||||
// Size endCapSize=info.NodeConnector.EndCapSize;
|
||||
// if(pStart.X<pEnd.X)
|
||||
// info.Graphics.DrawEllipse(pen,pEnd.X-1,pEnd.Y-endCapSize.Height/2,endCapSize.Width,endCapSize.Height);
|
||||
// else
|
||||
// info.Graphics.DrawEllipse(pen,pEnd.X-endCapSize.Width,pEnd.Y-endCapSize.Height/2,endCapSize.Width,endCapSize.Height);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// case eConnectorCap.Arrow:
|
||||
// {
|
||||
// using(Pen pen=this.GetEndLinePen(info))
|
||||
// {
|
||||
// // Connects connector line to arrow
|
||||
// int direction=1;
|
||||
// if(pStart.X>pEnd.X)
|
||||
// direction=-1;
|
||||
// info.Graphics.DrawLine(pen,pEnd,new Point(pEnd.X+info.NodeConnector.EndCapSize.Width/3*direction,pEnd.Y));
|
||||
|
||||
// Size endCapSize=info.NodeConnector.EndCapSize;
|
||||
// GraphicsPath arrow=GetArrowPath(endCapSize,pStart,pEnd);
|
||||
// info.Graphics.DrawPath(pen,arrow);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// using(Pen pen=this.GetEndUnderlinePen(info))
|
||||
// {
|
||||
// info.Graphics.DrawLine(pen,pEnd,pEndUnderLine);
|
||||
|
||||
// // Connect underline to expand part
|
||||
// if(NodeDisplay.DrawExpandPart(info.ToNode))
|
||||
// {
|
||||
// Rectangle re=NodeDisplay.GetNodeRectangle(eNodeRectanglePart.ExpandBounds,info.ToNode,info.Offset);
|
||||
// Point p2=new Point((re.X>pEndUnderLine.X?re.X:re.Right)+(re.Width/2*(re.X>pEndUnderLine.X?1:-1)),re.Bottom);
|
||||
// Point p1=new Point(p2.X,pEndUnderLine.Y+(pEndUnderLine.Y>p2.Y?(p2.Y-pEndUnderLine.Y)/2:-(p2.Y-pEndUnderLine.Y)/2));
|
||||
// info.Graphics.DrawCurve(pen,new Point[]{pEndUnderLine,p1,p2},.5f);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private GraphicsPath GetArrowPath(Size capSize,Point pStart,Point pEnd)
|
||||
// {
|
||||
// GraphicsPath path=new GraphicsPath();
|
||||
// int direction=1;
|
||||
// if(pStart.X>pEnd.X)
|
||||
// direction=-1;
|
||||
|
||||
// pEnd.X+=(GetCapWidthOffset(eConnectorCap.Arrow,capSize)*direction);
|
||||
// path.AddLine(pEnd.X,pEnd.Y,pEnd.X-capSize.Width*direction,pEnd.Y-capSize.Height/2);
|
||||
// path.AddLine(pEnd.X-(2*capSize.Width/3*direction),pEnd.Y,pEnd.X-capSize.Width*direction,pEnd.Y+capSize.Height/2);
|
||||
|
||||
// path.CloseAllFigures();
|
||||
// return path;
|
||||
// }
|
||||
|
||||
//internal virtual ConnectorPointInfo GetConnectorPointInfo(ConnectorRendererEventArgs info, Point pStart, Point pEnd)
|
||||
//{
|
||||
// ConnectorPointInfo pointInfo=new ConnectorPointInfo();
|
||||
|
||||
// int xMulti=1/*, yMulti=1*/;
|
||||
// int lineWidth=info.NodeConnector.LineWidth;
|
||||
|
||||
// // used for direction control
|
||||
// if(pStart.X>pEnd.X)
|
||||
// xMulti=-1;
|
||||
// //if(pStart.Y>pEnd.Y)
|
||||
// // yMulti=-1;
|
||||
|
||||
// if(info.ConnectorPoints!=null)
|
||||
// {
|
||||
// Point connPointsOffset=info.ToNode.BoundsRelative.Location;
|
||||
// connPointsOffset.Offset(info.Offset.X,info.Offset.Y);
|
||||
// GraphicsPath path=new GraphicsPath();
|
||||
|
||||
// pointInfo.Points1=new Point[info.ConnectorPoints.Count+2];
|
||||
// pointInfo.Points1[0]=pStart;
|
||||
// pointInfo.Points1[pointInfo.Points1.Length-1]=pEnd;
|
||||
|
||||
// if(lineWidth>1)
|
||||
// {
|
||||
// pointInfo.Points2=new Point[info.ConnectorPoints.Count+2];
|
||||
// pointInfo.Points2[pointInfo.Points2.Length-1]=pStart;
|
||||
// pointInfo.Points2[0]=pEnd;
|
||||
|
||||
// int i=pointInfo.Points1.Length-2;
|
||||
// int k=1;
|
||||
|
||||
// foreach(Point pcp in info.ConnectorPoints)
|
||||
// {
|
||||
// pointInfo.Points1[i]=pcp;
|
||||
// pointInfo.Points1[i].Offset(connPointsOffset.X,connPointsOffset.Y);
|
||||
// pointInfo.Points2[k]=new Point(pcp.X+lineWidth*xMulti,pcp.Y);
|
||||
// pointInfo.Points2[k].Offset(connPointsOffset.X,connPointsOffset.Y);
|
||||
// k++;
|
||||
// i--;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// int i=pointInfo.Points1.Length-2;
|
||||
// foreach(Point pcp in info.ConnectorPoints)
|
||||
// {
|
||||
// pointInfo.Points1[i]=pcp;
|
||||
// pointInfo.Points1[i].Offset(connPointsOffset.X,connPointsOffset.Y);
|
||||
// i--;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return pointInfo;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents custom connector path info.
|
||||
/// </summary>
|
||||
internal class ConnectorPointInfo
|
||||
{
|
||||
public Point[] Points1=null;
|
||||
public Point[] Points2=null;
|
||||
}
|
||||
}
|
351
PROMS/DotNetBar Source Code/AdvTree/Display/NodeDisplay.cs
Normal file
351
PROMS/DotNetBar Source Code/AdvTree/Display/NodeDisplay.cs
Normal file
@@ -0,0 +1,351 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using DevComponents.AdvTree.Layout;
|
||||
using System.Collections;
|
||||
using DevComponents.DotNetBar;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for NodeDisplay.
|
||||
/// </summary>
|
||||
public class NodeDisplay
|
||||
{
|
||||
#region Private Variables
|
||||
private Point m_Offset=Point.Empty;
|
||||
private Point m_LockedOffset=Point.Empty;
|
||||
private AdvTree m_Tree=null;
|
||||
internal ArrayList _PaintedNodes = new ArrayList(100);
|
||||
#if !TRIAL
|
||||
internal static bool keyInvalid=false;
|
||||
#endif
|
||||
#endregion
|
||||
/// <summary>Creates new instance of the class</summary>
|
||||
/// <param name="tree">Object to initialize class with.</param>
|
||||
public NodeDisplay(AdvTree tree)
|
||||
{
|
||||
m_Tree=tree;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Paints the layout on canvas.
|
||||
/// </summary>
|
||||
public virtual void Paint(Graphics g, Rectangle clipRectangle)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the offset of the tree content relative to the size of the container control.
|
||||
/// </summary>
|
||||
public virtual Point Offset
|
||||
{
|
||||
get
|
||||
{
|
||||
if(!m_LockedOffset.IsEmpty)
|
||||
return m_LockedOffset;
|
||||
|
||||
Node displayNode=m_Tree.GetDisplayRootNode();
|
||||
if(displayNode==null)
|
||||
return Point.Empty;;
|
||||
|
||||
Size nodesSize = m_Tree.GetScreenSize(new Size(m_Tree.NodeLayout.Width, m_Tree.NodeLayout.Height));
|
||||
return m_Tree.GetLayoutPosition(m_Offset);
|
||||
}
|
||||
set {m_Offset=value;}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets whether offset is locked, i.e. cannot be changed.</summary>
|
||||
public bool LockOffset
|
||||
{
|
||||
get {return (!m_LockedOffset.IsEmpty);}
|
||||
set
|
||||
{
|
||||
if(value)
|
||||
m_LockedOffset=this.Offset;
|
||||
else
|
||||
m_LockedOffset=Point.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets locked offset to specific value. Point.Empty means there is no locked offset set.
|
||||
/// </summary>
|
||||
/// <param name="p">New locked offset.</param>
|
||||
public void SetLockedOffset(Point p)
|
||||
{
|
||||
m_LockedOffset=p;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Point GetLockedOffset()
|
||||
{
|
||||
return m_LockedOffset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the default offset for the tree content relative to the size of the container.
|
||||
/// </summary>
|
||||
public virtual Point DefaultOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
Node displayNode=m_Tree.GetDisplayRootNode();
|
||||
if(displayNode==null)
|
||||
return Point.Empty;;
|
||||
|
||||
//if(m_Tree.NodeLayout is NodeMapLayout && m_Tree.Nodes.Count>0)
|
||||
//{
|
||||
// if(!m_Tree.CenterContent)
|
||||
// return new Point(Math.Abs(displayNode.ChildNodesBounds.Left),Math.Abs(displayNode.ChildNodesBounds.Top));
|
||||
// else
|
||||
// return new Point(m_Tree.SelectionBoxSize+(m_Tree.Width - m_Tree.SelectionBoxSize * 2 - m_Tree.NodeLayout.Width) / 2 + Math.Abs(displayNode.ChildNodesBounds.Left),
|
||||
// m_Tree.SelectionBoxSize + (m_Tree.Height - m_Tree.SelectionBoxSize * 2 - m_Tree.NodeLayout.Height) / 2 + Math.Abs(displayNode.ChildNodesBounds.Top));
|
||||
//}
|
||||
//if(m_Tree.NodeLayout is Layout.NodeDiagramLayout)
|
||||
//{
|
||||
// if(!m_Tree.CenterContent)
|
||||
// return m_Tree.ClientRectangle.Location;
|
||||
// else
|
||||
// return new Point((m_Tree.Width-m_Tree.NodeLayout.Width)/2,(m_Tree.Height-m_Tree.NodeLayout.Height)/2);
|
||||
//}
|
||||
//else
|
||||
return m_Tree.ClientRectangle.Location;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference to the tree control managed by display class.
|
||||
/// </summary>
|
||||
protected virtual AdvTree Tree
|
||||
{
|
||||
get {return m_Tree;}
|
||||
set {m_Tree=value;}
|
||||
}
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static Rectangle GetNodeRectangle(eNodeRectanglePart part, Node node, Point offset)
|
||||
{
|
||||
Rectangle r=Rectangle.Empty;
|
||||
if(part==eNodeRectanglePart.CellsBounds)
|
||||
{
|
||||
r=node.CellsBoundsRelative;
|
||||
if(!r.IsEmpty)
|
||||
{
|
||||
r.Offset(offset);
|
||||
r.Offset(node.BoundsRelative.Location);
|
||||
}
|
||||
}
|
||||
else if (part == eNodeRectanglePart.ExpandHitTestBounds)
|
||||
{
|
||||
Rectangle nodeBounds = GetNodeRectangle(eNodeRectanglePart.NodeBounds, node, offset);
|
||||
|
||||
r = node.ExpandPartRectangleRelative;
|
||||
if (!r.IsEmpty)
|
||||
{
|
||||
r.Offset(offset);
|
||||
r.Offset(node.BoundsRelative.Location);
|
||||
}
|
||||
r.Y = nodeBounds.Y;
|
||||
r.Height = nodeBounds.Height;
|
||||
r.Inflate(1, 0);
|
||||
}
|
||||
else if(part==eNodeRectanglePart.ExpandBounds)
|
||||
{
|
||||
r=node.ExpandPartRectangleRelative;
|
||||
if(!r.IsEmpty)
|
||||
{
|
||||
r.Offset(offset);
|
||||
r.Offset(node.BoundsRelative.Location);
|
||||
}
|
||||
}
|
||||
else if(part==eNodeRectanglePart.CommandBounds)
|
||||
{
|
||||
r=node.CommandBoundsRelative;
|
||||
if(!r.IsEmpty)
|
||||
{
|
||||
r.Offset(offset);
|
||||
r.Offset(node.BoundsRelative.Location);
|
||||
}
|
||||
}
|
||||
else if(part==eNodeRectanglePart.NodeContentBounds)
|
||||
{
|
||||
r=node.ContentBounds;
|
||||
if(!r.IsEmpty)
|
||||
{
|
||||
r.Offset(offset);
|
||||
r.Offset(node.BoundsRelative.Location);
|
||||
}
|
||||
}
|
||||
else if(part==eNodeRectanglePart.NodeBounds)
|
||||
{
|
||||
r=node.BoundsRelative;
|
||||
if(!r.IsEmpty)
|
||||
r.Offset(offset);
|
||||
}
|
||||
else if (part == eNodeRectanglePart.ChildNodeBounds)
|
||||
{
|
||||
r = node.ChildNodesBounds;
|
||||
if (!r.IsEmpty)
|
||||
{
|
||||
//r.Offset(node.Bounds.Location);
|
||||
r.Offset(offset);
|
||||
}
|
||||
}
|
||||
else if (part == eNodeRectanglePart.ColumnsBounds && HasColumnsVisible(node))
|
||||
{
|
||||
r = node.NodesColumns.Bounds;
|
||||
if(!r.IsEmpty)
|
||||
r.Offset(offset);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
internal static bool HasColumnsVisible(Node node)
|
||||
{
|
||||
return node.Expanded && node.HasColumns && node.NodesColumnsHeaderVisible;
|
||||
}
|
||||
|
||||
internal static Rectangle GetCellRectangle(eCellRectanglePart part, Cell cell, Point offset)
|
||||
{
|
||||
Rectangle r=Rectangle.Empty;
|
||||
|
||||
// If cell parent is not assigned rectangle cannot be returned.
|
||||
if(cell.Parent==null)
|
||||
return r;
|
||||
|
||||
if(part==eCellRectanglePart.CheckBoxBounds)
|
||||
{
|
||||
r=cell.CheckBoxBoundsRelative;
|
||||
if(!r.IsEmpty)
|
||||
{
|
||||
r.Offset(offset);
|
||||
r.Offset(cell.Parent.BoundsRelative.Location);
|
||||
}
|
||||
}
|
||||
else if(part==eCellRectanglePart.ImageBounds)
|
||||
{
|
||||
r=cell.ImageBoundsRelative;
|
||||
if(!r.IsEmpty)
|
||||
{
|
||||
r.Offset(offset);
|
||||
r.Offset(cell.Parent.BoundsRelative.Location);
|
||||
}
|
||||
}
|
||||
else if(part==eCellRectanglePart.TextBounds)
|
||||
{
|
||||
r=cell.TextContentBounds;
|
||||
if(!r.IsEmpty)
|
||||
{
|
||||
r.Offset(offset);
|
||||
r.Offset(cell.Parent.BoundsRelative.Location);
|
||||
}
|
||||
}
|
||||
else if(part==eCellRectanglePart.CellBounds)
|
||||
{
|
||||
r=cell.BoundsRelative;
|
||||
if(!r.IsEmpty)
|
||||
{
|
||||
r.Offset(offset);
|
||||
r.Offset(cell.Parent.BoundsRelative.Location);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
internal static bool DrawExpandPart(Node node)
|
||||
{
|
||||
if(node.Nodes.Count>0 && node.ExpandVisibility!=eNodeExpandVisibility.Hidden || node.ExpandVisibility==eNodeExpandVisibility.Visible)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected NodeExpandDisplay GetExpandDisplay(eExpandButtonType e)
|
||||
{
|
||||
NodeExpandDisplay d=null;
|
||||
switch(e)
|
||||
{
|
||||
case eExpandButtonType.Rectangle:
|
||||
d = new NodeExpandRectDisplay();
|
||||
break;
|
||||
case eExpandButtonType.Triangle:
|
||||
d = new NodeExpandTriangleDisplay();
|
||||
break;
|
||||
case eExpandButtonType.Ellipse:
|
||||
d=new NodeExpandEllipseDisplay();
|
||||
break;
|
||||
case eExpandButtonType.Image:
|
||||
d=new NodeExpandImageDisplay();
|
||||
break;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
protected bool IsRootNode(Node node)
|
||||
{
|
||||
return NodeOperations.IsRootNode(m_Tree,node);
|
||||
}
|
||||
|
||||
protected ElementStyle GetDefaultNodeStyle()
|
||||
{
|
||||
ElementStyle style=new ElementStyle();
|
||||
style.TextColorSchemePart=eColorSchemePart.ItemText;
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
public void MoveHostedControls()
|
||||
{
|
||||
Point offset = this.Offset;
|
||||
float zoom = this.Tree.Zoom;
|
||||
foreach (Cell cell in this.Tree.HostedControlCells)
|
||||
{
|
||||
System.Windows.Forms.Control cellHostedControl = cell.HostedControl;
|
||||
if (cellHostedControl == null) continue;
|
||||
Rectangle bounds = NodeDisplay.GetCellRectangle(eCellRectanglePart.TextBounds, cell, offset);
|
||||
Rectangle screenBounds = this.Tree.GetScreenRectangle(bounds);
|
||||
if (!bounds.IsEmpty && cellHostedControl.Bounds != screenBounds)
|
||||
{
|
||||
if (zoom != 1)
|
||||
{
|
||||
cell.HostedControlSize = bounds.Size;
|
||||
cell.IgnoreHostedControlSizeChange = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cell.HostedControlSize = Size.Empty;
|
||||
if (screenBounds.Height > cellHostedControl.Height && cellHostedControl.Height > 0)
|
||||
{
|
||||
screenBounds.Y += (screenBounds.Height - cellHostedControl.Height) / 2;
|
||||
screenBounds.Height = cellHostedControl.Height;
|
||||
}
|
||||
}
|
||||
cellHostedControl.Bounds = screenBounds;
|
||||
if (zoom != 1)
|
||||
cell.IgnoreHostedControlSizeChange = false;
|
||||
if (cell.Parent != null)
|
||||
{
|
||||
bool visible = NodeOperations.GetIsNodeVisible(cell.Parent) && cell.IsVisible;
|
||||
if (visible != cellHostedControl.Visible)
|
||||
cellHostedControl.Visible = visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList PaintedNodes
|
||||
{
|
||||
get
|
||||
{
|
||||
return _PaintedNodes;
|
||||
}
|
||||
}
|
||||
|
||||
internal virtual void PaintColumnHeaders(ColumnHeaderCollection columns, Graphics g, bool treeControlHeader)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
139
PROMS/DotNetBar Source Code/AdvTree/Display/NodeExpandDisplay.cs
Normal file
139
PROMS/DotNetBar Source Code/AdvTree/Display/NodeExpandDisplay.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using DevComponents.DotNetBar;
|
||||
|
||||
namespace DevComponents.AdvTree
|
||||
{
|
||||
namespace Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for node expand button display.
|
||||
/// </summary>
|
||||
public abstract class NodeExpandDisplay
|
||||
{
|
||||
/// <summary>Creates new instance of the class</summary>
|
||||
public NodeExpandDisplay()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Draws expand button.</summary>
|
||||
/// <param name="e">Context parameters for drawing expand button.</param>
|
||||
public abstract void DrawExpandButton(NodeExpandPartRendererEventArgs e);
|
||||
|
||||
protected Pen GetBorderPen(NodeExpandPartRendererEventArgs e)
|
||||
{
|
||||
if(!e.BorderColor.IsEmpty)
|
||||
return new Pen(e.BorderColor,1);
|
||||
if (_ColorTable != null)
|
||||
{
|
||||
bool expanded = e.Node.Expanded;
|
||||
TreeExpandColorTable ct = GetExpandColorTable(e);
|
||||
if (ct == null) return null;
|
||||
if (expanded)
|
||||
{
|
||||
// Collapse node colors
|
||||
if (!e.IsMouseOver && ct.CollapseBorder != null)
|
||||
return ct.CollapseBorder.CreatePen();
|
||||
else if (e.IsMouseOver && ct.CollapseMouseOverBorder != null)
|
||||
return ct.CollapseMouseOverBorder.CreatePen();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Expand node colors
|
||||
if (!e.IsMouseOver && ct.ExpandBorder != null)
|
||||
return ct.ExpandBorder.CreatePen();
|
||||
else if (e.IsMouseOver && ct.ExpandMouseOverBorder != null)
|
||||
return ct.ExpandMouseOverBorder.CreatePen();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private TreeExpandColorTable GetExpandColorTable(NodeExpandPartRendererEventArgs e)
|
||||
{
|
||||
TreeExpandColorTable ct = null;
|
||||
if (e.ExpandButtonType == eExpandButtonType.Rectangle)
|
||||
ct = _ColorTable.ExpandRectangle;
|
||||
else if (e.ExpandButtonType == eExpandButtonType.Triangle)
|
||||
ct = _ColorTable.ExpandTriangle;
|
||||
else if (e.ExpandButtonType == eExpandButtonType.Ellipse)
|
||||
ct = _ColorTable.ExpandEllipse;
|
||||
return ct;
|
||||
}
|
||||
|
||||
protected Pen GetExpandPen(NodeExpandPartRendererEventArgs e)
|
||||
{
|
||||
if (e.ExpandLineColor.IsEmpty)
|
||||
{
|
||||
TreeExpandColorTable ct = GetExpandColorTable(e);
|
||||
if (ct != null)
|
||||
{
|
||||
bool expanded = e.Node.Expanded;
|
||||
if (expanded)
|
||||
{
|
||||
// Collapse node colors
|
||||
if (!e.IsMouseOver && ct.CollapseForeground != null)
|
||||
return ct.CollapseForeground.CreatePen(Dpi.Width1);
|
||||
else if (e.IsMouseOver && ct.CollapseMouseOverForeground != null)
|
||||
return ct.CollapseMouseOverForeground.CreatePen(Dpi.Width1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Collapse node colors
|
||||
if (!e.IsMouseOver && ct.ExpandForeground != null)
|
||||
return ct.ExpandForeground.CreatePen(Dpi.Width1);
|
||||
else if (e.IsMouseOver && ct.ExpandMouseOverForeground != null)
|
||||
return ct.ExpandMouseOverForeground.CreatePen(Dpi.Width1);
|
||||
}
|
||||
}
|
||||
|
||||
return GetBorderPen(e);
|
||||
}
|
||||
|
||||
return new Pen(e.ExpandLineColor,1);
|
||||
}
|
||||
|
||||
protected Brush GetBackgroundBrush(NodeExpandPartRendererEventArgs e)
|
||||
{
|
||||
if (e.BackColor.IsEmpty && e.BackColor2.IsEmpty)
|
||||
{
|
||||
bool expanded = e.Node.Expanded;
|
||||
TreeExpandColorTable ct = GetExpandColorTable(e);
|
||||
if (ct == null) return null;
|
||||
if (expanded)
|
||||
{
|
||||
// Collapse node colors
|
||||
if (!e.IsMouseOver && ct.CollapseFill != null)
|
||||
return ct.CollapseFill.CreateBrush(e.ExpandPartBounds);
|
||||
else if (e.IsMouseOver && ct.CollapseMouseOverFill != null)
|
||||
return ct.CollapseMouseOverFill.CreateBrush(e.ExpandPartBounds);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Expand node colors
|
||||
if (!e.IsMouseOver && ct.ExpandFill != null)
|
||||
return ct.ExpandFill.CreateBrush(e.ExpandPartBounds);
|
||||
else if (e.IsMouseOver && ct.ExpandMouseOverFill != null)
|
||||
return ct.ExpandMouseOverFill.CreateBrush(e.ExpandPartBounds);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if(e.BackColor2.IsEmpty)
|
||||
return new SolidBrush(e.BackColor);
|
||||
|
||||
System.Drawing.Drawing2D.LinearGradientBrush brush=DisplayHelp.CreateLinearGradientBrush(e.ExpandPartBounds,e.BackColor,e.BackColor2,e.BackColorGradientAngle);
|
||||
//brush.SetSigmaBellShape(0.8f);
|
||||
return brush;
|
||||
}
|
||||
|
||||
private TreeColorTable _ColorTable;
|
||||
public TreeColorTable ColorTable
|
||||
{
|
||||
get { return _ColorTable; }
|
||||
set { _ColorTable = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents class that paints elliptical expand button.
|
||||
/// </summary>
|
||||
public class NodeExpandEllipseDisplay:NodeExpandDisplay
|
||||
{
|
||||
/// <summary>Draws ellipse type expand button.</summary>
|
||||
/// <param name="e">Expand context drawing information.</param>
|
||||
public override void DrawExpandButton(NodeExpandPartRendererEventArgs e)
|
||||
{
|
||||
if(e.ExpandPartBounds.IsEmpty)
|
||||
return;
|
||||
|
||||
Brush brush=GetBackgroundBrush(e);
|
||||
if(brush!=null)
|
||||
{
|
||||
e.Graphics.FillEllipse(brush,e.ExpandPartBounds);
|
||||
brush.Dispose();
|
||||
}
|
||||
|
||||
Pen pen=GetBorderPen(e);
|
||||
if (pen != null)
|
||||
{
|
||||
SmoothingMode sm = e.Graphics.SmoothingMode;
|
||||
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
e.Graphics.DrawEllipse(pen, e.ExpandPartBounds);
|
||||
e.Graphics.SmoothingMode = sm;
|
||||
pen.Dispose();
|
||||
pen = null;
|
||||
}
|
||||
|
||||
if(e.Node.Expanded)
|
||||
{
|
||||
pen = GetExpandPen(e);
|
||||
if (pen != null)
|
||||
{
|
||||
e.Graphics.DrawLine(pen, e.ExpandPartBounds.X + 2, e.ExpandPartBounds.Y + e.ExpandPartBounds.Height / 2, e.ExpandPartBounds.Right - 2, e.ExpandPartBounds.Y + e.ExpandPartBounds.Height / 2);
|
||||
pen.Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pen = GetExpandPen(e);
|
||||
if (pen != null)
|
||||
{
|
||||
e.Graphics.DrawLine(pen,e.ExpandPartBounds.X+2,e.ExpandPartBounds.Y+e.ExpandPartBounds.Height/2,e.ExpandPartBounds.Right-2,e.ExpandPartBounds.Y+e.ExpandPartBounds.Height/2);
|
||||
e.Graphics.DrawLine(pen,e.ExpandPartBounds.X+e.ExpandPartBounds.Width/2,e.ExpandPartBounds.Y+2,e.ExpandPartBounds.X+e.ExpandPartBounds.Width/2,e.ExpandPartBounds.Bottom-2);
|
||||
pen.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents expand button display using predefined images.
|
||||
/// </summary>
|
||||
public class NodeExpandImageDisplay:NodeExpandDisplay
|
||||
{
|
||||
/// <summary>
|
||||
/// Draws image type expand button.
|
||||
/// </summary>
|
||||
/// <param name="e">Expand context information</param>
|
||||
public override void DrawExpandButton(NodeExpandPartRendererEventArgs e)
|
||||
{
|
||||
if(e.Node.Expanded)
|
||||
{
|
||||
if(e.ExpandImageCollapse!=null)
|
||||
e.Graphics.DrawImage(e.ExpandImageCollapse,e.ExpandPartBounds);
|
||||
}
|
||||
else if(e.ExpandImage!=null)
|
||||
e.Graphics.DrawImage(e.ExpandImage,e.ExpandPartBounds);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.AdvTree
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents event arguments for RenderExpandPart event.
|
||||
/// </summary>
|
||||
public class NodeExpandPartRendererEventArgs:EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets reference to Graphics object, canvas node is rendered on.
|
||||
/// </summary>
|
||||
public System.Drawing.Graphics Graphics=null;
|
||||
/// <summary>
|
||||
/// Gets or sets the reference to Node object being rendered.
|
||||
/// </summary>
|
||||
public DevComponents.AdvTree.Node Node=null;
|
||||
/// <summary>Expand part bounds</summary>
|
||||
public Rectangle ExpandPartBounds=Rectangle.Empty;
|
||||
/// <summary>Expand part border color</summary>
|
||||
public Color BorderColor=Color.Empty;
|
||||
/// <summary>Expand part line color</summary>
|
||||
public Color ExpandLineColor=Color.Empty;
|
||||
/// <summary>Expand part background color</summary>
|
||||
public Color BackColor=Color.Empty;
|
||||
/// <summary>Expand part target gradient background color</summary>
|
||||
public Color BackColor2=Color.Empty;
|
||||
/// <summary>Gradient angle</summary>
|
||||
public int BackColorGradientAngle=90;
|
||||
/// <summary>Expand part image when node is expanded</summary>
|
||||
public Image ExpandImage=null;
|
||||
/// <summary>Expand part image when node is collapsed</summary>
|
||||
public Image ExpandImageCollapse=null;
|
||||
/// <summary>Internal support for expand button types</summary>
|
||||
internal eExpandButtonType ExpandButtonType=eExpandButtonType.Ellipse;
|
||||
/// <summary>Gets whether mouse is over expand part</summary>
|
||||
public bool IsMouseOver = false;
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the class and initializes it with default values.
|
||||
/// </summary>
|
||||
/// <param name="g">Reference to graphics object.</param>
|
||||
public NodeExpandPartRendererEventArgs(Graphics g)
|
||||
{
|
||||
this.Graphics = g;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents class that paints rectangular expand button.
|
||||
/// </summary>
|
||||
public class NodeExpandRectDisplay:NodeExpandDisplay
|
||||
{
|
||||
/// <summary>
|
||||
/// Draw rectangular type expand button.
|
||||
/// </summary>
|
||||
/// <param name="e">Expand button context information.</param>
|
||||
public override void DrawExpandButton(NodeExpandPartRendererEventArgs e)
|
||||
{
|
||||
if(e.ExpandPartBounds.IsEmpty)
|
||||
return;
|
||||
|
||||
Brush brush=GetBackgroundBrush(e);
|
||||
if(brush!=null)
|
||||
{
|
||||
e.Graphics.FillRectangle(brush,e.ExpandPartBounds);
|
||||
brush.Dispose();
|
||||
}
|
||||
|
||||
Pen pen = GetBorderPen(e);
|
||||
if (pen != null)
|
||||
{
|
||||
e.Graphics.DrawRectangle(pen, e.ExpandPartBounds);
|
||||
pen.Dispose();
|
||||
pen = null;
|
||||
}
|
||||
|
||||
if(e.Node.Expanded)
|
||||
{
|
||||
pen = GetExpandPen(e);
|
||||
if (pen != null)
|
||||
{
|
||||
e.Graphics.DrawLine(pen, e.ExpandPartBounds.X + 2, e.ExpandPartBounds.Y + e.ExpandPartBounds.Height / 2, e.ExpandPartBounds.Right - 2, e.ExpandPartBounds.Y + e.ExpandPartBounds.Height / 2);
|
||||
pen.Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pen = GetExpandPen(e);
|
||||
if (pen != null)
|
||||
{
|
||||
e.Graphics.DrawLine(pen,e.ExpandPartBounds.X+2,e.ExpandPartBounds.Y+e.ExpandPartBounds.Height/2,e.ExpandPartBounds.Right-2,e.ExpandPartBounds.Y+e.ExpandPartBounds.Height/2);
|
||||
e.Graphics.DrawLine(pen,e.ExpandPartBounds.X+e.ExpandPartBounds.Width/2,e.ExpandPartBounds.Y+2,e.ExpandPartBounds.X+e.ExpandPartBounds.Width/2,e.ExpandPartBounds.Bottom-2);
|
||||
pen.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using DevComponents.DotNetBar;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
internal class NodeExpandTriangleDisplay : NodeExpandDisplay
|
||||
{
|
||||
/// <summary>
|
||||
/// Draw triangular type expand button.
|
||||
/// </summary>
|
||||
/// <param name="e">Expand button context information.</param>
|
||||
public override void DrawExpandButton(NodeExpandPartRendererEventArgs e)
|
||||
{
|
||||
if (e.ExpandPartBounds.IsEmpty)
|
||||
return;
|
||||
|
||||
SmoothingMode sm = e.Graphics.SmoothingMode;
|
||||
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
int pw = Dpi.Width5;
|
||||
Rectangle r = new Rectangle(e.ExpandPartBounds.X , e.ExpandPartBounds.Y + (e.ExpandPartBounds.Height - 8) / 2, pw, Dpi.Height8);
|
||||
|
||||
GraphicsPath path = null;
|
||||
if (e.Node.Expanded)
|
||||
{
|
||||
path = new GraphicsPath();
|
||||
path.AddLine(r.X, r.Y + pw, r.X + pw, r.Y);
|
||||
path.AddLine(r.X + pw, r.Y, r.X + pw, r.Y + pw);
|
||||
path.CloseAllFigures();
|
||||
}
|
||||
else
|
||||
{
|
||||
path = new GraphicsPath();
|
||||
path.AddLine(r.X, r.Y, r.X, r.Bottom);
|
||||
path.AddLine(r.X, r.Bottom, r.X + Dpi.Width4, r.Y + r.Height / 2);
|
||||
path.CloseAllFigures();
|
||||
}
|
||||
|
||||
Brush brush = GetBackgroundBrush(e);
|
||||
if (brush != null)
|
||||
{
|
||||
e.Graphics.FillPath(brush, path);
|
||||
brush.Dispose();
|
||||
}
|
||||
|
||||
Pen pen = GetBorderPen(e);
|
||||
if(pen!=null)
|
||||
{
|
||||
e.Graphics.DrawPath(pen, path);
|
||||
pen.Dispose();
|
||||
}
|
||||
e.Graphics.SmoothingMode = sm;
|
||||
if(path!=null) path.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using DevComponents.AdvTree.Layout;
|
||||
using DevComponents.DotNetBar;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
internal class NodeGroupLineDisplay
|
||||
{
|
||||
private static readonly int LineMargin = 4;
|
||||
public void DrawGroupLine(NodeRendererEventArgs e)
|
||||
{
|
||||
Color lineColor = e.Color;
|
||||
Node node = e.Node;
|
||||
|
||||
if (lineColor.IsEmpty || lineColor.A == 0 || node.Cells.Count == 0) return;
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
Rectangle r = node.Bounds;
|
||||
|
||||
Cell lastCell = node.Cells[node.Cells.Count - 1];
|
||||
if (lastCell.CheckBoxVisible && CellLayout.GetCheckBoxHorizontalAlign(lastCell.CheckBoxAlignment, true, eView.Tile) == eHorizontalAlign.Right)
|
||||
{
|
||||
r.Width -= (lastCell.CheckBoxBounds.Right - r.X) + LineMargin;
|
||||
r.X = lastCell.CheckBoxBounds.Right + LineMargin;
|
||||
}
|
||||
else if (!lastCell.ImageBoundsRelative.IsEmpty && CellLayout.GetHorizontalAlign(lastCell.ImageAlignment, true, eView.Tile) == eHorizontalAlign.Right)
|
||||
{
|
||||
r.Width -= (lastCell.ImageBounds.Right - r.X) + LineMargin;
|
||||
r.X = lastCell.ImageBounds.Right + LineMargin;
|
||||
}
|
||||
else if (e.Style.TextAlignment == eStyleTextAlignment.Near)
|
||||
{
|
||||
Rectangle textBounds = lastCell.TextBounds;
|
||||
if (lastCell.TextMarkupBody == null)
|
||||
textBounds.Width = TextDrawing.MeasureString(g, lastCell.Text, e.Style.Font).Width;
|
||||
r.Width -= (textBounds.Right - r.X) + LineMargin;
|
||||
r.X = textBounds.Right + LineMargin;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
using (Pen pen = new Pen(lineColor, 1))
|
||||
{
|
||||
g.DrawLine(pen, r.X, r.Y + r.Height / 2, r.Right, r.Y + r.Height / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for NodeRendererEventArgs.
|
||||
/// </summary>
|
||||
public class NodeRendererEventArgs:EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets reference to Graphics object, canvas node is rendered on.
|
||||
/// </summary>
|
||||
public System.Drawing.Graphics Graphics=null;
|
||||
/// <summary>
|
||||
/// Gets or sets the reference to Node object being rendered.
|
||||
/// </summary>
|
||||
public DevComponents.AdvTree.Node Node=null;
|
||||
/// <summary>
|
||||
/// Gets or sets the absolute node bounds.
|
||||
/// </summary>
|
||||
public Rectangle NodeBounds=Rectangle.Empty;
|
||||
/// <summary>
|
||||
/// Gets or sets the reference to element style for rendered node or cell. Style provided here is the style
|
||||
/// for current node or cell state.
|
||||
/// </summary>
|
||||
public ElementStyle Style=null;
|
||||
/// <summary>
|
||||
/// Gets or sets color that is passed to renderer. May be Color.Empty.
|
||||
/// </summary>
|
||||
public Color Color = Color.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the class.
|
||||
/// </summary>
|
||||
public NodeRendererEventArgs()
|
||||
{
|
||||
}
|
||||
|
||||
public NodeRendererEventArgs(Graphics g, Node node, Rectangle bounds, ElementStyle style)
|
||||
: this(g, node, bounds, style, Color.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public NodeRendererEventArgs(Graphics g, Node node, Rectangle bounds, ElementStyle style, Color color)
|
||||
{
|
||||
this.Graphics = g;
|
||||
this.Node = node;
|
||||
this.NodeBounds = bounds;
|
||||
this.Style = style;
|
||||
this.Color = color;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,190 @@
|
||||
using System.Drawing;
|
||||
using DevComponents.WinForms.Drawing;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Represent class that paints selection around node.
|
||||
/// </summary>
|
||||
internal class NodeSelectionDisplay
|
||||
{
|
||||
public void PaintSelection(SelectionRendererEventArgs info)
|
||||
{
|
||||
if (info.SelectionBoxStyle == eSelectionStyle.HighlightCells)
|
||||
PaintHighlightCellsSelectionStyle(info);
|
||||
else if (info.SelectionBoxStyle == eSelectionStyle.FullRowSelect)
|
||||
PaintFullRowSelectSelectionStyle(info);
|
||||
else if (info.SelectionBoxStyle == eSelectionStyle.NodeMarker)
|
||||
PaintNodeMarkerSelectionStyle(info);
|
||||
|
||||
}
|
||||
|
||||
public void PaintHotTracking(SelectionRendererEventArgs info)
|
||||
{
|
||||
// Full row is just a rectangle with the background...
|
||||
Shape[] fullRowShapes = GetHotTrackingShapes();
|
||||
Graphics g = info.Graphics;
|
||||
Rectangle bounds = info.Bounds;
|
||||
bounds.Width--;
|
||||
bounds.Height--;
|
||||
foreach (Shape shape in fullRowShapes)
|
||||
{
|
||||
shape.Paint(g, bounds);
|
||||
}
|
||||
}
|
||||
|
||||
private void PaintFullRowSelectSelectionStyle(SelectionRendererEventArgs info)
|
||||
{
|
||||
// Full row is just a rectangle with the background...
|
||||
Shape[] fullRowShapes = GetFullRowShapes(info.TreeActive);
|
||||
Graphics g = info.Graphics;
|
||||
Rectangle bounds = info.Bounds;
|
||||
//bounds.Width--;
|
||||
//bounds.Height--;
|
||||
|
||||
foreach (Shape shape in fullRowShapes)
|
||||
{
|
||||
shape.Paint(g, bounds);
|
||||
}
|
||||
}
|
||||
|
||||
Shape[] _FullRowShapes = null;
|
||||
private Shape[] GetFullRowShapes(bool treeActive)
|
||||
{
|
||||
if (_FullRowShapes == null)
|
||||
{
|
||||
_FullRowShapes = new Shape[1];
|
||||
_FullRowShapes[0] = new RectangleShape();
|
||||
}
|
||||
RectangleShape shape = (RectangleShape)_FullRowShapes[0];
|
||||
SelectionColorTable colors = treeActive ? _SelectionColors.FullRowSelect : _SelectionColors.FullRowSelectInactive;
|
||||
shape.Fill = colors.Fill;
|
||||
shape.Border = colors.Border;
|
||||
|
||||
return _FullRowShapes;
|
||||
}
|
||||
|
||||
private void PaintHighlightCellsSelectionStyle(SelectionRendererEventArgs info)
|
||||
{
|
||||
// Full row is just a rectangle with the background...
|
||||
Shape[] fullRowShapes = GetHighlightCellsShapes(info.TreeActive);
|
||||
Graphics g = info.Graphics;
|
||||
Rectangle bounds = info.Bounds;
|
||||
bounds.Width--;
|
||||
bounds.Height--;
|
||||
foreach (Shape shape in fullRowShapes)
|
||||
{
|
||||
shape.Paint(g, bounds);
|
||||
}
|
||||
}
|
||||
|
||||
Shape[] _HighlightCellsShapes = null;
|
||||
private Shape[] GetHighlightCellsShapes(bool treeActive)
|
||||
{
|
||||
SelectionColorTable colorTable = treeActive ? _SelectionColors.HighlightCells : _SelectionColors.HighlightCellsInactive;
|
||||
|
||||
if (_HighlightCellsShapes == null || ((RectangleShape)_HighlightCellsShapes[0]).CornerRadius != null && ((RectangleShape)_HighlightCellsShapes[0]).CornerRadius.TopLeft != colorTable.BorderCornerRadius)
|
||||
{
|
||||
_HighlightCellsShapes = new Shape[1];
|
||||
RectangleShape rectShape = new RectangleShape();
|
||||
if (colorTable.BorderCornerRadius > 0)
|
||||
{
|
||||
rectShape.CornerRadius = new CornerRadius(colorTable.BorderCornerRadius);
|
||||
RectangleShape inner = new RectangleShape();
|
||||
rectShape.Content = inner;
|
||||
}
|
||||
_HighlightCellsShapes[0] = rectShape;
|
||||
}
|
||||
|
||||
RectangleShape shape = (RectangleShape)_HighlightCellsShapes[0];
|
||||
shape.Fill = colorTable.Fill;
|
||||
shape.Border = colorTable.Border;
|
||||
if (shape.Content != null)
|
||||
{
|
||||
shape = (RectangleShape)shape.Content;
|
||||
shape.Border = colorTable.InnerBorder;
|
||||
}
|
||||
|
||||
return _HighlightCellsShapes;
|
||||
}
|
||||
|
||||
Shape[] _HotTrackingShapes = null;
|
||||
private Shape[] GetHotTrackingShapes()
|
||||
{
|
||||
if (_HotTrackingShapes == null)
|
||||
{
|
||||
_HotTrackingShapes = new Shape[1];
|
||||
RectangleShape rectShape = new RectangleShape();
|
||||
rectShape.CornerRadius = new CornerRadius(2);
|
||||
RectangleShape inner = new RectangleShape();
|
||||
//inner.CornerRadius = new CornerRadius(2);
|
||||
rectShape.Content = inner;
|
||||
_HotTrackingShapes[0] = rectShape;
|
||||
}
|
||||
|
||||
SelectionColorTable colorTable = _SelectionColors.NodeHotTracking;
|
||||
RectangleShape shape = (RectangleShape)_HotTrackingShapes[0];
|
||||
shape.Fill = colorTable.Fill;
|
||||
shape.Border = colorTable.Border;
|
||||
shape = (RectangleShape)shape.Content;
|
||||
shape.Border = colorTable.InnerBorder;
|
||||
|
||||
return _HotTrackingShapes;
|
||||
}
|
||||
|
||||
private void PaintNodeMarkerSelectionStyle(SelectionRendererEventArgs info)
|
||||
{
|
||||
Rectangle inside = info.Bounds;
|
||||
int borderWidth = 4;
|
||||
inside.Inflate(1, 1);
|
||||
inside.Width--;
|
||||
inside.Height--;
|
||||
Rectangle outside = info.Bounds;
|
||||
outside.Inflate(borderWidth, borderWidth);
|
||||
outside.Width--;
|
||||
outside.Height--;
|
||||
|
||||
SelectionColorTable colorTable = info.TreeActive ? _SelectionColors.NodeMarker : _SelectionColors.NodeMarkerInactive;
|
||||
|
||||
if (colorTable.Border != null)
|
||||
{
|
||||
Pen pen = colorTable.Border.CreatePen();
|
||||
if (pen != null)
|
||||
{
|
||||
info.Graphics.DrawRectangle(pen, inside);
|
||||
info.Graphics.DrawRectangle(pen, outside);
|
||||
pen.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
if (colorTable.Fill != null)
|
||||
{
|
||||
Brush brush = colorTable.Fill.CreateBrush(outside);
|
||||
if (brush != null)
|
||||
{
|
||||
Region region = new Region(outside);
|
||||
region.Exclude(inside);
|
||||
info.Graphics.FillRegion(brush, region);
|
||||
brush.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TreeSelectionColors _SelectionColors = null;
|
||||
public TreeSelectionColors SelectionColors
|
||||
{
|
||||
get { return _SelectionColors; }
|
||||
set { _SelectionColors = value; }
|
||||
}
|
||||
}
|
||||
|
||||
internal class NodeSelectionDisplayInfo
|
||||
{
|
||||
public Node Node=null;
|
||||
public Graphics Graphics=null;
|
||||
public Rectangle Bounds=Rectangle.Empty;
|
||||
public Color BorderColor=Color.Empty;
|
||||
public Color FillColor=Color.Empty;
|
||||
public int Width=4;
|
||||
}
|
||||
}
|
@@ -0,0 +1,270 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents default system node and cell renderer.
|
||||
/// </summary>
|
||||
public class NodeSystemRenderer:TreeRenderer
|
||||
{
|
||||
#region Private Variables
|
||||
private NodeExpandEllipseDisplay m_NodeExpandEllipseDisplay=new NodeExpandEllipseDisplay();
|
||||
private NodeExpandRectDisplay m_NodeExpandRectDisplay=new NodeExpandRectDisplay();
|
||||
private NodeExpandTriangleDisplay m_NodeExpandTriangleDisplay = new NodeExpandTriangleDisplay();
|
||||
private NodeExpandImageDisplay m_NodeExpandImageDisplay=new NodeExpandImageDisplay();
|
||||
private ElementStyleDisplayInfo m_ElementStyleDisplayInfo=new ElementStyleDisplayInfo();
|
||||
private NodeSelectionDisplay m_SelectionDisplay=new NodeSelectionDisplay();
|
||||
private LineConnectorDisplay m_LineConnectorDisplay=null;
|
||||
private DragDropMarkerDisplay m_DragDropMarkerDisplay = new DragDropMarkerDisplay();
|
||||
private ColumnHeaderDisplay m_ColumnHeaderDisplay = new ColumnHeaderDisplay();
|
||||
private Office2007CheckBoxItemPainter m_CheckBoxPainter = new Office2007CheckBoxItemPainter();
|
||||
private NodeGroupLineDisplay _GroupLineDisplay = new NodeGroupLineDisplay();
|
||||
#endregion
|
||||
|
||||
#region Internal Implementation
|
||||
/// <summary>
|
||||
/// Returns ElementStyleDisplayInfo class that provides information for ElementStyle rendering.
|
||||
/// </summary>
|
||||
/// <param name="style">Reference to style.</param>
|
||||
/// <param name="g">Reference to graphics object.</param>
|
||||
/// <param name="bounds">Style bounds</param>
|
||||
/// <returns>New instance of ElementStyleDisplayInfo</returns>
|
||||
protected ElementStyleDisplayInfo GetElementStyleDisplayInfo(ElementStyle style, Graphics g, Rectangle bounds)
|
||||
{
|
||||
m_ElementStyleDisplayInfo.Style=style;
|
||||
m_ElementStyleDisplayInfo.Graphics=g;
|
||||
m_ElementStyleDisplayInfo.Bounds=bounds;
|
||||
return m_ElementStyleDisplayInfo;
|
||||
}
|
||||
|
||||
private NodeConnectorDisplay GetConnectorDisplay(NodeConnector c)
|
||||
{
|
||||
NodeConnectorDisplay d=null;
|
||||
if(c==null)
|
||||
return null;
|
||||
|
||||
switch(c.ConnectorType)
|
||||
{
|
||||
case eNodeConnectorType.Line:
|
||||
{
|
||||
if(m_LineConnectorDisplay==null)
|
||||
m_LineConnectorDisplay=new LineConnectorDisplay();
|
||||
d=m_LineConnectorDisplay;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws node background. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderNodeBackground method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawNodeBackground(NodeRendererEventArgs e)
|
||||
{
|
||||
ElementStyleDisplayInfo di = GetElementStyleDisplayInfo(e.Style, e.Graphics, e.NodeBounds);
|
||||
ElementStyleDisplay.Paint(di);
|
||||
|
||||
base.DrawNodeBackground(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws node expand part. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderNodeExpandPart method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawNodeExpandPart(NodeExpandPartRendererEventArgs e)
|
||||
{
|
||||
NodeExpandDisplay expandDisplay = GetExpandDisplay(e.ExpandButtonType);
|
||||
expandDisplay.ColorTable = this.ColorTable;
|
||||
expandDisplay.DrawExpandButton(e);
|
||||
expandDisplay.ColorTable = null;
|
||||
base.DrawNodeExpandPart(e);
|
||||
}
|
||||
|
||||
private NodeExpandDisplay GetExpandDisplay(eExpandButtonType e)
|
||||
{
|
||||
NodeExpandDisplay d=null;
|
||||
switch(e)
|
||||
{
|
||||
case eExpandButtonType.Rectangle:
|
||||
d=m_NodeExpandRectDisplay;
|
||||
break;
|
||||
case eExpandButtonType.Triangle:
|
||||
d = m_NodeExpandTriangleDisplay;
|
||||
break;
|
||||
case eExpandButtonType.Ellipse:
|
||||
d = m_NodeExpandEllipseDisplay;
|
||||
break;
|
||||
case eExpandButtonType.Image:
|
||||
d= m_NodeExpandImageDisplay;
|
||||
break;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Draws node command part. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
///// do not want default rendering to occur do not call the base implementation. You can call OnRenderNodeCommandPart method so events can occur.
|
||||
///// </summary>
|
||||
///// <param name="e">Information provided for rendering.</param>
|
||||
//public override void DrawNodeCommandPart(NodeCommandPartRendererEventArgs e)
|
||||
//{
|
||||
// m_NodeCommandDisplay.DrawCommandButton(e);
|
||||
// base.DrawNodeCommandPart(e);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Draws cell background. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellBackground method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawCellBackground(NodeCellRendererEventArgs e)
|
||||
{
|
||||
ElementStyleDisplayInfo di=GetElementStyleDisplayInfo(e.Style,e.Graphics,DisplayHelp.GetDrawRectangle(e.CellBounds));
|
||||
ElementStyleDisplay.Paint(di);
|
||||
|
||||
base.DrawCellBackground(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws cell check box. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellCheckBox method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawCellCheckBox(NodeCellRendererEventArgs e)
|
||||
{
|
||||
CellDisplay.CheckBoxPainter = m_CheckBoxPainter;
|
||||
if (Office2007ColorTable != null)
|
||||
CellDisplay.ColorTable = Office2007ColorTable.CheckBoxItem;
|
||||
CellDisplay.PaintCellCheckBox(e);
|
||||
base.DrawCellCheckBox(e);
|
||||
CellDisplay.CheckBoxPainter = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws cell image. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellImage method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawCellImage(NodeCellRendererEventArgs e)
|
||||
{
|
||||
CellDisplay.PaintCellImage(e);
|
||||
base.DrawCellImage(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws cell text. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellText method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawCellText(NodeCellRendererEventArgs e)
|
||||
{
|
||||
CellDisplay.PaintText(e);
|
||||
base.DrawCellText(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws selection for SelectedNode. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderSelection method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawSelection(SelectionRendererEventArgs e)
|
||||
{
|
||||
m_SelectionDisplay.SelectionColors = ColorTable.Selection;
|
||||
m_SelectionDisplay.PaintSelection(e);
|
||||
base.DrawSelection(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws hot-tracking marker for mouse over node. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderHotTracking method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawHotTracking(SelectionRendererEventArgs e)
|
||||
{
|
||||
m_SelectionDisplay.SelectionColors = ColorTable.Selection;
|
||||
m_SelectionDisplay.PaintHotTracking(e);
|
||||
base.DrawHotTracking(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws connector between nodes. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderConnector method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawConnector(ConnectorRendererEventArgs e)
|
||||
{
|
||||
NodeConnectorDisplay display = GetConnectorDisplay(e.NodeConnector);
|
||||
if(display!=null)
|
||||
display.DrawConnector(e);
|
||||
|
||||
base.DrawConnector(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the tree background. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderTreeBackground method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawTreeBackground(TreeBackgroundRendererEventArgs e)
|
||||
{
|
||||
AdvTree tree = e.AdvTree;
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
if(!tree.BackColor.IsEmpty)
|
||||
{
|
||||
using(SolidBrush brush=new SolidBrush(tree.BackColor))
|
||||
g.FillRectangle(brush,tree.DisplayRectangle);
|
||||
}
|
||||
|
||||
ElementStyleDisplayInfo info=new ElementStyleDisplayInfo();
|
||||
info.Bounds=tree.DisplayRectangle;
|
||||
info.Graphics=g;
|
||||
info.Style=tree.BackgroundStyle;
|
||||
ElementStyleDisplay.Paint(info);
|
||||
|
||||
base.DrawTreeBackground (e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the drag & drop marker that indicates the insertion point for the node. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderDragDropMarker method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawDragDropMarker(DragDropMarkerRendererEventArgs e)
|
||||
{
|
||||
m_DragDropMarkerDisplay.MarkerColor = this.ColorTable.DragDropMarker;
|
||||
m_DragDropMarkerDisplay.DrawMarker(e);
|
||||
base.DrawDragDropMarker(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the column header. If you need to provide custom rendering this is the method that you should override in your custom renderer. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderColumnHeader method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawColumnHeader(ColumnHeaderRendererEventArgs e)
|
||||
{
|
||||
ElementStyleDisplayInfo di = GetElementStyleDisplayInfo(e.Style, e.Graphics, e.Bounds);
|
||||
m_ColumnHeaderDisplay.DrawColumnHeader(e, di);
|
||||
base.DrawColumnHeader(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws node group line when in tile view. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderTileGroupLine method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public override void DrawTileGroupLine(NodeRendererEventArgs e)
|
||||
{
|
||||
_GroupLineDisplay.DrawGroupLine(e);
|
||||
OnRenderTileGroupLine(e);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
1139
PROMS/DotNetBar Source Code/AdvTree/Display/NodeTreeDisplay.cs
Normal file
1139
PROMS/DotNetBar Source Code/AdvTree/Display/NodeTreeDisplay.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using DevComponents.WinForms.Drawing;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the color table for tree selection.
|
||||
/// </summary>
|
||||
public class SelectionColorTable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the outer border for the selection.
|
||||
/// </summary>
|
||||
public Border Border = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the outer border corner radius.
|
||||
/// </summary>
|
||||
public int BorderCornerRadius = 0;
|
||||
/// <summary>
|
||||
/// Gets or sets the inner border for the selection.
|
||||
/// </summary>
|
||||
public Border InnerBorder = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the selection fill.
|
||||
/// </summary>
|
||||
public Fill Fill = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the selection text color.
|
||||
/// </summary>
|
||||
public Color TextColor = Color.Empty;
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.AdvTree
|
||||
{
|
||||
/// <summary>
|
||||
/// Data form RenderSelection event.
|
||||
/// </summary>
|
||||
public class SelectionRendererEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets reference to Graphics object, canvas node is rendered on.
|
||||
/// </summary>
|
||||
public System.Drawing.Graphics Graphics=null;
|
||||
/// <summary>
|
||||
/// Gets or sets the reference to selected Node object.
|
||||
/// </summary>
|
||||
public DevComponents.AdvTree.Node Node=null;
|
||||
/// <summary>
|
||||
/// Gets or sets the selection bounds.
|
||||
/// </summary>
|
||||
public Rectangle Bounds=Rectangle.Empty;
|
||||
/// <summary>
|
||||
/// Gets or sets the node selection box style.
|
||||
/// </summary>
|
||||
public eSelectionStyle SelectionBoxStyle = eSelectionStyle.HighlightCells;
|
||||
/// <summary>
|
||||
/// Gets or sets whether tree control is active, focused.
|
||||
/// </summary>
|
||||
public bool TreeActive = false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides data for tree background rendering events.
|
||||
/// </summary>
|
||||
public class TreeBackgroundRendererEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets reference to Graphics object, canvas tree background is rendered on.
|
||||
/// </summary>
|
||||
public System.Drawing.Graphics Graphics=null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference to AdvTree control.
|
||||
/// </summary>
|
||||
public AdvTree AdvTree = null;
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the class and initializes it with default values.
|
||||
/// </summary>
|
||||
/// <param name="g">Reference to graphics object.</param>
|
||||
public TreeBackgroundRendererEventArgs(Graphics g, AdvTree tree)
|
||||
{
|
||||
this.Graphics = g;
|
||||
this.AdvTree = tree;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the Tree color table.
|
||||
/// </summary>
|
||||
[ToolboxItem(false)]
|
||||
public class TreeColorTable : Component
|
||||
{
|
||||
#region Internal Implementation
|
||||
/// <summary>
|
||||
/// Gets or sets the color table used for the node selection display.
|
||||
/// </summary>
|
||||
public TreeSelectionColors Selection = new TreeSelectionColors();
|
||||
/// <summary>
|
||||
/// Gets or sets the color for node drag & drop marker.
|
||||
/// </summary>
|
||||
public Color DragDropMarker = Color.Black;
|
||||
/// <summary>
|
||||
/// Gets or sets the color of tree expand button type of rectangle.
|
||||
/// </summary>
|
||||
public TreeExpandColorTable ExpandRectangle = new TreeExpandColorTable();
|
||||
/// <summary>
|
||||
/// Gets or sets the color of tree expand button type of Ellipse.
|
||||
/// </summary>
|
||||
public TreeExpandColorTable ExpandEllipse = new TreeExpandColorTable();
|
||||
/// <summary>
|
||||
/// Gets or sets the color of tree expand button type of Triangle.
|
||||
/// </summary>
|
||||
public TreeExpandColorTable ExpandTriangle = new TreeExpandColorTable();
|
||||
/// <summary>
|
||||
/// Gets or sets the color for tree grid lines.
|
||||
/// </summary>
|
||||
public Color GridLines = Color.Empty;
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the column sort indicator which is rendered on columns when sorted.
|
||||
/// </summary>
|
||||
public Color ColumnSortIndicatorColor = Color.Gray;
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using DevComponents.WinForms.Drawing;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the color table for node expand button.
|
||||
/// </summary>
|
||||
public class TreeExpandColorTable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the border for the expand button which expands the node.
|
||||
/// </summary>
|
||||
public Border ExpandBorder = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the expand button fill for button that expands the node.
|
||||
/// </summary>
|
||||
public Fill ExpandFill = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the expand button foreground for button that expands the node.
|
||||
/// </summary>
|
||||
public Fill ExpandForeground = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the border for the expand button which expands the node.
|
||||
/// </summary>
|
||||
public Border ExpandMouseOverBorder = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the expand button fill for button that expands the node.
|
||||
/// </summary>
|
||||
public Fill ExpandMouseOverFill = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the expand button foreground for button that expands the node.
|
||||
/// </summary>
|
||||
public Fill ExpandMouseOverForeground = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the border for the expand button which collapses the node.
|
||||
/// </summary>
|
||||
public Border CollapseBorder = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the expand button fill for button that collapses the node.
|
||||
/// </summary>
|
||||
public Fill CollapseFill = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the expand button foreground for button that expands the node.
|
||||
/// </summary>
|
||||
public Fill CollapseForeground = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the border for the expand button which collapses the node.
|
||||
/// </summary>
|
||||
public Border CollapseMouseOverBorder = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the expand button fill for button that collapses the node.
|
||||
/// </summary>
|
||||
public Fill CollapseMouseOverFill = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the expand button foreground for button that expands the node.
|
||||
/// </summary>
|
||||
public Fill CollapseMouseOverForeground = null;
|
||||
}
|
||||
}
|
386
PROMS/DotNetBar Source Code/AdvTree/Display/TreeRenderer.cs
Normal file
386
PROMS/DotNetBar Source Code/AdvTree/Display/TreeRenderer.cs
Normal file
@@ -0,0 +1,386 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents abstract renderer class for node objects.
|
||||
/// </summary>
|
||||
public abstract class TreeRenderer
|
||||
{
|
||||
#region Events
|
||||
/// <summary>
|
||||
/// Occurs when node background is being drawn.
|
||||
/// </summary>
|
||||
public event NodeRendererEventHandler RenderNodeBackground;
|
||||
/// <summary>
|
||||
/// Occurs when node expand part is being drawn.
|
||||
/// </summary>
|
||||
public event NodeExpandPartRendererEventHandler RenderNodeExpandPart;
|
||||
///// <summary>
|
||||
///// Occurs when node command part is being drawn.
|
||||
///// </summary>
|
||||
//public event NodeCommandPartRendererEventHandler RenderNodeCommandPart;
|
||||
/// <summary>
|
||||
/// Occurs when cell background is being drawn.
|
||||
/// </summary>
|
||||
public event NodeCellRendererEventHandler RenderCellBackground;
|
||||
/// <summary>
|
||||
/// Occurs when cell check-box is being drawn.
|
||||
/// </summary>
|
||||
public event NodeCellRendererEventHandler RenderCellCheckBox;
|
||||
/// <summary>
|
||||
/// Occurs when cell image is being drawn.
|
||||
/// </summary>
|
||||
public event NodeCellRendererEventHandler RenderCellImage;
|
||||
/// <summary>
|
||||
/// Occurs when cell text is being drawn.
|
||||
/// </summary>
|
||||
public event NodeCellRendererEventHandler RenderCellText;
|
||||
/// <summary>
|
||||
/// Occurs when node selection marker is rendered.
|
||||
/// </summary>
|
||||
public event SelectionRendererEventHandler RenderSelection;
|
||||
/// <summary>
|
||||
/// Occurs when node hot-tracking marker is rendered.
|
||||
/// </summary>
|
||||
public event SelectionRendererEventHandler RenderHotTracking;
|
||||
/// <summary>
|
||||
/// Occurs when node connector is being drawn.
|
||||
/// </summary>
|
||||
public event ConnectorRendererEventHandler RenderConnector;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when tree background is rendered.
|
||||
/// </summary>
|
||||
public event TreeBackgroundRendererEventHandler RenderTreeBackground;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when drag & drop marker is rendered.
|
||||
/// </summary>
|
||||
public event DragDropMarkerRendererEventHandler RenderDragDropMarker;
|
||||
/// <summary>
|
||||
/// Renders the Column Header.
|
||||
/// </summary>
|
||||
public event ColumnHeaderRendererEventHandler RenderColumnHeader;
|
||||
/// <summary>
|
||||
/// Occurs when node group line is being rendered while control is in tile view.
|
||||
/// </summary>
|
||||
public event NodeRendererEventHandler RenderTileGroupLine;
|
||||
#endregion
|
||||
|
||||
#region Private Variables
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
public TreeRenderer()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Internal Implementation
|
||||
/// <summary>
|
||||
/// Draws node background. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderNodeBackground method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawNodeBackground(NodeRendererEventArgs e)
|
||||
{
|
||||
OnRenderNodeBackground(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderNodeBackground event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments.</param>
|
||||
protected virtual void OnRenderNodeBackground(NodeRendererEventArgs e)
|
||||
{
|
||||
if(RenderNodeBackground!=null)
|
||||
RenderNodeBackground(this,e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws node expand part. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderNodeExpandPart method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawNodeExpandPart(NodeExpandPartRendererEventArgs e)
|
||||
{
|
||||
OnRenderNodeExpandPart(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderNodeExpandPart event.
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected virtual void OnRenderNodeExpandPart(NodeExpandPartRendererEventArgs e)
|
||||
{
|
||||
if(RenderNodeExpandPart!=null)
|
||||
RenderNodeExpandPart(this,e);
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Draws node command part. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
///// do not want default rendering to occur do not call the base implementation. You can call OnRenderNodeCommandPart method so events can occur.
|
||||
///// </summary>
|
||||
///// <param name="e">Information provided for rendering.</param>
|
||||
//public virtual void DrawNodeCommandPart(NodeCommandPartRendererEventArgs e)
|
||||
//{
|
||||
// OnRenderNodeCommandPart(e);
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Raises RenderNodeCommandPart event.
|
||||
///// </summary>
|
||||
///// <param name="e">Event arguments.</param>
|
||||
//protected virtual void OnRenderNodeCommandPart(NodeCommandPartRendererEventArgs e)
|
||||
//{
|
||||
// if(RenderNodeCommandPart!=null)
|
||||
// RenderNodeCommandPart(this,e);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Draws cell background. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellBackground method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawCellBackground(NodeCellRendererEventArgs e)
|
||||
{
|
||||
OnRenderCellBackground(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderCellBackground event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnRenderCellBackground(NodeCellRendererEventArgs e)
|
||||
{
|
||||
if(RenderCellBackground!=null)
|
||||
RenderCellBackground(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws cell check box. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellCheckBox method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawCellCheckBox(NodeCellRendererEventArgs e)
|
||||
{
|
||||
OnRenderCellCheckBox(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderCellCheckBox event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnRenderCellCheckBox(NodeCellRendererEventArgs e)
|
||||
{
|
||||
if(RenderCellCheckBox!=null)
|
||||
RenderCellCheckBox(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws cell image. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellImage method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawCellImage(NodeCellRendererEventArgs e)
|
||||
{
|
||||
OnRenderCellImage(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderCellImage event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnRenderCellImage(NodeCellRendererEventArgs e)
|
||||
{
|
||||
if(RenderCellImage!=null)
|
||||
RenderCellImage(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws cell text. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellText method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawCellText(NodeCellRendererEventArgs e)
|
||||
{
|
||||
OnRenderCellText(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderCellImage event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnRenderCellText(NodeCellRendererEventArgs e)
|
||||
{
|
||||
if(RenderCellText!=null)
|
||||
RenderCellText(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws selection for SelectedNode. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderSelection method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawSelection(SelectionRendererEventArgs e)
|
||||
{
|
||||
OnRenderSelection(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderSelection event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event data.</param>
|
||||
protected virtual void OnRenderSelection(SelectionRendererEventArgs e)
|
||||
{
|
||||
if(RenderSelection!=null)
|
||||
RenderSelection(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws hot-tracking marker for mouse over node. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderHotTracking method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawHotTracking(SelectionRendererEventArgs e)
|
||||
{
|
||||
OnRenderHotTracking(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderHotTracking event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event data.</param>
|
||||
protected virtual void OnRenderHotTracking(SelectionRendererEventArgs e)
|
||||
{
|
||||
if (RenderHotTracking != null)
|
||||
RenderHotTracking(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws connector between nodes. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderConnector method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawConnector(ConnectorRendererEventArgs e)
|
||||
{
|
||||
OnRenderConnector(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderConnector event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event data.</param>
|
||||
protected virtual void OnRenderConnector(ConnectorRendererEventArgs e)
|
||||
{
|
||||
if(RenderConnector!=null)
|
||||
RenderConnector(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the tree background. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderTreeBackground method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawTreeBackground(TreeBackgroundRendererEventArgs e)
|
||||
{
|
||||
OnRenderTreeBackground(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderTreeBackground event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event data.</param>
|
||||
protected virtual void OnRenderTreeBackground(TreeBackgroundRendererEventArgs e)
|
||||
{
|
||||
if(RenderTreeBackground!=null)
|
||||
RenderTreeBackground(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the drag & drop marker that indicates the insertion point for the node. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderDragDropMarker method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawDragDropMarker(DragDropMarkerRendererEventArgs e)
|
||||
{
|
||||
OnRenderDragDropMarker(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderDragDropMarker event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event data.</param>
|
||||
protected virtual void OnRenderDragDropMarker(DragDropMarkerRendererEventArgs e)
|
||||
{
|
||||
if (RenderDragDropMarker != null)
|
||||
RenderDragDropMarker(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the column header. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderColumnHeader method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawColumnHeader(ColumnHeaderRendererEventArgs e)
|
||||
{
|
||||
OnRenderColumnHeader(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderDragDropMarker event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event data.</param>
|
||||
protected virtual void OnRenderColumnHeader(ColumnHeaderRendererEventArgs e)
|
||||
{
|
||||
if (RenderColumnHeader != null)
|
||||
RenderColumnHeader(this, e);
|
||||
}
|
||||
|
||||
private TreeColorTable _ColorTable = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the color table used by the renderer.
|
||||
/// </summary>
|
||||
public TreeColorTable ColorTable
|
||||
{
|
||||
get { return _ColorTable; }
|
||||
set { _ColorTable = value; }
|
||||
}
|
||||
|
||||
private Office2007ColorTable _Office2007ColorTable = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the color table used by the renderer.
|
||||
/// </summary>
|
||||
internal Office2007ColorTable Office2007ColorTable
|
||||
{
|
||||
get { return _Office2007ColorTable; }
|
||||
set { _Office2007ColorTable = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws node group line when in tile view. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
|
||||
/// do not want default rendering to occur do not call the base implementation. You can call OnRenderTileGroupLine method so events can occur.
|
||||
/// </summary>
|
||||
/// <param name="e">Information provided for rendering.</param>
|
||||
public virtual void DrawTileGroupLine(NodeRendererEventArgs e)
|
||||
{
|
||||
OnRenderTileGroupLine(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises RenderNodeBackground event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments.</param>
|
||||
protected virtual void OnRenderTileGroupLine(NodeRendererEventArgs e)
|
||||
{
|
||||
if (RenderTileGroupLine != null)
|
||||
RenderTileGroupLine(this, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace DevComponents.AdvTree.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the color table for tree selection.
|
||||
/// </summary>
|
||||
public class TreeSelectionColors
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the color table for FullRowSelect selection type.
|
||||
/// </summary>
|
||||
public SelectionColorTable FullRowSelect = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the color table for FullRowSelect selection type when tree control is inactive.
|
||||
/// </summary>
|
||||
public SelectionColorTable FullRowSelectInactive = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the color table for HighlightCells selection type.
|
||||
/// </summary>
|
||||
public SelectionColorTable HighlightCells = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the color table for HighlightCells selection type when tree control is inactive.
|
||||
/// </summary>
|
||||
public SelectionColorTable HighlightCellsInactive = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the color table for NodeMarker selection type.
|
||||
/// </summary>
|
||||
public SelectionColorTable NodeMarker = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the color table for NodeMarker selection type when tree control is inactive.
|
||||
/// </summary>
|
||||
public SelectionColorTable NodeMarkerInactive = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the color table used for node hot-tracking.
|
||||
/// </summary>
|
||||
public SelectionColorTable NodeHotTracking = null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user