C# WinForm控件美化扩展系列之ListView

上传者: csdsuper | 上传时间: 2021-07-16 12:00:10 | 文件大小: 161KB | 文件类型: RAR
c#
前面的一篇文章C# WinForm控件美化扩展系列之ListView(2)中,存在列表项文本错乱的问题,这是因为绘制文本的时候不小心选错了一个属性,把SubItem选成了Item,所以总会得到了第一项的文本。除了修正这个错误外,对列表项选中后的背景画法进行了改变,使得选中的列表项不在是每个子项都有一个矩形边框,而是全部只有一个矩形边框。另外,实现了对ListView的边框的重绘,可以轻易的更换边框颜色。 如下: private void WmNcPaint(ref Message m) { base.WndProc(ref m); if (base.BorderStyle == BorderStyle.None) { return; } IntPtr hDC = NativeMethods.GetWindowDC(m.HWnd); if (hDC == IntPtr.Zero) { throw new Win32Exception(); } try { Color backColor = BackColor; Color borderColor = _borderColor; Rectangle bounds = new Rectangle(0, 0, Width, Height); using (Graphics g = Graphics.FromHdc(hDC)) { using (Region region = new Region(bounds)) { region.Exclude(AbsoluteClientRectangle); using (Brush brush = new SolidBrush(backColor)) { g.FillRegion(brush, region); } } ControlPaint.DrawBorder( g, bounds, borderColor, ButtonBorderStyle.Solid); } } finally { NativeMethods.ReleaseDC(m.HWnd, hDC); } m.Result = IntPtr.Zero; }

文件下载

资源详情

[{"title":"( 43 个子文件 161KB ) C# WinForm控件美化扩展系列之ListView","children":[{"title":"ListViewExDemo-2","children":[{"title":"ListViewEx","children":[{"title":"bin","children":[{"title":"Debug","children":[{"title":"ListViewEx.dll <span style='color:#111;'> 32.00KB </span>","children":null,"spread":false},{"title":"ListViewEx.pdb <span style='color:#111;'> 37.50KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"obj","children":[{"title":"ListViewEx.csproj.FileList.txt <span style='color:#111;'> 250B </span>","children":null,"spread":false},{"title":"Debug","children":[{"title":"CSharpWin.Properties.Resources.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"ListViewEx.dll <span style='color:#111;'> 32.00KB </span>","children":null,"spread":false},{"title":"ListViewEx.csproj.GenerateResource.Cache <span style='color:#111;'> 784B </span>","children":null,"spread":false},{"title":"Refactor","children":null,"spread":false},{"title":"ListViewEx.pdb <span style='color:#111;'> 37.50KB </span>","children":null,"spread":false},{"title":"TempPE","children":[{"title":"Properties.Resources.Designer.cs.dll <span style='color:#111;'> 4.50KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true},{"title":"Properties","children":[{"title":"Resources.Designer.cs <span style='color:#111;'> 2.77KB </span>","children":null,"spread":false},{"title":"Settings.settings <span style='color:#111;'> 249B </span>","children":null,"spread":false},{"title":"Resources.resx <span style='color:#111;'> 5.48KB </span>","children":null,"spread":false},{"title":"Settings.Designer.cs <span style='color:#111;'> 1.08KB </span>","children":null,"spread":false},{"title":"AssemblyInfo.cs <span style='color:#111;'> 1.18KB </span>","children":null,"spread":false}],"spread":true},{"title":"ListViewEx.csproj <span style='color:#111;'> 2.99KB </span>","children":null,"spread":false},{"title":"ListViewEx.cs <span style='color:#111;'> 22.09KB </span>","children":null,"spread":false},{"title":"NativeMethods.cs <span style='color:#111;'> 10.76KB </span>","children":null,"spread":false}],"spread":true},{"title":"ListViewExDemo.suo <span style='color:#111;'> 26.50KB </span>","children":null,"spread":false},{"title":"ListViewExDemo1.png <span style='color:#111;'> 17.76KB </span>","children":null,"spread":false},{"title":"ListViewExDemo2.png <span style='color:#111;'> 20.69KB </span>","children":null,"spread":false},{"title":"Thumbs.db <span style='color:#111;'> 5.00KB </span>","children":null,"spread":false},{"title":"ListViewExDemo.sln <span style='color:#111;'> 1.38KB </span>","children":null,"spread":false},{"title":"ListViewExDemo","children":[{"title":"Form1.cs <span style='color:#111;'> 584B </span>","children":null,"spread":false},{"title":"bin","children":[{"title":"Debug","children":[{"title":"ListViewExDemo.exe <span style='color:#111;'> 32.00KB </span>","children":null,"spread":false},{"title":"ListViewEx.dll <span style='color:#111;'> 32.00KB </span>","children":null,"spread":false},{"title":"ListViewExDemo.pdb <span style='color:#111;'> 21.50KB </span>","children":null,"spread":false},{"title":"ListViewExDemo.vshost.exe <span style='color:#111;'> 5.50KB </span>","children":null,"spread":false},{"title":"ListViewEx.pdb <span style='color:#111;'> 37.50KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"obj","children":[{"title":"Debug","children":[{"title":"ListViewExDemo.csproj.GenerateResource.Cache <span style='color:#111;'> 842B </span>","children":null,"spread":false},{"title":"ListViewExDemo.exe <span style='color:#111;'> 32.00KB </span>","children":null,"spread":false},{"title":"ResolveAssemblyReference.cache <span style='color:#111;'> 4.39KB </span>","children":null,"spread":false},{"title":"ListViewExDemo.Properties.Resources.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"ListViewExDemo.pdb <span style='color:#111;'> 21.50KB </span>","children":null,"spread":false},{"title":"Refactor","children":null,"spread":false},{"title":"TempPE","children":null,"spread":false},{"title":"ListViewExDemo.Form1.resources <span style='color:#111;'> 9.95KB </span>","children":null,"spread":false}],"spread":true},{"title":"ListViewExDemo.csproj.FileList.txt <span style='color:#111;'> 369B </span>","children":null,"spread":false}],"spread":true},{"title":"Properties","children":[{"title":"Resources.Designer.cs <span style='color:#111;'> 2.82KB </span>","children":null,"spread":false},{"title":"Settings.settings <span style='color:#111;'> 249B </span>","children":null,"spread":false},{"title":"Resources.resx <span style='color:#111;'> 5.48KB </span>","children":null,"spread":false},{"title":"Settings.Designer.cs <span style='color:#111;'> 1.07KB </span>","children":null,"spread":false},{"title":"AssemblyInfo.cs <span style='color:#111;'> 1.18KB </span>","children":null,"spread":false}],"spread":true},{"title":"Program.cs <span style='color:#111;'> 473B </span>","children":null,"spread":false},{"title":"Form1.Designer.cs <span style='color:#111;'> 8.12KB </span>","children":null,"spread":false},{"title":"Form1.resx <span style='color:#111;'> 20.40KB </span>","children":null,"spread":false},{"title":"ListViewExDemo.csproj <span style='color:#111;'> 3.37KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true}]

评论信息

  • xingqingxiang :
    东西不错,参考价值不小
    2020-09-19
  • luo1wei23 :
    不错的资源,能运行;但还有点小BUG,需要调整下
    2019-05-21
  • c10080109 :
    非常不错,可以自己在此基础上做一些改动,达到自己想要的效果
    2019-03-20
  • jiang11458 :
    很不错的东西啊,谢谢。
    2018-05-09
  • weepingisgood :
    不错,比较完美
    2018-04-18

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明