Esempio n. 1
0
        public void EndLoad()
        {
            LB.ResumeLayout();
            LB.Sorted   = true;
            LB.DrawMode = DrawMode.OwnerDrawFixed;

            //set height
            Height = 0;
            if (LB.Items.Count > 10)
            {
                Height = LB.ItemHeight * 11 + 12;
            }
            else
            {
                Height = LB.ItemHeight * (LB.Items.Count) + 12;
            }
            int      max = 0;
            Graphics g   = LB.CreateGraphics();

            foreach (ListItem li in LB.Items)
            {
                int w = (int)g.MeasureString(li.Text, LB.Font).Width + 45;
                if (w > max)
                {
                    max = w;
                }
            }
            Width = max + SystemInformation.VerticalScrollBarWidth;
            Refresh();
            g.Dispose();
        }