Hello,
I develop stock manager application for my company
I've a error message converter can't convert
With VS2013 DataGridView, it's work but not with RadGridView
My code :
Private Sub MasterTemplate_CellClick(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles RadGridView1.CellClick
If e.ColumnIndex = 0 Then
Dim oCell As GridViewCellInfo = DirectCast(RadGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex), GridViewCellInfo)
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
Dim oImage As Image = Image.FromFile(OpenFileDialog1.FileName)
oCell.Value = resizeImage(oImage, 48, 48)
Else
Dim oResult As DialogResult = MessageBox.Show("Voulez-vous supprimer l'icône associée à ce produit ?", "Icône du produit", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If oResult = Windows.Forms.DialogResult.Yes Then oCell.Value = Nothing
End If
End If
End Sub
Private Function resizeImage(ByVal oImage As Image, iWidth As Integer, iHeight As Integer) As Image
Dim oSource As Bitmap = New Bitmap(oImage)
Dim dScale As Double = oSource.Height / oSource.Width
Dim oDest As New Bitmap(iWidth, iHeight)
Dim gDest As Graphics = Graphics.FromImage(oDest)
With gDest
.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality
.DrawImage(oSource, 0, 0, oDest.Width, oDest.Height)
Return oDest
End With
End Function
I develop stock manager application for my company
I've a error message converter can't convert
With VS2013 DataGridView, it's work but not with RadGridView
My code :
Private Sub MasterTemplate_CellClick(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles RadGridView1.CellClick
If e.ColumnIndex = 0 Then
Dim oCell As GridViewCellInfo = DirectCast(RadGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex), GridViewCellInfo)
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
Dim oImage As Image = Image.FromFile(OpenFileDialog1.FileName)
oCell.Value = resizeImage(oImage, 48, 48)
Else
Dim oResult As DialogResult = MessageBox.Show("Voulez-vous supprimer l'icône associée à ce produit ?", "Icône du produit", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If oResult = Windows.Forms.DialogResult.Yes Then oCell.Value = Nothing
End If
End If
End Sub
Private Function resizeImage(ByVal oImage As Image, iWidth As Integer, iHeight As Integer) As Image
Dim oSource As Bitmap = New Bitmap(oImage)
Dim dScale As Double = oSource.Height / oSource.Width
Dim oDest As New Bitmap(iWidth, iHeight)
Dim gDest As Graphics = Graphics.FromImage(oDest)
With gDest
.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality
.DrawImage(oSource, 0, 0, oDest.Width, oDest.Height)
Return oDest
End With
End Function