Exemplo n.º 1
0
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// labelediteventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this LabelEditEventHandler labelediteventhandler, Object sender, LabelEditEventArgs e, AsyncCallback callback)
        {
            if (labelediteventhandler == null)
            {
                throw new ArgumentNullException("labelediteventhandler");
            }

            return(labelediteventhandler.BeginInvoke(sender, e, callback, null));
        }
        /// <summary>
        /// ラベル変更時にメッセージボックスを表示する
        /// </summary>
        /// <param name="listView">リストビュー</param>
        static void LabelEditEvent(ListView listView)
        {
            LabelEditEventHandler handler = null;

            handler = delegate
            {
                MessageBox.Show("");
                listView.BeginInvoke((MethodInvoker) delegate
                {
                    listView.AfterLabelEdit -= handler;
                });
            };
            listView.AfterLabelEdit += handler;
        }