korasoglu Posted September 19, 2022 Share Posted September 19, 2022 int hnd = gridView1.FocusedRowHandle; if (gridView1.IsValidRowHandle(hnd)) // eğer seçili olan satır geçerliyse yani boş bir yere tıklanmamışsa { if (hnd > -1) // sütun başlıklarına değil de sadece satırlara tıklanmışsa { bilgiyukle.id = gridView1.GetRowCellDisplayText(hnd, gridView1.Columns[0]); MessageBox.Show(bilgiyukle.id); } } Arkadaşlar bu kodda seçim yoksa deniliyor ve çalışıyor ama ben dataGridView'e aşağıdaki gibi uyguladım boşluğa bile tıklasam contextmenu çıkıyor nasıl yapabilirm. private void dataGridView1_MouseClick(object sender, MouseEventArgs e) { if (dataGridView1CurrentCell.RowIndex > -1) { if (name == "ISLEM" && e.Button == MouseButtons.Left) {contextMenuStrip1.Show(dataGridView1, e.X, e.Y + 10); } } } 1 Quote Link to comment Share on other sites More sharing options...
mcmillian Posted October 19, 2022 Share Posted October 19, 2022 DevExpress Popup Menu kullanmanı tavsiye ederim. Quote Link to comment Share on other sites More sharing options...
korasoglu Posted October 29, 2022 Author Share Posted October 29, 2022 (edited) Cevabını arayan olursa; if (e.RowIndex != -1 && e.ColumnIndex != -1 && e.ColumnIndex == datagridview.Columns["DURUM"].Index) { DataGridViewCell clickedCell = (sender as DataGridView).Rows[e.RowIndex].Cells[e.ColumnIndex]; datagridview.CurrentCell = clickedCell; var relativeMousePosition = datagridview.PointToClient(Cursor.Position); Menu1.Show(datagridview, relativeMousePosition); } Ama şu bir gerçek yazılımı bana tnc-tr sevdirdi çünkü yardım dükaman çok fazlaydı sorulan sorulara mutlaka cevap veren birileri olurdu misal pairs(Ali) kintaro(yavuz) ... çok koştular hepsine çok çok teşekkür ederim ama şuan bu bölümle ilgilenen kişi yok galiba ah eski günler. Edited October 29, 2022 by korasoglu 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.