コード例 #1
0
        // 将所有 changed color 清除
        internal void ResetColor()
        {
            // throw new Exception("尚未实现 ResetColor()");

            for (int i = 0; i < this._tableLayoutPanel_main.RowStyles.Count; i++)
            {
                Label color = this._tableLayoutPanel_main.GetControlFromPosition(1, i) as Label;
                if (color == null)
                {
                    continue;
                }
                EditLineState state = color.Tag as EditLineState;
                if (state != null)
                {
                    if (state.Changed == true)
                    {
                        state.Changed = false;
                    }
                    SetLineState(color, state);
                }
                else
                {
                    color.BackColor = this._tableLayoutPanel_main.BackColor;
                }
            }
        }
コード例 #2
0
        void control_Enter(object sender, EventArgs e)
        {
            //if (this.m_nInSuspend == 0)
            {
                Control control = sender as Control;

                ClearActiveState();

                EditLineState state = GetLineState(control);

                if (state == null)
                {
                    state = new EditLineState();
                }

                bool bSelectionChanged = state.Active == false;

                // if (state.Active == false)
                {
                    state.Active = true;
                    SetLineState(control, state);
                }

                if (bSelectionChanged)
                {
                    this.OnSelectionChanged(new EventArgs());
                }
            }
        }
コード例 #3
0
        // 设置一行的显示状态
        void SetLineState(int nRowNumber, EditLineState newState)
        {
            Label color = this._tableLayoutPanel_main.GetControlFromPosition(1, nRowNumber) as Label;

            if (color == null)
            {
                throw new ArgumentException("行 " + nRowNumber.ToString() + " 的 Color Label 对象不存在", "nRowNumber");
            }

            Control edit = this._tableLayoutPanel_main.GetControlFromPosition(2, nRowNumber);

            color.Tag = newState;
            ResetColor(color, edit);
        }
コード例 #4
0
        // 设置一行的状态
        public void SetLineState(EditLine line, EditLineState new_state)
        {
            bool bNotified = false;

            // 需要把其他事项的 Active 状态全部设置为 false
            if (new_state.Active == true)
            {
                bNotified = ClearActiveState(line);
            }
            SetLineState(line.EditControl, new_state);
            if (bNotified == false)
            {
                OnSelectionChanged(new EventArgs());
            }
        }
コード例 #5
0
        // 清除全部行的 Active 状态
        public bool ClearActiveState(EditLine exclude = null)
        {
            bool bSelectionChanged = false;

            for (int i = 0; i < this._tableLayoutPanel_main.RowStyles.Count; i++)
            {
                // 第一列
                Label label_control = this._tableLayoutPanel_main.GetControlFromPosition(0, i) as Label;
                if (label_control == null)
                {
                    continue;
                }
                if (exclude != null)
                {
                    if (label_control == exclude._labelCaption)
                    {
                        continue;   // 跳过要排除的一行
                    }
                }
#if NO
                // 第二列
                label_control = this._tableLayoutPanel_main.GetControlFromPosition(1, i) as Label;
                if (label_control == null)
                {
                    continue;
                }
#endif

                EditLineState state = GetLineState(i);
                if (state != null && state.Active == true)
                {
                    state.Active = false;
                    SetLineState(i, state);

                    bSelectionChanged = true;
                }
            }
            if (bSelectionChanged)
            {
                this.OnSelectionChanged(new EventArgs());
            }

            return(bSelectionChanged);
        }
コード例 #6
0
 // 获得当前具有输入焦点的一行
 public virtual EditLine GetFocuedLine()
 {
     for (int i = 0; i < this._tableLayoutPanel_main.RowStyles.Count; i++)
     {
         // 第三列
         Control edit_control = this._tableLayoutPanel_main.GetControlFromPosition(2, i);
         if (edit_control != null &&
             edit_control.Visible == true &&
             edit_control.Enabled == true
             // && edit_control.Focused == true
             )
         {
             EditLineState state = GetLineState(i);
             if (state != null && state.Active == true)
             {
                 EditLine line = new EditLine(this, i);
                 return(line);
             }
         }
     }
     return(null);
 }
コード例 #7
0
        void control_TextChanged(object sender, EventArgs e)
        {
            if (m_bInInitial == true)
            {
                return;
            }

            // this.label_barcode_color.BackColor = this.ColorChanged;
            Control       control = sender as Control;
            EditLineState state   = GetLineState(control);

            if (state == null)
            {
                state = new EditLineState();
            }

            if (state.Changed == false)
            {
                state.Changed = true;
                SetLineState(control, state);
            }
            this.Changed = true;
        }
