C# WinForm 控件美化之改变ListView Head 的背景色

// 需要设置ListView的OwnerDraw属性为 true        

        // 用以改变标题的颜色
        private void listView_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
        {
            e.Graphics.FillRectangle(new SolidBrush(Color.Red), e.Bounds);
            e.DrawText();
        }

        private void listView_DrawItem(object sender, DrawListViewItemEventArgs e)
        {
            e.DrawDefault = true;
        }

 

posted @ 2022-10-10 17:06  txwtech  阅读(396)  评论(0编辑  收藏  举报