Ejemplo n.º 1
0
        private void detailList_MeasureItem(object sender, System.Windows.Forms.MeasureItemEventArgs e)
        {
            TestResultItem item = (TestResultItem)detailList.Items[e.Index];
            //string s = item.ToString();
            SizeF size = this.WordWrap
                                ? e.Graphics.MeasureString(item.ToString(), detailList.Font, detailList.ClientSize.Width)
                                : e.Graphics.MeasureString(item.ToString(), detailList.Font);

            e.ItemHeight = (int)size.Height;
            e.ItemWidth  = (int)size.Width;
        }
Ejemplo n.º 2
0
 private void detailList_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
 {
     if (e.Index >= 0)
     {
         e.DrawBackground();
         TestResultItem item       = (TestResultItem)detailList.Items[e.Index];
         bool           selected   = ((e.State & DrawItemState.Selected) == DrawItemState.Selected) ? true : false;
         Brush          brush      = selected ? SystemBrushes.HighlightText : SystemBrushes.WindowText;
         RectangleF     layoutRect = e.Bounds;
         if (this.WordWrap && layoutRect.Width > detailList.ClientSize.Width)
         {
             layoutRect.Width = detailList.ClientSize.Width;
         }
         e.Graphics.DrawString(item.ToString(), detailList.Font, brush, layoutRect);
     }
 }