Click here to Skip to main content
15,895,606 members
Home / Discussions / C#
   

C#

 
QuestionProgramming Tcp with C# Pin
Member 1478193513-Apr-20 21:13
Member 1478193513-Apr-20 21:13 
AnswerRe: Programming Tcp with C# Pin
OriginalGriff13-Apr-20 21:25
mveOriginalGriff13-Apr-20 21:25 
GeneralRe: Programming Tcp with C# Pin
Member 1478193519-Apr-20 3:24
Member 1478193519-Apr-20 3:24 
QuestionSaving usercontrol design-time properties Pin
Crazy Joe Devola13-Apr-20 14:49
Crazy Joe Devola13-Apr-20 14:49 
AnswerRe: Saving usercontrol design-time properties Pin
OriginalGriff13-Apr-20 20:00
mveOriginalGriff13-Apr-20 20:00 
AnswerRe: Saving usercontrol design-time properties Pin
Richard Deeming14-Apr-20 0:13
mveRichard Deeming14-Apr-20 0:13 
GeneralRe: Saving usercontrol design-time properties Pin
Crazy Joe Devola14-Apr-20 13:45
Crazy Joe Devola14-Apr-20 13:45 
QuestionPrint Multiple Page in c# Pin
Mohamed Fahad13-Apr-20 9:08
Mohamed Fahad13-Apr-20 9:08 
When i give print on first time it works , but when we click again it over printing


my print document code below


private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.HasMorePages = false;
            gf = e.Graphics;  
            lsx = 10;
            lex = 797;
            Brush brblack = new SolidBrush(Color.Black);
            Pen p1 = new Pen(brblack);            
            int lpx = 10;
            //e.HasMorePages = false;
            if (pgcount < 2)
            {
                dgline = 370;
                dgtxt = 390;
                dgdc = 350;
                lsy1 = 345;
                e.Graphics.DrawImage(img, -10, 0);//header
                e.Graphics.DrawImage(img1, -10, 1000);//footer

                //Quotation
                e.Graphics.DrawString(txtdate.Text, new Font("Times New Roman", 12, FontStyle.Bold), Brushes.Green, 600, 135);//x,y
                e.Graphics.DrawString("Ref :" + txtqtnno.Text, new Font("Times New Roman", 12, FontStyle.Bold), Brushes.Black, 600, 155);
                e.Graphics.DrawString("M/S " + txtclientname.Text, new Font("Times New Roman", 12, FontStyle.Regular), Brushes.Black, lpx, 170);
                e.Graphics.DrawString(companyadd1, new Font("Times New Roman", 12, FontStyle.Regular), Brushes.Black, lpx, 195);
                e.Graphics.DrawString(companyadd2, new Font("Times New Roman", 12, FontStyle.Regular), Brushes.Black, lpx, 220);
                e.Graphics.DrawString("Kind Attn: " + cusname + "\nMob: " + cusno + ", E-mail: " + cusemail, new Font("Times New Roman", 12, FontStyle.Regular), Brushes.Black, lpx, 245);

                e.Graphics.DrawString("Dear Sir,", new Font("Times New Roman", 12, FontStyle.Regular), Brushes.Green, lpx, 295);//x,y
                e.Graphics.DrawString("sub : " + qtnsubject, new Font("Times New Roman", 12, FontStyle.Regular), Brushes.Green, lpx, 320);//x,y
            }
            else
            {
                lsy1 = 135;
                dgline = 155;
                dgtxt = 175;
                dgdc = 137;
            }
                e.Graphics.DrawLine(p1, new Point(lsx, lsy1), new Point(lex, lsy1));
                e.Graphics.DrawString("   Sr. no\t\t        Descrption\t\t\tPrice\t              Qty\t              Amount", new Font("Times New Roman", 12, FontStyle.Bold), Brushes.Green, lpx, dgdc);//x,y
                e.Graphics.DrawLine(p1, new Point(lsx, dgline), new Point(lex, dgline));

            
            for (;drc<dataGridView2.RowCount - 1; drc++)
            {
                SizeF sf = gf.MeasureString(dataGridView2.Rows[drc].Cells[1].Value.ToString(), new Font(new FontFamily("Times New Roman"), 12F), 200);
                rowspace = Convert.ToInt32(sf.Height);
                dgtxt = dgtxt + 10;
                chkpghgt = ((rowspace + dgtxt)*1);

                if (chkpghgt > 1000)
                {
                    e.HasMorePages = true;
                    pgcount++;
                    break;
                }

                gf.DrawString((drc+1).ToString(), new Font(new FontFamily("Times New Roman"), 12F), Brushes.Black, new RectangleF(new Point(50, dgtxt), sf), StringFormat.GenericTypographic);//sr.no
                gf.DrawString(dataGridView2.Rows[drc].Cells[1].Value.ToString(), new Font(new FontFamily("Times New Roman"), 12F), Brushes.Black, new RectangleF(new Point(120, dgtxt), sf), StringFormat.GenericTypographic);//description
                gf.DrawString(dataGridView2.Rows[drc].Cells[3].Value.ToString(), new Font(new FontFamily("Times New Roman"), 12F), Brushes.Black, new RectangleF(new Point(405, dgtxt), sf), StringFormat.GenericTypographic);//perprice
                gf.DrawString(dataGridView2.Rows[drc].Cells[4].Value.ToString(), new Font(new FontFamily("Times New Roman"), 12F), Brushes.Black, new RectangleF(new Point(550, dgtxt), sf), StringFormat.GenericTypographic);//Qty
                gf.DrawString(dataGridView2.Rows[drc].Cells[5].Value.ToString(), new Font(new FontFamily("Times New Roman"), 12F), Brushes.Black, new RectangleF(new Point(690, dgtxt), sf), StringFormat.GenericTypographic);//Amount
                dgline = dgtxt + rowspace + 10;
                e.Graphics.DrawLine(p1, new Point(lsx, dgline), new Point(lex, dgline));
                dgtxt = dgline;               
            }
            //Draw Vertical line
            e.Graphics.DrawLine(p1, new Point(lsx, lsy1), new Point(lsx, dgline));
            e.Graphics.DrawLine(p1, new Point(lsx+80, lsy1), new Point(lsx+80, dgline));
            e.Graphics.DrawLine(p1, new Point(370, lsy1), new Point(370, dgline));
            e.Graphics.DrawLine(p1, new Point(485, lsy1), new Point(485, dgline));
            e.Graphics.DrawLine(p1, new Point(625, lsy1), new Point(625, dgline));
            e.Graphics.DrawLine(p1, new Point(lex, lsy1), new Point(lex, dgline));
        }

