Exemple #1
0
		/// <summary>
		/// Gets the color alpha part depending on the type of rendering and the node
		/// </summary>
		/// <param name="oNode">Node to get the alpha</param>
		/// <returns>Alpha part of the color</returns>
		internal int GetNodeAlpha(Node oNode)
		{
			int nAlpha = 255;

			if (oNode.GetHighlightSelectedPath() == false)
				return nAlpha;

			if (IsDesignMode == true)
				return nAlpha;

			if (m_bFocus == false)
			{
				if (oNode.IsInSelectedPath() == false)
					return nAlpha = 100;

				if (SelectedNode == null)
					nAlpha = 100;
			}

			return nAlpha;
		}
Exemple #2
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();
			}
		}