Exemple #1
0
        /// <summary>
        /// 修改焦点对象
        /// </summary>
        public void UpdateObject()
        {
            //获取焦点对象
            LineType obj = FocusedObject;

            if (obj == null)
            {
                return;
            }
            int i = gridView.FocusedRowHandle;

            //创建对象的一个副本
            //LineType objCopy = new LineType();
            //DataConverter.CopyTo<LineType>(obj, objCopy);

            //执行修改操作
            using (FrmLineTypeDialog dlg = new FrmLineTypeDialog())
            {
                dlg.Object = obj;   //绑定副本
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            obj.ObjColor = Color.FromArgb(Convert.ToInt32(obj.Color));
            //RefreshData();
            gridControl.RefreshDataSource();
            gridView.FocusedRowHandle = i;
        }
Exemple #2
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            LineType obj = new LineType();

            //执行添加操作
            using (FrmLineTypeDialog dlg = new FrmLineTypeDialog())
            {
                dlg.IsCreate = true;                    //设置新建标志
                dlg.Object   = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            obj.ObjColor = Color.FromArgb(Convert.ToInt32(obj.Color));
            ObjectList.Add(obj);
            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
            //RefreshData();
            //GridHelper.FocuseRow(this.gridView, obj);
            //gridView.FocusedRowHandle = gridView.RowCount;
        }
Exemple #3
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            LineType obj = new LineType();

            //ִ����Ӳ���
            using (FrmLineTypeDialog dlg = new FrmLineTypeDialog())
            {
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            obj.ObjColor = Color.FromArgb(Convert.ToInt32(obj.Color));
            ObjectList.Add(obj);
            //ˢ�±�񣬲��������ж�λ���¶����ϡ�
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
            //RefreshData();
            //GridHelper.FocuseRow(this.gridView, obj);
            //gridView.FocusedRowHandle = gridView.RowCount;
        }
Exemple #4
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            //��ȡ�������
            LineType obj = FocusedObject;
            if (obj == null)
            {
                return;
            }
            int i=gridView.FocusedRowHandle;
            //���������һ������
            //LineType objCopy = new LineType();
            //DataConverter.CopyTo<LineType>(obj, objCopy);

            //ִ���޸IJ���
            using (FrmLineTypeDialog dlg = new FrmLineTypeDialog())
            {
                dlg.Object = obj;   //�󶨸���
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            obj.ObjColor = Color.FromArgb(Convert.ToInt32(obj.Color));
            //RefreshData();
            gridControl.RefreshDataSource();
            gridView.FocusedRowHandle = i;
        }