05-01-18, 05:03 AM
شكرا يا اخوان انا لقيت الحل ولمن اراد ان يستفيد
كود :
' انشاء صورة عرضها عدد حروف الباينرى المستخدم
Dim bmp As Bitmap = New Bitmap(Len(Binaryz), 210, System.Drawing.Imaging.PixelFormat.Format24bppRgb)
Dim z As String ' متغير لمعرفة لون الخط
Dim GraphZ As Graphics = Graphics.FromImage(bmp)
Dim RectZ As Rectangle = New Rectangle(0, 0, bmp.Width, bmp.Height) ' مستطيل بحجم الصورة لاعطاء الخلفية باللون الابيض
' فرشاه لدهان المستطيل السابق باللون الابيض
Dim myBrush As Brush = New Drawing.Drawing2D.LinearGradientBrush(RectZ, Color.White, Color.White, Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal)
' دهان المستطيل السابق باللون الابيض
GraphZ.FillRectangle(myBrush, RectZ)
' رسم خطوط الباركود
Dim PenZ As Pen
Dim point1 As Point ' نقطة بداية الخط
Dim point2 As Point ' نقطة نهاية الخط
For I = 1 To Len(Binaryz)
z = Mid(Binaryz, I, 1)
If z = "0" Then
PenZ = New Pen(Color.Black, 1)
point1 = New Point(I, 45)
point2 = New Point(I, 120)
GraphZ.DrawLine(PenZ, point1, point2)
Else
PenZ = New Pen(Color.White, 1)
point1 = New Point(I, 45)
point2 = New Point(I, 120)
GraphZ.DrawLine(PenZ, point1, point2)
End If
Next
' رسم النص المراد ترميزه اسفل الكود
Dim format1 As New StringFormat
format1.Alignment = StringAlignment.Center
GraphZ.DrawString(TheText, New Font("times new roman", 16, FontStyle.Bold), New SolidBrush(Color.Black), bmp.Width / 2, 120, format1)
GraphZ.DrawString(STR, New Font("times new roman", 24, FontStyle.Bold), New SolidBrush(Color.Black), bmp.Width / 2, 0, format1)
GraphZ.DrawString(STR1, New Font("times new roman", 24, FontStyle.Bold), New SolidBrush(Color.Black), bmp.Width / 2, 165, format1)
' ارجاع الصورة النهائية للدالة
Code128 = bmpصلى الله على نبينا محمد
اخيكم / محمود صالح
قال الزهري رحمه الله
مــا عُـــبـِد الله بشئ أفضل من العلم

