mao ni akong code brayan...na himo bro
pag pa display pa lng..wala pa event
HTML Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dt As New DataTable
Dim bs As New BindingSource
Dim btnx As New Button
'btnx.Name = "btn1"
'btnx.Text = "ahahah"
'dt.Columns.Add("id", GetType(Button))
'dt.Rows.Add(btnx)
'bs.DataSource = dt
'DataGridView2.DataSource = bs
Dim column1 As New DataGridViewTextBoxColumn
Dim column2 As New DataGridViewComboBoxColumn
Dim column3 As New DataGridViewButtonColumn
Dim column4 As New DataGridViewImageColumn
With column1
.Name = "ID"
.HeaderText = "Text Box"
End With
With column2
.Name = "Name"
.HeaderText = "Combo Box"
End With
With column3
.Name = "but"
.HeaderText = "Button"
End With
With column4
.Name = "image"
.HeaderText = "Image"
.AutoSizeMode = DataGridViewAutoSizeColumnMode.None
End With
DataGridView2.Columns.Add(column1)
DataGridView2.Columns.Add(column2)
DataGridView2.Columns.Add(column3)
DataGridView2.Columns.Add(column4)
Dim comboCell As DataGridViewComboBoxCell
Dim btnCell As DataGridViewButtonCell
Dim imgCell As DataGridViewImageCell
DataGridView2.Rows.Add()
DataGridView2.Item(0, 0).Value = "Row0"
comboCell = DataGridView2.Item(1, 0)
comboCell.Items.Add("Item1")
comboCell.Items.Add("Item2")
btnCell = DataGridView2.Item(2, 0)
btnCell.Value = "Add to cart"
'btnCell. = 200
'btnCell.Size = New Size(200, 50)
Dim bmp As New Bitmap("c:\\me.jpg")
'' bmp.Height = 100
imgCell = DataGridView2.Item(3, 0)
imgCell.Value = bmp
imgCell.ReadOnly = False
'imgCell.Size = Size(100, 100)
'imgCell.Size.Height = 100
'imgCell()
'imgCell.Size = New Size(100, 200)
DataGridView2.Rows.Add()
DataGridView2.Item(0, 1).Value = "Row1"
comboCell = DataGridView2.Item(1, 1)
comboCell.Items.Add("Item3")
comboCell.Items.Add("Item4")
btnCell = DataGridView2.Item(2, 1)
btnCell.Value = "sdfsadf"
imgCell = DataGridView2.Item(3, 1)
imgCell.Value = bmp
DataGridView2.Rows.Add()
DataGridView2.Item(0, 2).Value = "Row2"
comboCell = DataGridView2.Item(1, 2)
comboCell.Items.Add("Item5")
comboCell.Items.Add("Item6")
btnCell = DataGridView2.Item(2, 2)
btnCell.Value = "sdfsadf"
imgCell = DataGridView2.Item(3, 2)
imgCell.Value = bmp
End Sub
mao ni ang screenshots bai

problema nako...ang size sa image..kay if akong padak-an..ang button ma stretch pud...ang akong gusto ma achieve na ma fixed ang width & hieght sa button ug sa ubang objects...din makita ang whole image sa image column. possible ba na bai?.....tabang po pls..