11-08-19, 09:36 PM
عيد أضحى مبارك
لكل اخواني في الله المسلمين وكل الاصدقاء والزوار على منتدنا فيجوال بيسك لكل العرب
--------------------------
لدي استفسار بخصوص أمر الطباعة لجدول DataGridView1 .
لقد قمت بانشاء كود يتعلق بطباعة محتوى DataGridView1 لكن المشكلة أن الامر يجعل الكود يبدأ من اليسار الى اليمين , وحين اضافة دالة التغيير باستخدام
قام بتغيير جهة الكتابة في الجدول فقط فمثلا id أجدها على اليسار , وأنا اودها على اليمين أرجوا ان يكون السؤال مفهوما لكم وشكرا
كود الطباعة :
لكل اخواني في الله المسلمين وكل الاصدقاء والزوار على منتدنا فيجوال بيسك لكل العرب
--------------------------
لدي استفسار بخصوص أمر الطباعة لجدول DataGridView1 .
لقد قمت بانشاء كود يتعلق بطباعة محتوى DataGridView1 لكن المشكلة أن الامر يجعل الكود يبدأ من اليسار الى اليمين , وحين اضافة دالة التغيير باستخدام
كود :
sf.FormatFlags = sf.FormatFlags Or StringFormatFlags.DirectionRightToLeft
قام بتغيير جهة الكتابة في الجدول فقط فمثلا id أجدها على اليسار , وأنا اودها على اليمين أرجوا ان يكون السؤال مفهوما لكم وشكرا
كود الطباعة :
كود :
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim mRow As Integer = 0
Dim newpage As Boolean = True
With DataGridView1
Dim fmt As StringFormat = New StringFormat(StringFormatFlags.LineLimit)
Dim sf As New StringFormat
sf.Alignment = StringAlignment.Center
sf.LineAlignment = StringAlignment.Center
sf.FormatFlags = sf.FormatFlags Or StringFormatFlags.DirectionRightToLeft
sf.LineAlignment = StringAlignment.Center
sf.Trimming = StringTrimming.EllipsisCharacter
Dim y As Single = 230
Do While mRow < .RowCount
Dim row As DataGridViewRow = .Rows(mRow)
Dim x As Single = 25
Dim h As Single = 0
For Each cell As DataGridViewCell In row.Cells
Dim rc As RectangleF = New RectangleF(x, y, cell.Size.Width, cell.Size.Height)
Dim rrc As RectangleF = New RectangleF(x, 210, cell.Size.Width, cell.Size.Height)
e.Graphics.DrawRectangle(Pens.Black, rc.Left, rc.Top, rc.Width, rc.Height)
e.Graphics.DrawString(DataGridView1.Columns(cell.ColumnIndex).HeaderText, .Font, Brushes.Black, rrc, sf)
e.Graphics.DrawString(DataGridView1.Rows(cell.RowIndex).Cells(cell.ColumnIndex).FormattedValue.ToString(), .Font, Brushes.Black, rc, sf)
'''''------------------CONTENU PAGE **** المحتوى الرسمي للصفحة---------------------
'الخطوط
Dim Font As New System.Drawing.Font("Sakkal Majalla ", 16, FontStyle.Bold)
Dim Font1 As New System.Drawing.Font("Sakkal Majalla ", 12, FontStyle.Bold)
e.Graphics.DrawString("قاعدة البيانات لمختلف الشواهد لإدارية المسملة", Font, Brushes.Red, 300, 100)
e.Graphics.DrawString(TimeOfDay, Font1, Brushes.Black, 25, 44)
e.Graphics.DrawString(DateString, Font1, Brushes.Black, 25, 60)
x += rc.Width
h = Math.Max(h, rc.Height)
Next
newpage = False
y += h
mRow += 1
If y + h > e.MarginBounds.Bottom Then
e.HasMorePages = True
mRow -= 1
newpage = True
Exit Sub
End If
Loop
mRow = 0
End With
End Sub
الحياة فترة اختبار , إما أن تكون او لاتكون
لن امل من البحث ولن امل من السؤال
[b]رواد المعلوميات[/b]