Click here to Skip to main content
15,898,134 members
Home / Discussions / C#
   

C#

 
QuestionThread sychronization Pin
koleraba12-Feb-10 2:35
koleraba12-Feb-10 2:35 
AnswerRe: Hi Pin
Not Active12-Feb-10 4:07
mentorNot Active12-Feb-10 4:07 
GeneralRe: Hi Pin
koleraba12-Feb-10 5:31
koleraba12-Feb-10 5:31 
QuestionAppDomain Pin
Le centriste12-Feb-10 2:10
Le centriste12-Feb-10 2:10 
AnswerRe: AppDomain Pin
dan!sh 12-Feb-10 3:25
professional dan!sh 12-Feb-10 3:25 
GeneralRe: AppDomain Pin
Le centriste12-Feb-10 3:32
Le centriste12-Feb-10 3:32 
AnswerRe: AppDomain Pin
kevinnicol12-Feb-10 5:26
kevinnicol12-Feb-10 5:26 
QuestionTree view drawing problem Pin
gwithey11-Feb-10 23:32
gwithey11-Feb-10 23:32 
Hi i am trying to write a tree view control however have come accross difficulty in drawing the vertical lines.

The bellow method currently works by fining the cumulative height of the last branch it was in and then calls AmountToDeduct(nodes[i].Nodes) to reduce this to the correct height for the next line.

However this is very slow. Does anyone know a way i can simply not add nodeheight to the newLineFinishPoint if it is not needed apposed to taking away from the total heigh.

private Point PositionNodes(List<Node> nodes, Point point)
      {
         // Create new start point for downwards line
         Point newStartPoint = new Point();
         Point newFinishPoint = new Point();
         newStartPoint = point;

         int nodeHeight = nodes[0].Size.Height;

         // Loop nodes
         for(int i = 0; i < nodes.Count; i++)
         {
            // Set node location and draw
            nodes[i].Location = point;

            // Increase Y by one line
            point.Y += nodeHeight;

            // If node has child nodes
            if (nodes[i].Nodes.Count > 0 && nodes[i].Expanded)
            {
               // Call method again on child nodes
               point.Y = PositionNodes(nodes[i].Nodes, new Point(point.X + m_xIndentation, point.Y)).Y;
            }

            // Set finishing point of line
            newFinishPoint = point;
            newFinishPoint.Y -= (int)(nodes[0].Size.Height * 0.5);

            // If node has only one child and is expanded reduce line by this amount
            if (nodes.Count == 1 && nodes[i].Expanded)
            {
               // Reduce line by child nodes amount
               newFinishPoint.Y -= AmountToDeduct(nodes[i].Nodes);
            }

            // Add points to list
            m_linePoints.Add(newStartPoint);
            m_linePoints.Add(newFinishPoint);
         }

         // Cumulative height of nodes
         return point;
      }


Thanks in advance
QuestionText Files Pin
muka6611-Feb-10 23:30
muka6611-Feb-10 23:30 
JokeRe: Text Files Pin
Richard MacCutchan11-Feb-10 23:31
mveRichard MacCutchan11-Feb-10 23:31 
GeneralRe: Text Files Pin
muka6611-Feb-10 23:33
muka6611-Feb-10 23:33 
GeneralRe: Text Files Pin
Richard MacCutchan12-Feb-10 0:11
mveRichard MacCutchan12-Feb-10 0:11 
AnswerRe: Text Files Pin
Anurag Gandhi11-Feb-10 23:49
professionalAnurag Gandhi11-Feb-10 23:49 
AnswerRe: Text Files Pin
OriginalGriff11-Feb-10 23:50
mveOriginalGriff11-Feb-10 23:50 
GeneralRe: Text Files Pin
muka6612-Feb-10 1:56
muka6612-Feb-10 1:56 
GeneralRe: Text Files Pin
ddecoy12-Feb-10 2:05
ddecoy12-Feb-10 2:05 
GeneralRe: Text Files Pin
muka6612-Feb-10 2:44
muka6612-Feb-10 2:44 
GeneralRe: Text Files Pin
harold aptroot12-Feb-10 2:07
harold aptroot12-Feb-10 2:07 
GeneralRe: Text Files Pin
daveyerwin12-Feb-10 2:22
daveyerwin12-Feb-10 2:22 
GeneralRe: Text Files Pin
muka6612-Feb-10 2:46
muka6612-Feb-10 2:46 
GeneralRe: Text Files Pin
OriginalGriff12-Feb-10 4:58
mveOriginalGriff12-Feb-10 4:58 
GeneralRe: Text Files Pin
muka6614-Feb-10 22:42
muka6614-Feb-10 22:42 
QuestionLoooping through DataSet with threads but locking Pin
Danpeking11-Feb-10 22:39
Danpeking11-Feb-10 22:39 
AnswerRe: Loooping through DataSet with threads but locking Pin
OriginalGriff11-Feb-10 22:43
mveOriginalGriff11-Feb-10 22:43 
GeneralRe: Loooping through DataSet with threads but locking Pin
Danpeking11-Feb-10 23:38
Danpeking11-Feb-10 23:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.