using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using DevComponents.Tree.Display;
namespace DevComponents.Tree.Display
{
///
/// Represents the line connector display class.
///
public class LineConnectorDisplay:NodeConnectorDisplay
{
///
/// Draws connector line between two nodes.
///
/// Connector context information.
public override void DrawConnector(ConnectorRendererEventArgs info)
{
if(info.NodeConnector.LineColor.IsEmpty || info.NodeConnector.LineWidth<=0)
return;
DrawStarConnector(info);
}
private void DrawStarConnector(ConnectorRendererEventArgs info)
{
Point pStart=this.GetStartPoint(info);
Point[] parr=this.GetEndPoint(info);
Point pEnd=parr[0];
Point pEndUnderLine=parr[1];
if(info.ConnectorPoints==null)
{
// Determine whether curve can be drawn
if(Math.Abs(pStart.X-pEnd.X)<=6 || Math.Abs(pStart.Y-pEnd.Y)<=10)
{
DrawLineConnector(info,pStart,pEnd,pEndUnderLine);
}
else
{
Point pBottom=new Point();
Point pTop=new Point();
if(pEnd.X