读书人

VS上ListBox控件如何没有Paint事件

发布时间: 2012-05-28 17:59:33 作者: rapoo

VS上,ListBox控件怎么没有Paint事件
在VS编译器事件窗口,ListBox控件怎么没有Paint事件

http://msdn.microsoft.com/zh-cn/library/system.windows.forms.listbox.paint.aspx

[解决办法]
备注
此事件与该类无关。
[解决办法]
有 onItemPaint事件
[解决办法]
那就自己定义一个

C# code
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1{    public partial class CustomControl1 :ListBox    {        public CustomControl1()        {            InitializeComponent();        }        protected override void OnPaint(PaintEventArgs pe)        {            base.OnPaint(pe);        }    }}
[解决办法]
ListBox的OnPaint声明为


C# code
    [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]    public event PaintEventHandler Paint;
[解决办法]

.NET Framework 版本有关

读书人网 >C#

热点推荐