首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

listBox1_DrawItem事件无响应?该怎么解决

2013-06-26 
listBox1_DrawItem事件无响应?using Systemusing System.Collections.Genericusing System.ComponentMod

listBox1_DrawItem事件无响应?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication15
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            MessageBox.Show("hello");
        }
    }
}


运行后没有显示信息框,不知道是哪里写错了? ListBox
[解决办法]
你有没有把listBox1_DrawItem关联给listBox1.DrawItem?
[解决办法]
修改 DrawMode = OwnerDrawFixed 或者 OwnerDrawVariable

不然它不会激发DrawItem事件


不是每个事件你注册了  就会调用你的事件处理程序   有些事件需要你设置是否激发

热点排行