(30-10-16, 11:06 PM)جوري كتب : السلام عليكم ورحمة الله وبركاتهشكرا اخواني الكرام تم الحل وهذه هي الطريقه
الاخوه الكرام تقبلو فائق الاحترام
ارجو مساعدتي في
إضافه نص الي صوره بحيث يكون اسفل الصوره بدون استقطاع اي جزء منها
اي انه اضافه للصوره ويكون جزء منها عند الحفظ
وهذه صورة للتوضيح
ولكم جزيل الشكر
حسناً كبدايه انا استطيع اضافة نص علي الصوره وجعله يصل الي اسفلها ولكنه يتواجد فوقها من الاسفل وانا اريده اسفلها بمسافهكود :
Dim gr As Graphics
Dim dr_bitmab As Bitmap
Dim penprush As New Drawing.SolidBrush(Color.Black)
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
dr_bitmab = New Bitmap(PictureBox2.Image)
'Dim cono As Bitmap = New Bitmap(PictureBox2.Width, PictureBox2.Height + 50)
gr = Graphics.FromImage(dr_bitmab)
imgQR.Image = dr_bitmab
gr.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
'gr.DrawString(RichTextBox1.Text, RichTextBox1.Font, penprush, PictureBox2.Location)
gr.DrawString(TextBox3.Text, New Font("Times New Roman", 16, FontStyle.Bold), New SolidBrush(Color.Red), New PointF(5, 90))
'dr_bitmab. Save (TextBox2.Text, System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
كود :
Public Function AddBorder(ByVal bm As Bitmap, ByVal borderColor As System.Drawing.Color, ByVal borderWidthInPixels As Integer) As Bitmap
Dim newBitmap As New Bitmap(bm.Width + (borderWidthInPixels * 2), bm.Height + (borderWidthInPixels * 2))
'************************************************************************
' Draw the border
'************************************************************************
' Top
For x As Integer = 0 To newBitmap.Width - 1
For y As Integer = 0 To borderWidthInPixels
newBitmap.SetPixel(x, y, borderColor)
Next
Next
' Bottom
For x As Integer = 0 To newBitmap.Width - 1
For y As Integer = newBitmap.Height - 1 To (newBitmap.Height - 1) - borderWidthInPixels Step -1
newBitmap.SetPixel(x, y, borderColor)
Next
Next
' Left
For x As Integer = 0 To borderWidthInPixels
For y As Integer = 0 To newBitmap.Height - 1
newBitmap.SetPixel(x, y, borderColor)
Next
Next
' Right
For x As Integer = newBitmap.Width - 1 To (newBitmap.Width - 1) - borderWidthInPixels Step -1
For y As Integer = 0 To newBitmap.Height - 1
newBitmap.SetPixel(x, y, borderColor)
Next
Next
'************************************************************************
' Insert the old image into the bitmap
'************************************************************************
Dim gr As System.Drawing.Graphics = Graphics.FromImage(newBitmap)
gr.DrawImage(bm, borderWidthInPixels, borderWidthInPixels, bm.Width, bm.Height)
gr.Dispose()
Return newBitmap
End Functionاستدعيتها هكذا بداخل button
كود :
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Dim bm As New Bitmap(PictureBox3.Image)
PictureBox2.Image = AddBorder(bm, Color.White, 10)
End Subاستطيع الان وضع النص في الاطار الذي يلف الصوره كما هو موضح في هذا الكود من خلال زياده قيمة الارتفاع
كود :
gr.DrawString(TextBox3.Text, New Font("Times New Roman", 16, FontStyle.Bold), New SolidBrush(Color.Red), New PointF(5, 90))هذا الرد للايضاح فقط
اتمني ان تكون مشاركتي إثراء للموضوع وليست إعسار له

