Click here to Skip to main content
16,020,103 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionsystem shutdown Pin
M269-May-07 7:13
M269-May-07 7:13 
AnswerRe: system shutdown Pin
Dave Kreskowiak9-May-07 7:20
mveDave Kreskowiak9-May-07 7:20 
Generalok ... this is my code Pin
M2610-May-07 6:19
M2610-May-07 6:19 
GeneralRe: ok ... this is my code Pin
Dave Kreskowiak10-May-07 12:37
mveDave Kreskowiak10-May-07 12:37 
QuestionPlay Midi File/MP3 from Application Pin
RichardBerry9-May-07 4:33
RichardBerry9-May-07 4:33 
AnswerRe: Play Midi File/MP3 from Application Pin
Dave Kreskowiak9-May-07 6:24
mveDave Kreskowiak9-May-07 6:24 
GeneralRe: Play Midi File/MP3 from Application Pin
RichardBerry9-May-07 22:47
RichardBerry9-May-07 22:47 
GeneralPrint DataSet (DataGrid) Pin
moiid639-May-07 4:10
moiid639-May-07 4:10 
'----------------------------- كنترل هاي مورد استفاده
'-------------PageSetupDialog
'-------------PrintDocument
'-------------PrintPreviewDialog
'--------------------------------------------------------------

Private Sub MnItmPRINT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnItmPRINT.Click

If -DataSet-Name- .Rows.Count > 0 Then
CountLine = 0
NumberColumnsForPrint = -DataSet-Name- .Columns.Count
Titr = " جدول ..."

'-در اين صفحه متغيير هاي سراسري را كاربر تنظيم مي كند
'-مانند تعداد ستونها يا نوع خط جدول و ...
Dim OBJ As New PrintSettingPAGE()
OBJ.ShowDialog()

PageSetupDialog1.ShowDialog()
PrintPreviewDialog1.ShowDialog()
Else
MsgBox("اطلاعاتي براي پرينت وجود ندارد", MsgBoxStyle.OKOnly, "")
End If
End Sub

'------------------------------------------------------------------
'----------------------------- توابع مورد نياز پرينت ---------------
'------------------------------------------------------------------- Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
'----------------------------- متغير هاي سراسري استفاده شده-------------'-------------dim VerticalPAGE as Boolean افقي يا عمودي بودن صفحه
'-------------dim NumberColumnsForPrint as integer
'--------DirectionVertical تعداد ستونهاي ديتاست كه ميخواهيم چاپ كنيم
'-------------dim LinesPerPage as Integer تعداد خطهاي هر صفحه
'-------------dim Titr as String تيتر هر صفحه
'-------------------------------------------------------------- '''''''''''''''''''''''''''''''''''''''''
AxProgressBar2.Visible = True
AxProgressBar2.Value = 1
''''''''''''''''''''''''''''''''''''''''
Dim xCell As Integer
Dim yCell As Integer
Dim WidthCell As Integer
Dim xTITR As Integer
Dim yTITR As Integer
Dim HeightTITR As Integer
Dim WidthTITR As Integer
'--------------------------------------------------------------
'------------مقدار دهي اندازه ها و موقعيت سلول هاي جدول
'--------------------------------------------------------------

yTITR = CInt(PageSetupDialog1.PageSettings.Margins.Top)
xTITR = CInt(PageSetupDialog1.PageSettings.Margins.Left)
If PageSetupDialog1.PageSettings.Landscape = True Then
WidthTITR = CInt(PageSetupDialog1.PageSettings.PaperSize.Height) - (xTITR + CInt(PageSetupDialog1.PageSettings.Margins.Right))
Else
WidthTITR = CInt(PageSetupDialog1.PageSettings.PaperSize.Width) - (xTITR + CInt(PageSetupDialog1.PageSettings.Margins.Right))
End If
HeightTITR = 35
xCell = PageSetupDialog1.PageSettings.Margins.Left
yCell = yTITR + HeightTITR

WidthCell = CInt(WidthTITR \ NumberColumnsForPrint)
'--------------------------------------------------------------
'------------محاسبه تعداد خطهاي هر صفحه
Dim LinesPerPage As Integer
If PageSetupDialog1.PageSettings.Landscape = True Then
LinesPerPage = CInt((CInt(PageSetupDialog1.PageSettings.PaperSize.Width) - (yTITR + HeightTITR + HeightHeaderCell + CInt(PageSetupDialog1.PageSettings.Margins.Bottom))) \ HeightCell)
Else
LinesPerPage = CInt((CInt(PageSetupDialog1.PageSettings.PaperSize.Height) - (yTITR + HeightTITR + HeightHeaderCell + CInt(PageSetupDialog1.PageSettings.Margins.Bottom))) \ HeightCell)
End If
'---------------------------------------------------------------------- Dim RectF As RectangleF
If -DataSet-Name- .Rows.Count <> 0 Then
'----------------------------------------------------------
'------------ نوشتن متن تيتر
'---------------------------------------------------------- Dim StrForm As StringFormat
StrForm = New StringFormat(StringFormatFlags.DirectionRightToLeft)
StrForm.Alignment = StringAlignment.Center
StrForm.LineAlignment = StringAlignment.Center
RectF.X = xTITR ' xTITR = 15 or 790
RectF.Y = yTITR ' yTITR = 15 or 15
RectF.Height = HeightTITR ' HeightTITR = 25 or 25
RectF.Width = WidthTITR ' WidthTITR = 750 or 1140
e.Graphics.DrawString(Titr, TitrFont, Brushes.Black, RectF, StrForm)
'----------------------------------------------------------
'------------ نوشتن سطرها
'---------------------------------------------------------- RectF.X = xCell
RectF.Y = yCell + HeightHeaderCell
RectF.Width = WidthCell
RectF.Height = HeightCell
StrForm.Alignment = StringAlignment.Far
StrForm.LineAlignment = StringAlignment.Far
Dim PrintFont As New Font("Arial", 10)
PrintFont = DataGrid1.Font
Dim StrField As String '' براي دريافت فيلدهاي جدول
Dim counter As Integer '' شمارهنده
For I2 = 0 To LinesPerPage - 1
RectF.X = xCell
For I = (NumberColumnsForPrint - 1) To 0 Step -1
StrField = " " & CStr( -DataSet-Name- .Rows(CountLine).Item(I))
e.Graphics.DrawRectangle(PenRow, RectF.X, RectF.Y, RectF.Width, RectF.Height)