AnswerRe: Print Multiple Page in c# Pin
Pete O'Hanlon13-Apr-20 9:30
mvePete O'Hanlon13-Apr-20 9:30 
QuestionMulti threading in c# Pin
User-862169513-Apr-20 1:49
User-862169513-Apr-20 1:49 
AnswerRe: Multi threading in c# Pin
OriginalGriff13-Apr-20 3:00
mveOriginalGriff13-Apr-20 3:00 
QuestionOPC Client Using C# Titanium Library Pin
Member 147907399-Apr-20 20:17
Member 147907399-Apr-20 20:17 
AnswerRe: OPC Client Using C# Titanium Library Pin
Gerry Schmitz10-Apr-20 6:46
mveGerry Schmitz10-Apr-20 6:46 
GeneralRe: OPC Client Using C# Titanium Library Pin
Member 1479073910-Apr-20 7:03
Member 1479073910-Apr-20 7:03 
GeneralRe: OPC Client Using C# Titanium Library Pin
Mycroft Holmes10-Apr-20 12:35
professionalMycroft Holmes10-Apr-20 12:35 
AnswerRe: OPC Client Using C# Titanium Library Pin
Pete O'Hanlon14-Apr-20 5:42
mvePete O'Hanlon14-Apr-20 5:42 
Questiontextbox update Pin
_Q12_9-Apr-20 19:19
_Q12_9-Apr-20 19:19 
AnswerRe: textbox update Pin
_Q12_9-Apr-20 21:20
_Q12_9-Apr-20 21:20 
AnswerRe: textbox update Pin
Gerry Schmitz10-Apr-20 6:43
mveGerry Schmitz10-Apr-20 6:43 
AnswerRe: textbox update Pin
BillWoodruff16-Apr-20 18:06
professionalBillWoodruff16-Apr-20 18:06 
QuestionUpate Exe Build Number Pin
Kevin Marois9-Apr-20 14:05
professionalKevin Marois9-Apr-20 14:05 
AnswerRe: Upate Exe Build Number Pin
Richard Deeming14-Apr-20 0:05
mveRichard Deeming14-Apr-20 0:05 
Questiontraversing two lists simultaneously Pin
Pita329-Apr-20 9:11
Pita329-Apr-20 9:11 
AnswerRe: traversing two lists simultaneously Pin
OriginalGriff9-Apr-20 9:29
mveOriginalGriff9-Apr-20 9:29 
AnswerRe: traversing two lists simultaneously Pin
Dave Kreskowiak9-Apr-20 9:31
mveDave Kreskowiak9-Apr-20 9:31 

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.