コード例 #8
0
ファイル: EntityEditControl.cs プロジェクト: paopaofeng/dp2
        private void textBox_barcode_TextChanged(object sender, EventArgs e)
        {
            if (m_bInInitial == false)
            {
                // this.label_barcode_color.BackColor = this.ColorChanged;
                Control control = sender as Control;
                EditLineState state = GetLineState(control);

                if (state == null)
                    state = new EditLineState();

                if (state.Changed == false)
                {
                    state.Changed = true;
                    SetLineDisplayState(control, state);
                }
                this.Changed = true;
            }
        }
コード例 #9
0
 void SetLineState(Control control, EditLineState newState)
 {
     SetLineState(this._tableLayoutPanel_main.GetCellPosition(control).Row, newState);
 }
コード例 #10
0
        void ResetColor(Label color, Control edit)
        {
            EditLineState newState = color.Tag as EditLineState;

            if (newState == null)
            {
                color.BackColor = this._tableLayoutPanel_main.BackColor;
                return;
            }

            if (newState.Active == true)
            {
                if (this.ContainsFocus == true)
                {
                    color.BackColor = SystemColors.Highlight;
                    Color focus_color = this.FocusedEditBackColor;
                    if (edit != null && edit.BackColor != focus_color)
                    {
                        edit.BackColor = focus_color;
                    }
                    return;
                }
                else
                {
                    if (this.m_bHideSelection == false)
                    {
                        color.BackColor = ControlPaint.Dark(SystemColors.Highlight);
                        Color focus_color = ControlPaint.Light(this.FocusedEditBackColor);
                        if (edit != null && edit.BackColor != focus_color)
                        {
                            edit.BackColor = focus_color;
                        }
                        return;
                    }
                }
            }

#if NO
            // 恢复原来的颜色
            if (edit != null && edit.Tag != null)
            {
                Color back_color = (Color)edit.Tag;
                if (edit.BackColor != back_color)
                {
                    edit.BackColor = back_color;
                }
            }
#endif
            if (edit != null)
            {
                if (edit is TextBox)
                {
                    TextBox textbox = edit as TextBox;
                    if (textbox.ReadOnly == true && this.BackColor != Color.Transparent)
                    {
                        textbox.BackColor = this.BackColor;
                    }
                    else
                    {
                        edit.BackColor = _editBackColor;
                    }
                }
                else
                {
                    edit.BackColor = _editBackColor;
                }
            }

            if (newState.Changed == true)
            {
                color.BackColor = this.ColorChanged;
            }
            else
            {
                color.BackColor = this._tableLayoutPanel_main.BackColor;
            }
        }
コード例 #11
0
ファイル: ItemEditControlBase.cs プロジェクト: paopaofeng/dp2
        // 设置一行的显示状态
        void SetLineState(int nRowNumber, EditLineState newState)
        {
            Label color = this._tableLayoutPanel_main.GetControlFromPosition(1, nRowNumber) as Label;
            if (color == null)
                throw new ArgumentException("行 " + nRowNumber.ToString() + " 的 Color Label 对象不存在", "nRowNumber");
            
            Control edit = this._tableLayoutPanel_main.GetControlFromPosition(2, nRowNumber);

            color.Tag = newState;
            ResetColor(color, edit);
        }
コード例 #12
0
ファイル: ItemEditControlBase.cs プロジェクト: paopaofeng/dp2
 void SetLineState(Control control, EditLineState newState)
 {
     SetLineState(this._tableLayoutPanel_main.GetCellPosition(control).Row, newState);
 }
コード例 #13
0
ファイル: ItemEditControlBase.cs プロジェクト: paopaofeng/dp2
        void control_Enter(object sender, EventArgs e)
        {
            //if (this.m_nInSuspend == 0)
            {
                Control control = sender as Control;

                ClearActiveState();

                EditLineState state = GetLineState(control);

                if (state == null)
                    state = new EditLineState();

                bool bSelectionChanged = state.Active == false;

                // if (state.Active == false)
                {
                    state.Active = true;
                    SetLineState(control, state);
                }

                if (bSelectionChanged)
                    this.OnSelectionChanged(new EventArgs());

            }
        }
コード例 #14
0
ファイル: ItemEditControlBase.cs プロジェクト: paopaofeng/dp2
 // 设置一行的状态
 public void SetLineState(EditLine line, EditLineState new_state)
 {
     bool bNotified = false;
     // 需要把其他事项的 Active 状态全部设置为 false
     if (new_state.Active == true)
     {
         bNotified = ClearActiveState(line);
     }
     SetLineState(line.EditControl, new_state);
     if (bNotified == false)
         OnSelectionChanged(new EventArgs());
 }