<i id='KKhtY'><tr id='KKhtY'><dt id='KKhtY'><q id='KKhtY'><span id='KKhtY'><b id='KKhtY'><form id='KKhtY'><ins id='KKhtY'></ins><ul id='KKhtY'></ul><sub id='KKhtY'></sub></form><legend id='KKhtY'></legend><bdo id='KKhtY'><pre id='KKhtY'><center id='KKhtY'></center></pre></bdo></b><th id='KKhtY'></th></span></q></dt></tr></i><div id='KKhtY'><tfoot id='KKhtY'></tfoot><dl id='KKhtY'><fieldset id='KKhtY'></fieldset></dl></div>

    <tfoot id='KKhtY'></tfoot>
  1. <legend id='KKhtY'><style id='KKhtY'><dir id='KKhtY'><q id='KKhtY'></q></dir></style></legend>

  2. <small id='KKhtY'></small><noframes id='KKhtY'>

        <bdo id='KKhtY'></bdo><ul id='KKhtY'></ul>

    1. 具有覆盖 CreateParams 的 ListBox 不会引发项目事件

      时间:2023-10-07

      <small id='OhWU1'></small><noframes id='OhWU1'>

      <i id='OhWU1'><tr id='OhWU1'><dt id='OhWU1'><q id='OhWU1'><span id='OhWU1'><b id='OhWU1'><form id='OhWU1'><ins id='OhWU1'></ins><ul id='OhWU1'></ul><sub id='OhWU1'></sub></form><legend id='OhWU1'></legend><bdo id='OhWU1'><pre id='OhWU1'><center id='OhWU1'></center></pre></bdo></b><th id='OhWU1'></th></span></q></dt></tr></i><div id='OhWU1'><tfoot id='OhWU1'></tfoot><dl id='OhWU1'><fieldset id='OhWU1'></fieldset></dl></div>
        <tbody id='OhWU1'></tbody>

      • <bdo id='OhWU1'></bdo><ul id='OhWU1'></ul>

        <tfoot id='OhWU1'></tfoot>

          <legend id='OhWU1'><style id='OhWU1'><dir id='OhWU1'><q id='OhWU1'></q></dir></style></legend>
              • 本文介绍了具有覆盖 CreateParams 的 ListBox 不会引发项目事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在 这里.问题是它不会引发任何特定于项目的事件,例如 DrawItem 和 SelectedIndexChanged.

                I've created a custom ListBox like in here. Thing is it doesn't raise any of the item specific events like DrawItem and SelectedIndexChanged.

                知道为什么吗?谢谢.

                推荐答案

                当我尝试这段代码时它工作得很好:

                It worked just fine when I tried this code:

                  public partial class Form1 : Form {
                    MyListBox mList;
                    public Form1() {
                      InitializeComponent();
                    }
                
                    protected override void OnLoad(EventArgs e) {
                      mList = new MyListBox(this);
                      mList.Location = new Point(5, 10);
                      mList.Size = new Size(50, this.ClientSize.Height + 50);
                      for (int ix = 0; ix < 100; ++ix) mList.Items.Add(ix);
                      mList.SelectedIndexChanged += new EventHandler(mList_SelectedIndexChanged);
                    }
                
                    void mList_SelectedIndexChanged(object sender, EventArgs e) {
                      MessageBox.Show(mList.SelectedIndex.ToString());
                    }
                
                    protected override void Dispose(bool disposing) {
                      // Moved from Designer.cs file
                      if (disposing) mList.Dispose();
                      if (disposing && (components != null)) {
                        components.Dispose();
                      }
                      base.Dispose(disposing);
                    }
                
                  }
                

                这篇关于具有覆盖 CreateParams 的 ListBox 不会引发项目事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在使用 ItemsSource 之前,项目集合必须为空 下一篇:使用 ListBox 缓慢显示/绘制对话?

                相关文章

                <i id='CcUwF'><tr id='CcUwF'><dt id='CcUwF'><q id='CcUwF'><span id='CcUwF'><b id='CcUwF'><form id='CcUwF'><ins id='CcUwF'></ins><ul id='CcUwF'></ul><sub id='CcUwF'></sub></form><legend id='CcUwF'></legend><bdo id='CcUwF'><pre id='CcUwF'><center id='CcUwF'></center></pre></bdo></b><th id='CcUwF'></th></span></q></dt></tr></i><div id='CcUwF'><tfoot id='CcUwF'></tfoot><dl id='CcUwF'><fieldset id='CcUwF'></fieldset></dl></div>
                • <bdo id='CcUwF'></bdo><ul id='CcUwF'></ul>

                1. <tfoot id='CcUwF'></tfoot>
                2. <small id='CcUwF'></small><noframes id='CcUwF'>

                  <legend id='CcUwF'><style id='CcUwF'><dir id='CcUwF'><q id='CcUwF'></q></dir></style></legend>