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 Data
sali22
Posts
-
Printing Datagridview content plus header and footer in vb.net 2010 -
Printing Datagridview content plus header and footer in vb.net 2010Dear Friends, i have problem by printing Datagridview content plus header and footer. i can print exactly DataGridView , but i want to print out the content only (plain text)+ header and footer in vb.net 2010 is anybody can help me to do this !? Your help would be greatly appreciated Thanks in advance
-
passing parameter in report viewer by using visual studio 2010Dear friends, i have been trying to get report in visual studio 2010 by passing parameters such as startDate, endDate and etc. but i haven't done it yet :( Can someone help me to generate this report by using report viewer . preferred Language = vb.net
-
Retrieve records from sqlserver 2005 which are today insertedi have found it :) WHERE LASTUPDATEON >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) AND LASTUPDATEON < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1)
-
Retrieve records from sqlserver 2005 which are today insertedGood day, I want to retrieve records from sql server 2005 that belongs to today, my datatype in sqlserver is : datetime and store date like : 9/5/2012 12:55:26 PM So i want to know how can I write a query to retrieve only today's records. Thanks in advance
-
How to Pass Parameter to Report Viewer ( vb.net 2010 ) ?Hi guys , I have tried to make a parametric report in visual studio 2010 by using VB.net, but i haven't done yet. can anybody help me how to do this ?
-
why does this not work?Perhaps you have used Unicode for designing your webpage, beside that "session_start()" must be the first line of your web page . so some times one code has been added to the page for encoding purpose. it's better to use standard PHP editor like "Zend Studio" to see and remove this code before session_start()
-
Writng a non-database specific code in PHPhi , if you want to connect to the Mysql database you can use the below code to connect and select your database
";
mysql_select_db("test") or die(mysql_error());
echo "Connected to Database";
?>