منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
خطأ متعلق ب datagridview عند اضافه صوره من PictureBox - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : خطأ متعلق ب datagridview عند اضافه صوره من PictureBox (/showthread.php?tid=22228)



خطأ متعلق ب datagridview عند اضافه صوره من PictureBox - lemozza - 23-10-17

عندى فورم فيها PictureBox و datagridview
وبستخدم مشروع twain لسحب الصور اسكنر Saraff.Twain
المشكله لمى باخد الصوره اسكنر فبتنزل داخل pictureboxوبعدها بنزلها داخل datagridview
لمى بتنزل داخل الdatagrid view اول مره مفيش مشاكل بس بعد ثانى مره او ثالث مره
بتطلع الرساله دى
[attachment=15828]

وده ملخص الرساله
كود :
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: Parameter is not valid.
  at System.Drawing.Image.get_Width()
  at System.Windows.Forms.DataGridViewImageCell.PaintPrivate(Graphics g, Rectangle clipBounds, Rectangle cellBounds, Int32 rowIndex, DataGridViewElementStates elementState, Object formattedValue, String errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts, Boolean computeContentBounds, Boolean computeErrorIconBounds, Boolean paint)
  at System.Windows.Forms.DataGridViewImageCell.GetContentBounds(Graphics graphics, DataGridViewCellStyle cellStyle, Int32 rowIndex)
  at System.Windows.Forms.DataGridViewCell.GetContentBounds(Int32 rowIndex)
  at System.Windows.Forms.DataGridViewCell.OnMouseDownInternal(DataGridViewCellMouseEventArgs e)
  at System.Windows.Forms.DataGridView.OnCellMouseDown(DataGridViewCellMouseEventArgs e)
  at System.Windows.Forms.DataGridView.OnMouseDown(MouseEventArgs e)
  at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at System.Windows.Forms.DataGridView.WndProc(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

ده كود اضافه الصوره داخل data grid view
كود :
dgw.Rows.Add(Picture.Image)

وده كود الاسكنر
كود :
           If Not Me.Picture.Image Is Nothing Then
               Me.Picture.Image.Dispose()
           End If

           Me.Picture.Image = Me._twain32.GetImage(0)

وشكرا لكم على كل حال مع العلم انى لمى بضيف داخل datagridview صور من مجلد او من قاعده البيانات
مش بتظهر الرساله ابدا وشكرا


RE: خطأ متعلق ب datagridview عند اضافه صوره من PictureBox - silverlight - 23-10-17

عليك أن تأخذ نسخة من الصورة الموجود في البكتشر بوكس باسخدام Clone ولا تأخذ الصورة بشكل مباشر
خاصة انك تقوم بعمل Dispsoe للصورة الموجودة في الكتشر بوكس


RE: خطأ متعلق ب datagridview عند اضافه صوره من PictureBox - lemozza - 23-10-17

(23-10-17, 10:33 PM)silverlight كتب : عليك أن تأخذ نسخة من الصورة الموجود في البكتشر بوكس باسخدام Clone ولا تأخذ الصورة بشكل مباشر
خاصة انك تقوم بعمل Dispsoe للصورة الموجودة في الكتشر بوكس


ممكن مثال بسيط او تعديل الكود بعد اذنك 
انا 3 شهور بس فى البرمجه واسف لو هتعبك معايا


RE: خطأ متعلق ب datagridview عند اضافه صوره من PictureBox - silverlight - 23-10-17

PHP كود :
Dim cloned As Bitmap Picture.Image.Clone()
dgw.Rows.Add(cloned

لو لم يقيدك هذا الحل
هنا عليك أن تحفظ الصور التي تأخذها من scanner في مكان ما علي الهارد ديسك
ثم تتعمل مع الصور التي تم حفظها علي الهارد ديسك و تقرأها و تملا بها الداتا جريد فيو