Exemple #1
0
		/// <summary>
		/// Paint the node's lines
		/// </summary>		
		private void PaintNodeLines(Node oNode, Graphics oGraphics, int nX, int nY, Hashtable mapItemBoxToRect, Hashtable m_mapSubItemToRect)
		{
			if (oNode.GetShowLines() == true && oNode.Parent != null)
			{
				int nAlpha = oNode.TreeView.GetNodeAlpha(oNode);
				int nNXAdd = 0;

				//if (oNode.GetShowPlusMinus() == false)
				//	nNXAdd = -1;

				if (oNode.GetTreeView().Style.ShowPlusMinus && oNode.ShowPlusMinus == false)
					nNXAdd = 0;

				if (oNode.IndentLevel != 0)
					nNXAdd -= m_oTreeView.Style.NodeSpaceHorizontal;

				Pen oPen = null;
				if (oNode.Flash == true)
					nAlpha = 255;

				oPen = new Pen(Color.FromArgb(nAlpha, oNode.GetLineColor()), 1);
				oPen.DashStyle = TreeView.GetLineStyle(oNode.GetLineStyle());

				if (oNode.m_nCollectionOrder != 0 && oNode.Flash == false && oNode.IsInSelectedPath() == false)
				{
					Node oPrevNode = null;
					
					foreach (Node oTestNode in oNode.Collection)
					{
						if (oTestNode.m_nCollectionOrder == oNode.m_nCollectionOrder - 1)
						{
							oPrevNode = oTestNode;
							break;
						}
					}

					if (oPrevNode != null)
					{
						// prev node rect
						object oRect = mapItemBoxToRect[oPrevNode];

						if (oNode.GetTreeView().Sorted == false)
							oRect = mapItemBoxToRect[oNode.Parent];

						if (oRect != null)
						{
							Rectangle oParentRect = (Rectangle)oRect;

							oGraphics.DrawLine(oPen, nX - 19 + nNXAdd, nY + 7, nX - 14 + nNXAdd + m_oTreeView.Style.NodeSpaceHorizontal, nY + 7);

							if (oNode.GetTreeView().Sorted == true)
								oParentRect.Y -= 6;

							if ((oNode.IsInSelectedPath() && oNode.GetHighlightSelectedPath() == true) || oNode.IsLastInCollection() || oNode.GetTreeView().Sorted == true)
								oGraphics.DrawLine(oPen, nX - 19 + nNXAdd, oParentRect.Y + 13, nX - 19 + nNXAdd, nY + 7);
						}
					}
					else
					{
						// parent rect
						object oRect = mapItemBoxToRect[oNode.Parent];

						if (oRect != null)
						{
							Rectangle oParentRect = (Rectangle)oRect;

							oGraphics.DrawLine(oPen, nX - 19 + nNXAdd, nY + 7, nX - 14 + nNXAdd + m_oTreeView.Style.NodeSpaceHorizontal, nY + 7);

							if ((oNode.IsInSelectedPath() && oNode.GetHighlightSelectedPath() == true) || oNode.IsLastInCollection() || oNode.GetTreeView().Sorted == true)
								oGraphics.DrawLine(oPen, nX - 19 + nNXAdd, oParentRect.Y + 13, nX - 19 + nNXAdd, nY + 7);
						}
					}
				}
				else
				{
					// parent rect
					object oRect = mapItemBoxToRect[oNode.Parent];

					if (oRect != null)
					{
						Rectangle oParentRect = (Rectangle)oRect;

						oGraphics.DrawLine(oPen, nX - 19 + nNXAdd, nY + 7, nX - 14 + nNXAdd + m_oTreeView.Style.NodeSpaceHorizontal, nY + 7);

						if (oNode.GetShowPlusMinus() == false)
						{					
							oRect = m_mapSubItemToRect[oNode.Parent];

							if (oRect == null)
							{
								if ((oNode.IsInSelectedPath() && oNode.GetHighlightSelectedPath() == true) || oNode.IsLastInCollection() || oNode.GetTreeView().Sorted == true)
									oGraphics.DrawLine(oPen, nX - 19 + nNXAdd, oParentRect.Y + 13, nX - 19 + nNXAdd, nY + 7);
							}
							else
							{			
								oParentRect =  (Rectangle)oRect;	
								if ((oNode.IsInSelectedPath() && oNode.GetHighlightSelectedPath() == true) || oNode.IsLastInCollection() || oNode.GetTreeView().Sorted == true)
									oGraphics.DrawLine(oPen, nX - 19 + nNXAdd, oParentRect.Y + 13, nX - 19 + nNXAdd, nY + 7);
							}
						}
						else
						{
							if ((oNode.IsInSelectedPath() && oNode.GetHighlightSelectedPath() == true) || oNode.IsLastInCollection() || oNode.GetTreeView().Sorted == true)
								oGraphics.DrawLine(oPen, nX - 19 + nNXAdd, oParentRect.Y + 13, nX - 19 + nNXAdd, nY + 7);						
						}
					}
				}

				oPen.Dispose();
			}
		}
Exemple #2
0
		/// <summary>
		/// Paints the line from the node to its parent
		/// </summary>
		/// <param name="oNode"></param>
		/// <param name="oGraphics"></param>
		private void PaintNodeFlashLine(Node oNode, Graphics oGraphics)
		{
			if (oNode.Parent == null)
				return;

			int nNXAdd = 0;

			//if (oNode.GetShowPlusMinus() == false)
			//	nNXAdd = -1;

			Pen oPen = null;
			int nAlpha = 255;

			oPen = new Pen(Color.FromArgb(nAlpha, oNode.GetLineColor()), 1);
			oPen.DashStyle = TreeView.GetLineStyle(oNode.GetLineStyle());

			Rectangle nodeRect = m_oTreeView.GetExpandBoxRect(oNode);
			Rectangle parentRect = m_oTreeView.GetExpandBoxRect(oNode.Parent);

			int nX = nodeRect.Right + 2;
			int nY = nodeRect.Top - 2;

			oGraphics.DrawLine(oPen, nX - 19 + nNXAdd, nY + 7, nX - 14 + nNXAdd, nY + 7);
			oGraphics.DrawLine(oPen, nX - 19 + nNXAdd, parentRect.Y + 12, nX - 19 + nNXAdd, nY + 7);

			if (oNode.Parent.Parent != null)
				PaintNodeFlashLine(oNode.Parent, oGraphics);
		}