熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

重寫ComboBox的OnkeyUp方法

2022-06-13   來源: .NET編程 

        using System;
    using SystemCollectionsGeneric;
    using SystemText;

  namespace winform
    {
        public class OurComBox : SystemWindowsFormsComboBox
        {
            //==============overwrite ComboBox OnkeyUp method
            protected override void OnKeyUp(SystemWindowsFormsKeyEventArgs e)
            {
                foreach (object item in thisItems)
                {
                    string[] strs = itemToString()Split(ToCharArray());//利用空格來分格字符串
                    if (strs[]Trim()Equals(thisText))//如果輸入的值等於前面的編號
                    {
                        thisSelectedItem = item;
                        thisSelectAll();
                    }
                }
                baseOnKeyUp(e);
            }
            //=================
        }
    }



From:http://tw.wingwit.com/Article/program/net/201311/11391.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.