Beispiel #1
0
        private void ArrangeTree()
        {
            using (Graphics gr = treePictureBox.CreateGraphics())
            {
                // Arrange the tree once to see how big it is.
                float xmin = 0, ymin = 10;
                Root.Arrange(gr, treePictureBox.Font, ref xmin, ref ymin);

                // Translate the tree to center it.
                float dx = (treePictureBox.ClientSize.Width - xmin) / 2f;
                Root.Translate(dx, 0);
            }

            treePictureBox.Refresh();
        }