コード例 #1
0
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// daterangeeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this DateRangeEventHandler daterangeeventhandler, Object sender, DateRangeEventArgs e, AsyncCallback callback)
        {
            if (daterangeeventhandler == null)
            {
                throw new ArgumentNullException("daterangeeventhandler");
            }

            return(daterangeeventhandler.BeginInvoke(sender, e, callback, null));
        }
コード例 #2
0
        /// <summary>
        /// テキスト変更時にメッセージボックスを表示する
        /// </summary>
        /// <param name="textbox">ボタン</param>
        static void ChangeDateTimeEvent(MonthCalendar monthcalendar)
        {
            DateRangeEventHandler handler = null;

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