示例#1
0
        /// 注册事件
        /// </summary>
        /// <param name="control">控件</param>
        private void RegisterEvents(ControlA control)
        {
            ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickButton);
            List <ControlA>   controls         = control.GetControls();
            int controlsSize = controls.Count;

            for (int i = 0; i < controlsSize; i++)
            {
                ControlA   subControl = controls[i];
                ButtonA    button     = controls[i] as ButtonA;
                LinkLabelA linkLabel  = subControl as LinkLabelA;
                GridColumn column     = subControl as GridColumn;
                GridA      grid       = subControl as GridA;
                CheckBoxA  checkBox   = subControl as CheckBoxA;
                if (column != null)
                {
                    column.AllowDrag   = true;
                    column.AllowResize = true;
                    column.BackColor   = CDraw.PCOLORS_BACKCOLOR;
                    column.Font        = new FONT("微软雅黑", 12, false, false, false);
                    column.ForeColor   = CDraw.PCOLORS_FORECOLOR;
                }
                else if (button != null)
                {
                    button.RegisterEvent(clickButtonEvent, EVENTID.CLICK);
                }
                else if (linkLabel != null)
                {
                    linkLabel.RegisterEvent(clickButtonEvent, EVENTID.CLICK);
                }
                else if (grid != null)
                {
                    grid.GridLineColor              = COLOR.CONTROLBORDER;
                    grid.RowStyle.HoveredBackColor  = CDraw.PCOLORS_HOVEREDROWCOLOR;
                    grid.RowStyle.SelectedBackColor = CDraw.PCOLORS_SELECTEDROWCOLOR;
                    grid.RowStyle.SelectedForeColor = CDraw.PCOLORS_FORECOLOR4;
                    grid.RowStyle.Font              = new FONT("微软雅黑", 12, false, false, false);
                    GridRowStyle alternateRowStyle = new GridRowStyle();
                    alternateRowStyle.BackColor         = CDraw.PCOLORS_ALTERNATEROWCOLOR;
                    alternateRowStyle.HoveredBackColor  = CDraw.PCOLORS_HOVEREDROWCOLOR;
                    alternateRowStyle.SelectedBackColor = CDraw.PCOLORS_SELECTEDROWCOLOR;
                    alternateRowStyle.SelectedForeColor = CDraw.PCOLORS_FORECOLOR4;
                    alternateRowStyle.Font = new FONT("微软雅黑", 12, false, false, false);
                    grid.AlternateRowStyle = alternateRowStyle;
                    grid.UseAnimation      = true;
                }
                RegisterEvents(controls[i]);
            }
        }
示例#2
0
        /// <summary>
        /// 注册事件
        /// </summary>
        /// <param name="control">控件</param>
        private void RegisterEvents(ControlA control)
        {
            ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickButton);
            List <ControlA>   controls         = control.GetControls();
            int controlsSize = controls.Count;

            for (int i = 0; i < controlsSize; i++)
            {
                ButtonA    button    = controls[i] as ButtonA;
                LinkLabelA linkLabel = controls[i] as LinkLabelA;
                if (button != null)
                {
                    button.RegisterEvent(clickButtonEvent, EVENTID.CLICK);
                }
                else if (linkLabel != null)
                {
                    linkLabel.RegisterEvent(clickButtonEvent, EVENTID.CLICK);
                }
                RegisterEvents(controls[i]);
            }
        }