rezaei manesh
پنج شنبه 27 تیر 1387, 11:00 صبح
می خوام عکس ها رو از یک مسیر بخونم و در گراید نشون بدم
که تا اینجا با کد زیر این کار رو انجام می دم اما مشکل اینجاست که وقتی برنامه رو می بدنم یک خطای ناشناخته می ده مثل اینکه تصویر هنوز باز باشه یا همچین چیزی
کد زیر:
Dim img As Bitmap
Private Sub gridEX1_FormattingRow(ByVal sender As Object, ByVal e As Janus.Windows.GridEX.RowLoadEventArgs) Handles GridEX1.FormattingRow
If e.Row.RowType = RowType.Record Then
Dim fs As New IO.FileStream(e.Row.Cells("AddressPic").Value, IO.FileMode.Open, IO.FileAccess.Read)
Dim imgData(fs.Length) As Byte
fs.Read(imgData, 0, fs.Length)
fs.Close()
fs.Dispose()
img = Image.FromStream(New IO.MemoryStream(imgData))
img = New Bitmap(img, New Size(Int32.Parse(e.Row.Cells("MelkImage").Column.Width), Int32.Parse(e.Row.Cells("MelkImage").Column.Width - 90)))
'img = New Bitmap(img, e.Row.Cells("MelkImage").FormatStyle.BackgroundImage.Size) 'New Size(Int32.Parse(tw.Text), Int32.Parse(th.Text)))
e.Row.Cells("MelkImage").Image = img 'Image.FromFile(e.Row.Cells("AddressPic").Value)
End If
End Sub
کد مشابه اگه کسی داره بده
که تا اینجا با کد زیر این کار رو انجام می دم اما مشکل اینجاست که وقتی برنامه رو می بدنم یک خطای ناشناخته می ده مثل اینکه تصویر هنوز باز باشه یا همچین چیزی
کد زیر:
Dim img As Bitmap
Private Sub gridEX1_FormattingRow(ByVal sender As Object, ByVal e As Janus.Windows.GridEX.RowLoadEventArgs) Handles GridEX1.FormattingRow
If e.Row.RowType = RowType.Record Then
Dim fs As New IO.FileStream(e.Row.Cells("AddressPic").Value, IO.FileMode.Open, IO.FileAccess.Read)
Dim imgData(fs.Length) As Byte
fs.Read(imgData, 0, fs.Length)
fs.Close()
fs.Dispose()
img = Image.FromStream(New IO.MemoryStream(imgData))
img = New Bitmap(img, New Size(Int32.Parse(e.Row.Cells("MelkImage").Column.Width), Int32.Parse(e.Row.Cells("MelkImage").Column.Width - 90)))
'img = New Bitmap(img, e.Row.Cells("MelkImage").FormatStyle.BackgroundImage.Size) 'New Size(Int32.Parse(tw.Text), Int32.Parse(th.Text)))
e.Row.Cells("MelkImage").Image = img 'Image.FromFile(e.Row.Cells("AddressPic").Value)
End If
End Sub
کد مشابه اگه کسی داره بده