تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
طباعة محتويات PictureBox
#1
كاتب الموضوع : AhmedEssawy

قم بتعريف المتغيرات التالية :


كود :
Private mfntFontStyle As FontStyle
Private mftFont As Font
Private mbrsColor As Brush
Private mgfxGraphics As Graphics
Private mpicPictureBox As PictureBox
Private msngCurPosY As Single = 0
Private msngCurPosX As Single = 0
Private msFontSize As Single = 10
Private StringSize As New SizeF
Private msFontName As String = "Arial"

ومن ثم كود الطباعة :


كود :
Private Sub CriticalError(ByRef sCaption As String, _
ByRef sErrProcedure As String)
Dim sMessage As String
If gbSplashScreen = True Then
frmSplash.Close()
End If
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
With Err()
' Exit on Printer Error (cancel) or Cancel
If Err.Number = 482 Or Err.Number = 32755 Then
Exit Sub
End If
End With
sMessage = "Error: " & Err.Number & vbNewLine & _
"Description: " & Err.Description & vbNewLine & _
"Line #: " & Err.Erl & vbNewLine & _
"Caption: " & sCaption & vbNewLine & _
"Procedure: " & sErrProcedure & vbNewLine
MsgBox(sMessage, MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "ODS Print to Picturebox")
End Sub
Public Sub Print(ByVal sText As String)
On Error GoTo ErrorHandler
mftFont = New Font(msFontName, msFontSize, mfntFontStyle, GraphicsUnit.Pixel)
mgfxGraphics.DrawString(sText, mftFont, mbrsColor, msngCurPosX, msngCurPosY, Drawing.StringFormat.GenericDefault)
mpicPictureBox.Refresh()
StringSize = mgfxGraphics.MeasureString(sText, mftFont)
msngCurPosX = msngCurPosX + StringSize.Width
Exit Sub
ErrorHandler:
CriticalError("modWord4Word", "GetDeviceByName")
End Sub
Public Sub NewLine()
On Error Resume Next
msngCurPosY = msngCurPosY + StringSize.Height
msngCurPosX = 0
End Sub
Public Property FontName() As String
Get
On Error Resume Next
FontName = msFontName
End Get
Set(ByVal sValue As String)
On Error Resume Next
msFontName = sValue
End Set
End Property
Public Property Picturebox() As PictureBox
Get
On Error Resume Next
Picturebox = mpicPictureBox
End Get
Set(ByVal picValue As PictureBox)
On Error GoTo ErrorHandler
mpicPictureBox = picValue
If picValue.Image Is Nothing Then
picValue.Image = Bitmap.FromFile(My.Application.Info.DirectoryPath & "\BlankBackground.bmp")
End If
mgfxGraphics = Graphics.FromImage(picValue.Image)
Exit Property
ErrorHandler:
CriticalError("modWord4Word", "GetDeviceByName")
End Set
End Property
Public Property FontSize() As Single
Get
On Error Resume Next
FontSize = msFontSize
End Get
Set(ByVal sngValue As Single)
On Error Resume Next
msFontSize = sngValue
End Set
End Property
Public Property FontStyle() As FontStyle
Get
On Error Resume Next
FontName = mfntFontStyle
End Get
Set(ByVal Value As FontStyle)
On Error Resume Next
mfntFontStyle = Value
End Set
End Property
Public Property ForeColor() As Brush
Get
On Error Resume Next
ForeColor = mbrsColor
End Get
Set(ByVal Value As Brush)
On Error Resume Next
mbrsColor = Value
End Set
End Property
}}}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  كيفية عمل صورة - مدورة - Rouded PictureBox ! RaggiTech 0 735 17-10-12, 09:55 PM
آخر رد: RaggiTech
  معلومة- لطباعة محتويات ملف بمنتها السهولة RaggiTech 0 321 17-10-12, 08:31 PM
آخر رد: RaggiTech
  تنزيل ملف صورة من موقع ديناميكيا و عرضها في PictureBox RaggiTech 0 301 17-10-12, 05:58 PM
آخر رد: RaggiTech
  Load bitmap into PictureBox using OpenFileDialog RaggiTech 0 308 17-10-12, 04:43 PM
آخر رد: RaggiTech
  كود طباعة تقارير اكسس من خلال الفيجول دوت نت 2008 RaggiTech 0 840 05-10-12, 02:49 AM
آخر رد: RaggiTech

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


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