<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 不会引发项目事件

      ListBox with overriden CreateParams doesn#39;t raise item events(具有覆盖 CreateParams 的 ListBox 不会引发项目事件)

      <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 不会引发项目事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Populate ListBox with a IEnumrable on another thread (winforms)(在另一个线程(winforms)上使用 IEnumrable 填充 ListBox)
                listbox selected item give me quot; System.Data.DataRowViewquot; , C# winforms(列表框选择的项目给我quot;System.Data.DataRowView, C# Winforms)
                Cannot remove items from ListBox(无法从列表框中删除项目)
                Preventing ListBox scrolling to top when updated(更新时防止列表框滚动到顶部)
                Drag and drop from list to canvas on windows phone with MVVM(使用 MVVM 在 Windows 手机上从列表拖放到画布)
                Deselection on a WPF listbox with extended selection mode(具有扩展选择模式的 WPF 列表框上的取消选择)

                <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>
                          <tbody id='CcUwF'></tbody>
                      • <small id='CcUwF'></small><noframes id='CcUwF'>

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