e.Graphics.DrawString(StrField, PrintFont, Brushes.Black, RectF, StrForm)

RectF.X += WidthCell
StrField = ""
Next
RectF.Y += HeightCell
CountLine += 1
If -DataSet-Name- .Rows.Count = CountLine Then
Exit For
End If
Next
'----------------------------------------------------------
'------------ كشيدن نام ستونها فقط 12 ستون
'---------------------------------------------------------- StrForm.Alignment = StringAlignment.Center
StrForm.LineAlignment = StringAlignment.Center
RectF.X = xCell
RectF.Y = yCell
RectF.Width = WidthCell
RectF.Height = HeightHeaderCell
PrintFont = DataGrid1.HeaderFont
For I = (NumberColumnsForPrint - 1) To 0 Step -1
StrField = CStr( -DataSet-Name- .Columns(I).ColumnName)
e.Graphics.DrawRectangle(PenColumn, RectF.X, RectF.Y, RectF.Width, RectF.Height)

e.Graphics.DrawString(StrField, PrintFont, Brushes.Black, RectF, StrForm)

RectF.X += WidthCell
StrField = ""
Next
End If
'--------------------------------------------------------------
'------------اگر تعداد خطها زياد شد بايد صفحه ديگر ايجاد شود
'------------در غير اين صورت صفحه جديد نبايد توليد شود
'-------------------------------------------------------------- If CountLine < -DataSet-Name- .Rows.Count Then
e.HasMorePages = True
Else
CountLine = 0
e.HasMorePages = False
End If
End Sub
GeneralRe: Print DataSet (DataGrid) Pin
Dave Kreskowiak9-May-07 4:48
mveDave Kreskowiak9-May-07 4:48 
QuestionPlease Help!! Please Pin
tcombs079-May-07 3:07
tcombs079-May-07 3:07 
AnswerRe: Please Help!! Please Pin
SimulationofSai9-May-07 4:18
SimulationofSai9-May-07 4:18 
GeneralRe: Please Help!! Please Pin
tcombs0710-May-07 8:00
tcombs0710-May-07 8:00 
Questionsend code Pin
bcsf05a0229-May-07 2:27
bcsf05a0229-May-07 2:27 
AnswerRe: send code Pin
Dave Kreskowiak9-May-07 3:18
mveDave Kreskowiak9-May-07 3:18 
Questionhow to insert values into msaccess from vb.net win app? Pin
sathyan_82949-May-07 2:25
sathyan_82949-May-07 2:25 
AnswerRe: how to insert values into msaccess from vb.net win app? Pin
Christian Graus9-May-07 15:05
protectorChristian Graus9-May-07 15:05 
Questionhow to insert the entering values into msaccess from vb.net windows application? Pin
sathyan_82949-May-07 2:23
sathyan_82949-May-07 2:23 
Questionvb connection with sql server 2000 Pin
bcsf05a0229-May-07 2:23
bcsf05a0229-May-07 2:23 
Questionhow to insert or save the entering values into msaccess from vb.net windows application? Pin
sathyan_82949-May-07 2:20
sathyan_82949-May-07 2:20 
AnswerRe: how to insert or save the entering values into msaccess from vb.net windows application? Pin
Tarakeshwar Reddy9-May-07 3:20
professionalTarakeshwar Reddy9-May-07 3:20 
Questionvb connection with sql server 2000 Pin
bcsf05a0229-May-07 2:19
bcsf05a0229-May-07 2:19 
QuestionIn Datagridview, new row added is not showing Pin
nageshk4u9-May-07 2:04
nageshk4u9-May-07 2:04 
QuestionImage magnification Pin
Beginner_HC9-May-07 1:45
Beginner_HC9-May-07 1:45 
QuestionRadioButtonList Enabled Problem [modified] Pin
sonia_basangar9-May-07 1:29
sonia_basangar9-May-07 1:29 
AnswerRe: RadioButtonList Enabled Problem Pin
Christian Graus9-May-07 1:43
protectorChristian Graus9-May-07 1:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.