PDA

View Full Version : دستور چاپ برای یک textBox



rashidi_sm
پنج شنبه 12 اردیبهشت 1392, 11:31 صبح
سلام
من یک کد دارم که dataGridView رو برام چاپ می کنه، ولی می خوام بعد از این که جدول چاپ شد
چند خط بعد یکی از textForm های فرم هم چاپ شود
برای چاپ dataGrid از کد زیر استفاده کردم
//Draw Columns
iTopMargin = e.MarginBounds.Top;
foreach (DataGridViewColumn GridCol in dataGridView1.Columns)
{
e.Graphics.FillRectangle(new SolidBrush(Color.LightGray),
new Rectangle((int)arrColumnLefts[iCount], iTopMargin,
(int)arrColumnWidths[iCount], iHeaderHeight));

e.Graphics.DrawRectangle(Pens.Black,
new Rectangle((int)arrColumnLefts[iCount], iTopMargin,
(int)arrColumnWidths[iCount], iHeaderHeight));

e.Graphics.DrawString(GridCol.HeaderText, GridCol.InheritedStyle.Font,
new SolidBrush(GridCol.InheritedStyle.ForeColor),
new RectangleF((int)arrColumnLefts[iCount], iTopMargin,
(int)arrColumnWidths[iCount], iHeaderHeight), strFormat);
iCount++;
}
bNewPage = false;
iTopMargin += iHeaderHeight;
}
iCount = 0;
//Draw Columns Contents
foreach (DataGridViewCell Cel in GridRow.Cells)
{
if (Cel.Value != null)
{
e.Graphics.DrawString(Cel.Value.ToString(), Cel.InheritedStyle.Font,
new SolidBrush(Cel.InheritedStyle.ForeColor),
new RectangleF((int)arrColumnLefts[iCount], (float)iTopMargin,
(int)arrColumnWidths[iCount], (float)iCellHeight), strFormat);
}
//Drawing Cells Borders
e.Graphics.DrawRectangle(Pens.Black, new Rectangle((int)arrColumnLefts[iCount],
iTopMargin, (int)arrColumnWidths[iCount], iCellHeight));

iCount++;
}

PrinterCounter = iCount;
}
iRow++;
iTopMargin += iCellHeight;
}

//If more lines exist, print another page.
if (bMorePagesToPrint)
e.HasMorePages = true;
else
e.HasMorePages = false;

چه کدی باید بنویسم که این textBox بعد از dataGrid چاپ شود
در ضمن این کد جدول را به جای این که از راست به چپ چاپ کند، از چپ به راست چاپ می کنه
چی کار کنم که این مشکلش حل بشه؟

rashidi_sm
پنج شنبه 12 اردیبهشت 1392, 17:22 عصر
کسی نمی تونه در این زمینه کمکی کنه؟

مهدی هادیان2
پنج شنبه 12 اردیبهشت 1392, 17:29 عصر
بسم الله الرحمن الرحیمم
با سلام
به نظرم بهترین حالت این که از ابزار گزارش گیری استفاده کنید. بهتر است که از همون اول پایه ریزی درستی داشته باشید.
موفق باشید.