사실 내 요구 사항에 따라 Datagridview 셀을 사용자 정의하고 싶습니다. 특정 열에 대해 Datagridview 행에 텍스트와 이미지를 추가해야합니다. 다음 이미지DataGridview 셀에 이미지 및 텍스트를 추가하는 방법
어느 한 몇 가지 예제를 좀 도와 줄래?를 참조하십시오 감사합니다. .
사실 내 요구 사항에 따라 Datagridview 셀을 사용자 정의하고 싶습니다. 특정 열에 대해 Datagridview 행에 텍스트와 이미지를 추가해야합니다. 다음 이미지DataGridview 셀에 이미지 및 텍스트를 추가하는 방법
어느 한 몇 가지 예제를 좀 도와 줄래?를 참조하십시오 감사합니다. .
이
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DataGridView1.ColumnCount = 3
DataGridView1.Columns(0).Name = "Product ID"
DataGridView1.Columns(1).Name = "Product Name"
DataGridView1.Columns(2).Name = "Product_Price"
Dim row As String() = New String() {"1", "Product 1", "1000"}
DataGridView1.Rows.Add(row)
row = New String() {"2", "Product 2", "2000"}
DataGridView1.Rows.Add(row)
row = New String() {"3", "Product 3", "3000"}
DataGridView1.Rows.Add(row)
row = New String() {"4", "Product 4", "4000"}
DataGridView1.Rows.Add(row)
Dim img As New DataGridViewImageColumn()
Dim inImg As Image = Image.FromFile("Image Path")
img.Image = inImg
DataGridView1.Columns.Add(img)
img.HeaderText = "Image"
img.Name = "img"
End Sub
End Class
당신은 동적 DataGridViewTextBoxCell()
그 열에 표시 텍스트 값으로 DataGridView에 셀을 변환 할 수 있습니다보십시오. 아래는 기본적인 아이디어를 제공하는 코드 샘플입니다.
Private Sub button1_Click(sender As Object, e As EventArgs)
dataGridView1.Rows(3).Cells("ImageCol") = New DataGridViewTextBoxCell()
dataGridView1.Rows(3).Cells("ImageCol").Value = "Hello.."
End Sub
유 모양의 종류를 달성하려는 경우, WPF는 더 나은 옵션이지만, 당신은 또한 윈폼에서 DataGridView에 오기를 사용자 수 있지만 모양의이 종류는, 지금까지의 내가 아는 한에서 달성하기 어려운/불가능 winforms –