Click here to Skip to main content
15,890,527 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How can I distribute a VB6 application with NSIS? Pin
fancyRocko27-Sep-12 22:49
fancyRocko27-Sep-12 22:49 
GeneralRe: How can I distribute a VB6 application with NSIS? Pin
Eddy Vluggen27-Sep-12 23:03
professionalEddy Vluggen27-Sep-12 23:03 
GeneralRe: How can I distribute a VB6 application with NSIS? Pin
Dave Kreskowiak28-Sep-12 1:16
mveDave Kreskowiak28-Sep-12 1:16 
GeneralRe: How can I distribute a VB6 application with NSIS? Pin
fancyRocko28-Sep-12 1:25
fancyRocko28-Sep-12 1:25 
AnswerRe: How can I distribute a VB6 application with NSIS? Pin
jrumage5-Oct-12 2:00
jrumage5-Oct-12 2:00 
QuestionPrinting Datagridview content plus header and footer in vb.net 2010 Pin
sali2226-Sep-12 20:40
sali2226-Sep-12 20:40 
AnswerRe: Printing Datagridview content plus header and footer in vb.net 2010 Pin
Abhinav S26-Sep-12 21:00
Abhinav S26-Sep-12 21:00 
AnswerRe: Printing Datagridview content plus header and footer in vb.net 2010 Pin
sali2226-Sep-12 21:13
sali2226-Sep-12 21:13 
Static oColumnLefts As New ArrayList
Static oColumnWidths As New ArrayList
Static oColumnTypes As New ArrayList
Static nHeight As Int16
Dim nWidth, i, nRowsPerPage As Int16
Dim nTop As Int16 = e.MarginBounds.Top
Dim nLeft As Int16 = e.MarginBounds.Left
If nPageNo = 1 Then
For Each oColumn As DataGridViewColumn In frmLedger.dgvLedger.Columns
nWidth = CType(Math.Floor(oColumn.Width / nTotalWidth * nTotalWidth * (e.MarginBounds.Width / nTotalWidth)), Int16)
nHeight = e.Graphics.MeasureString(oColumn.HeaderText, oColumn.InheritedStyle.Font, nWidth).Height + 11
oColumnLefts.Add(nLeft)
oColumnWidths.Add(nWidth)
oColumnTypes.Add(oColumn.GetType)
nLeft += nWidth
Next
End If
Do While nRowPos < frmLedger.dgvLedger.Rows.Count - 1
Dim oRow As DataGridViewRow = frmLedger.dgvLedger.Rows(nRowPos)
If nTop + nHeight >= e.MarginBounds.Height + e.MarginBounds.Top Then
DrawFooter(e, nRowsPerPage)
NewPage = True
nPageNo += 1
e.HasMorePages = True
Exit Sub
Else
If NewPage Then
' Draw Header
e.Graphics.DrawString(Header, New Font(frmLedger.dgvLedger.Font, FontStyle.Bold), Brushes.Black, e.MarginBounds.Left, e.MarginBounds.Top - e.Graphics.MeasureString(Header, New Font(frmLedger.dgvLedger.Font, FontStyle.Bold), e.MarginBounds.Width).Height - 13)
' Draw Columns
nTop = e.MarginBounds.Top
i = 0
For Each oColumn As DataGridViewColumn In frmLedger.dgvLedger.Columns
e.Graphics.FillRectangle(New SolidBrush(Drawing.Color.LightGray), New Rectangle(oColumnLefts(i), nTop, oColumnWidths(i), nHeight))
e.Graphics.DrawRectangle(Pens.Black, New Rectangle(oColumnLefts(i), nTop, oColumnWidths(i), nHeight))
e.Graphics.DrawString(oColumn.HeaderText, oColumn.InheritedStyle.Font, New SolidBrush(oColumn.InheritedStyle.ForeColor), New RectangleF(oColumnLefts(i), nTop, oColumnWidths(i), nHeight), oStringFormat)
i += 1
Next
NewPage = False
End If
nTop += nHeight
i = 0
For Each oCell As DataGridViewCell In oRow.Cells
If oColumnTypes(i) Is GetType(DataGridViewTextBoxColumn) OrElse oColumnTypes(i) Is GetType(DataGridViewLinkColumn) Then
e.Graphics.DrawString(oCell.Value.ToString, oCell.InheritedStyle.Font, New SolidBrush(oCell.InheritedStyle.ForeColor), New RectangleF(oColumnLefts(i), nTop, oColumnWidths(i), nHeight), oStringFormat)
ElseIf oColumnTypes(i) Is GetType(DataGridViewButtonColumn) Then
oButton.Text = oCell.Value.ToString
oButton.Size = New Size(oColumnWidths(i), nHeight)
Dim oBitmap As New Bitmap(oButton.Width, oButton.Height)
oButton.DrawToBitmap(oBitmap, New Rectangle(0, 0, oBitmap.Width, oBitmap.Height))
e.Graphics.DrawImage(oBitmap, New Point(oColumnLefts(i), nTop))
ElseIf oColumnTypes(i) Is GetType(DataGridViewCheckBoxColumn) Then
oCheckbox.Size = New Size(14, 14)
oCheckbox.Checked = CType(oCell.Value, Boolean)
Dim oBitmap As New Bitmap(oColumnWidths(i), nHeight)
Dim oTempGraphics As Graphics = Graphics.FromImage(oBitmap)
oTempGraphics.FillRectangle(Brushes.White, New Rectangle(0, 0, oBitmap.Width, oBitmap.Height))
oCheckbox.DrawToBitmap(oBitmap, New Rectangle(CType((oBitmap.Width - oCheckbox.Width) / 2, Int32), CType((oBitmap.Height - oCheckbox.Height) / 2, Int32), oCheckbox.Width, oCheckbox.Height))
e.Graphics.DrawImage(oBitmap, New Point(oColumnLefts(i), nTop))
ElseIf oColumnTypes(i) Is GetType(DataGridViewComboBoxColumn) Then
oComboBox.Size = New Size(oColumnWidths(i), nHeight)
Dim oBitmap As New Bitmap(oComboBox.Width, oComboBox.Height)
oComboBox.DrawToBitmap(oBitmap, New Rectangle(0, 0, oBitmap.Width, oBitmap.Height))
e.Graphics.DrawImage(oBitmap, New Point(oColumnLefts(i), nTop))
e.Graphics.DrawString(oCell.Value.ToString, oCell.InheritedStyle.Font, New SolidBrush(oCell.InheritedStyle.ForeColor), New RectangleF(oColumnLefts(i) + 1, nTop, oColumnWidths(i) - 16, nHeight), oStringFormatComboBox)
ElseIf oColumnTypes(i) Is GetType(DataGridViewImageColumn) Then
Dim oCellSize As Rectangle = New Rectangle(oColumnLefts(i), nTop, oColumnWidths(i), nHeight)
Dim oImageSize As Size = CType(oCell.Value, Image).Size
e.Graphics.DrawImage(oCell.Value, New Rectangle(oColumnLefts(i) + CType(((oCellSize.Width - oImageSize.Width) / 2), Int32), nTop + CType(((oCellSize.Height - oImageSize.Height) / 2), Int32), CType(oCell.Value, Image).Width, CType(oCell.Value, Image).Height))
End If
e.Graphics.DrawRectangle(Pens.Black, New Rectangle(oColumnLefts(i), nTop, oColumnWidths(i), nHeight))
i += 1
Next
End If
nRowPos += 1
nRowsPerPage += 1
Loop
DrawFooter(e, nRowsPerPage)
e.HasMorePages = False
End Sub
Private Sub DrawFooter(ByVal e As System.Drawing.Printing.PrintPageEventArgs, ByVal RowsPerPage As Int32)
Dim sPageNo As String = nPageNo.ToString + " of " + Math.Ceiling(frmLedger.dgvLedger.Rows.Count / RowsPerPage).ToString
' Right Align - User Name
e.Graphics.DrawString(sUserName, frmLedger.dgvLedger.Font, Brushes.Black, e.MarginBounds.Left + (e.MarginBounds.Width - e.Graphics.MeasureString(sPageNo, frmLedger.dgvLedger.Font, e.MarginBounds.Width).Width), e.MarginBounds.Top + e.MarginBounds.Height + 7)
' Left Align - Date/Time
e.Graphics.DrawString(Now.ToLongDateString + " " + Now.ToShortTimeString, frmLedger.dgvLedger.Font, Brushes.Black, e.MarginBounds.Left, e.MarginBounds.Top + e.MarginBounds.Height + 7)
' Center - Page No. Info
e.Graphics.DrawString(sPageNo, frmLedger.dgvLedger.Font, Brushes.Black, e.MarginBounds.Left + (e.MarginBounds.Width - e.Graphics.MeasureString(sPageNo, frmLedger.dgvLedger.Font, e.MarginBounds.Width).Width) / 2, e.MarginBounds.Top + e.MarginBounds.Height + 31)
End Sub
QuestionBefore a Control loses focus can I detect the next focus target? Pin
Richard Fairhurst26-Sep-12 9:05
Richard Fairhurst26-Sep-12 9:05 
AnswerRe: Before a Control loses focus can I detect the next focus target? Pin
Richard Fairhurst26-Sep-12 10:32
Richard Fairhurst26-Sep-12 10:32 
QuestionTelephone Tracking system through GPS Pin
waner michaud26-Sep-12 8:12
waner michaud26-Sep-12 8:12 
AnswerRe: Telephone Tracking system through GPS Pin
Eddy Vluggen27-Sep-12 0:16
professionalEddy Vluggen27-Sep-12 0:16 
QuestionDatagrid row count equals zero Pin
Cesar00226-Sep-12 6:49
Cesar00226-Sep-12 6:49 
AnswerRe: Datagrid row count equals zero Pin
Cesar00226-Sep-12 10:05
Cesar00226-Sep-12 10:05 
QuestionRe: Datagrid row count equals zero Pin
Eddy Vluggen26-Sep-12 10:32
professionalEddy Vluggen26-Sep-12 10:32 
AnswerRe: Datagrid row count equals zero Pin
Cesar00226-Sep-12 16:28
Cesar00226-Sep-12 16:28 
QuestionTricky SQL Question Pin
ttocsmi25-Sep-12 10:42
ttocsmi25-Sep-12 10:42 
AnswerRe: Tricky SQL Question Pin
Martijn Kok25-Sep-12 11:40
Martijn Kok25-Sep-12 11:40 
GeneralRe: Tricky SQL Question Pin
ttocsmi25-Sep-12 14:13
ttocsmi25-Sep-12 14:13 
GeneralRe: Tricky SQL Question Pin
Bernhard Hiller25-Sep-12 23:13
Bernhard Hiller25-Sep-12 23:13 
GeneralRe: Tricky SQL Question Pin
Martijn Kok25-Sep-12 23:27
Martijn Kok25-Sep-12 23:27 
GeneralRe: Tricky SQL Question Pin
ttocsmi1-Oct-12 1:56
ttocsmi1-Oct-12 1:56 
GeneralRe: Tricky SQL Question Pin
ttocsmi1-Oct-12 1:51
ttocsmi1-Oct-12 1:51 
AnswerRe: Tricky SQL Question Pin
Bernhard Hiller25-Sep-12 23:15
Bernhard Hiller25-Sep-12 23:15 
GeneralRe: Tricky SQL Question Pin
ttocsmi1-Oct-12 2:12
ttocsmi1-Oct-12 2:12 

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.