04-12-12, 11:40 PM
Osama_Ghareeb كتب :ضعي كل الأدوات التي ستظهر في الصورة في Panel واحد
ثم إستخدمي الأمر التالي :
كود :
Dim Img As New Bitmap([color=#ff0000]Panel1[/color].Width, [color=#ff0000]Panel1[/color].Height)
Dim Save As New SaveFileDialog
Save.Filter = "PNG Image|*.png"
[color=#ff0000]Panel1[/color].DrawToBitmap(Img, New Rectangle(0, 0, [color=#ff0000]Panel1[/color].Width, [color=#ff0000]Panel1[/color].Height))
If Save.ShowDialog = Windows.Forms.DialogResult.OK Then
Img.Save(Save.FileName, Imaging.ImageFormat.Png)
End If
بالتوفيق
شكرا تم تجربة الكود لكن لا تظهر النصوص التي بداخد اداة richtext
وقد وجدت كود في الانتر نت يقوم بالكتابة على صورة
PHP كود :
Public Class Form1
Dim Graph As Graphics
Dim Drawbitmap As Bitmap
Dim Brush As New Drawing.SolidBrush(Color.Black)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dlg As New FontDialog
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then
RichTextBox1.Font = dlg.Font
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim dlg As New ColorDialog
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then
Brush.Color = dlg.Color
RichTextBox1.ForeColor = dlg.Color
End If
End Sub
Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
Drawbitmap = New Bitmap(PictureBox1.Width, PictureBox1.Height)
Graph = Graphics.FromImage(Drawbitmap)
PictureBox1.Image = Drawbitmap
Graph.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
Graph.DrawString(RichTextBox1.Text, RichTextBox1.Font, Brush, PictureBox1.Location)
End Sub
End Class
'You can add save code, if ya want the codes for save, here it is:
' Dim dlg As New SaveFileDialog
'dlg.Filter = "Bitmap|*.bmp"
'If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then
'PictureBox1.Image.Save(dlg.FileName)
'End If

