Пример #1
0
        /// <summary>
        /// 重写基类的Edit事件
        /// </summary>
        /// <param name="source">CurrencyManager</param>
        /// <param name="rowNum">行索引</param>
        /// <param name="bounds">区域</param>
        /// <param name="OnlyRead">是否只读</param>
        /// <param name="instantText">instantText</param>
        /// <param name="cellIsVisible">cellIsVisible</param>
        protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool OnlyRead, string instantText, bool cellIsVisible)

        {
            bool enabled = true;

            DataGridEnableEventArgs e = new DataGridEnableEventArgs(rowNum, _col, enabled);

            this.CheckCellEnabled(this, e);

            if (e.EnableValue)

            {
                base.Edit(source, rowNum, bounds, OnlyRead, instantText, cellIsVisible);
            }
        }
Пример #2
0
        /// <summary>
        /// 重写基类的PAINT事件,通过这个事件激活 CheckCellEnabled 事件
        /// </summary>
        /// <param name="g">绘图面</param>
        /// <param name="rc">绘图区域</param>
        /// <param name="cm">CurrencyManager</param>
        /// <param name="rowNumber">行索引</param>
        /// <param name="backbrush">背景画刷</param>
        /// <param name="forebrush">前景景画刷</param>
        /// <param name="LtoR">是否右对齐</param>
        protected override void  Paint(Graphics g, Rectangle rc, CurrencyManager cm, int rowNumber, Brush backbrush, Brush forebrush, bool LtoR)

        {
            bool enabled = true;

            DataGridEnableEventArgs e = new DataGridEnableEventArgs(rowNumber, _col, enabled);

            CheckCellEnabled(this, e);

            backbrush = new System.Drawing.SolidBrush(e.BackColor);
            forebrush = new System.Drawing.SolidBrush(e.ForeColor);


            base.Paint(g, rc, cm, rowNumber, backbrush, forebrush, LtoR);
        }