1、找到listbox的属性修改“DrawMode”为“OwerDrawVariable”;修改“ItemHeight”的值为你要设置的每列的高度,图中设置为“20”

C#中listBox修改每项的高度

2、点击“事件”C#中listBox修改每项的高度找到“DrawItem”双击进入cs文件的代码块,编写代码设置每列的属性:C#中listBox修改每项的高度

private void lb_log_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();
            e.DrawFocusRectangle();
            e.Graphics.DrawString(lb_log.Items[e.Index].ToString(), e.Font, new SolidBrush(Color.Black), e.Bounds);
        }

相关文章:

  • 2022-12-23
  • 2022-01-06
  • 2021-08-18
  • 2021-09-12
  • 2021-11-18
  • 2021-07-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2022-12-23
  • 2021-11-16
  • 2021-10-30
相关资源
相似解决方案