saptechnique

Better late than never. - 郭富

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

        private void dgvPbom_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            dgvPbom.DoDragDrop(e.ColumnIndex, DragDropEffects.Copy);
        }

        private void txtProjectCode_DragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(typeof(int)))
            {
                e.Effect = DragDropEffects.Copy;
            }
            else
                e.Effect = DragDropEffects.None;
        }

        private void txtProjectCode_DragDrop(object sender, DragEventArgs e)
        {
            int index = -1;
            if (e.Data.GetDataPresent(typeof(int)))
                index = (int)e.Data.GetData(typeof(int));
            if (index > -1)
                txtProjectCode.Text = dgvPbom.Columns[index].Name;
        }

posted on 2009-02-26 15:28  guofu  阅读(967)  评论(0编辑  收藏  举报