تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
سؤالي عن a generic error occurred in gdi+
#2
لله الحمد انحلت معي القصة ..
سأترك هنا الحل لعل غيري يستفيد منه ولا نريد إلا الدعاء 
المشكلة كانت في الكتابة على نفس الملف .. بينما إذا كان صورة جديدة بإسم جديد فإن الكود يشتغل تمام 

الحل هو بمجرد أن أقوم بإنشاء صورة نقطية Bitmap من صورة ، فإنني أتخلص من الصورة النقطية  Bitmap الأصلية 
ومن ثم فأنا قادر على الكتابة فوق نفس الملف بالصورة النقطية المحدثة.


كود :
Dim oBitmap As Bitmap
oBitmap = New Bitmap("c:\\example.jpg")
Dim oGraphic As Graphics
' Here create a new bitmap object of the same height and width of the image.
Dim bmpNew As Bitmap = New Bitmap(oBitmap.Width, oBitmap.Height)
oGraphic = Graphics.FromImage(bmpNew)
oGraphic.DrawImage(oBitmap, New Rectangle(0, 0, _
bmpNew.Width, bmpNew.Height), 0, 0, oBitmap.Width, _
oBitmap.Height, GraphicsUnit.Pixel)
' Release the lock on the image file. Of course,
' image from the image file is existing in Graphics object
oBitmap.Dispose()
oBitmap = bmpNew

Dim oBrush As New SolidBrush(Color.Black)
Dim ofont As New Font("Arial", 8 )
oGraphic.DrawString("Some text to write", ofont, oBrush, 10, 10)
oGraphic.Dispose()
ofont.Dispose()
oBrush.Dispose()
oBitmap.Save("c:\\example.jpg", ImageFormat.Jpe



ارجو ان اكون قد وفقت في شرح الحل
الرد }}}
تم الشكر بواسطة: ابراهيم ايبو , ابراهيم ايبو


الردود في هذا الموضوع
RE: سؤالي عن a generic error occurred in gdi+ - بواسطة ahmed_elwerfalli - 01-02-22, 02:28 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم