powered by simpleCommunicator - 2.0.55     © 2025 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Drag and Drop между двумя DataGridView
2 сообщений из 2, страница 1 из 1
Drag and Drop между двумя DataGridView
    #38686821
jenya7
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
хочу перетащить данные с одной ячейки в другую.
Код: c#
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
 private void dataGridViewInOut_DragDrop(object sender, DragEventArgs e)
        {
            DataGridViewRow row = e.Data.GetData(typeof(DataGridViewRow)) as DataGridViewRow;
            if (row != null)
            {
                //for debug
                MessageBox.Show(row.Cells[1].Value.ToString());
               //не работает
                dataGridViewInOut.CurrentCell.Value = row.Cells[1].Value;
            }
        }


вопрос как указать ячейку над которой зависла мышь, чтобы бросить туда данные.
...
Рейтинг: 0 / 0
Drag and Drop между двумя DataGridView
    #38686838
jenya7
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
во. нашел.
Код: c#
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
 private void dataGridViewInOut_DragDrop(object sender, DragEventArgs e)
        {
            DataGridViewRow row = e.Data.GetData(typeof(DataGridViewRow)) as DataGridViewRow;
            if (row != null)
            {
                Point client_point = dataGridViewInOut.PointToClient(new Point(e.X, e.Y));
                DataGridView.HitTestInfo hti = dataGridViewInOut.HitTest(client_point.X, client_point.Y);
                DataGridViewCell target_cell = dataGridViewInOut[hti.ColumnIndex, hti.RowIndex];
                target_cell.Value = row.Cells[0].Value;
            }
        }
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Drag and Drop между двумя DataGridView
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]