Click here to Skip to main content
15,949,686 members
Home / Discussions / C#
   

C#

 
GeneralRe: Make a program run at startup? Pin
J a a n s24-Jan-08 20:59
professionalJ a a n s24-Jan-08 20:59 
QuestionRe: Make a program run at startup? Pin
methhoo25-Jan-08 4:58
methhoo25-Jan-08 4:58 
Generalselecting table adapters in datasets Pin
Glen Harvy24-Jan-08 11:15
Glen Harvy24-Jan-08 11:15 
GeneralRe: selecting table adapters in datasets Pin
Gareth H24-Jan-08 11:37
Gareth H24-Jan-08 11:37 
GeneralRe: selecting table adapters in datasets Pin
Glen Harvy24-Jan-08 13:23
Glen Harvy24-Jan-08 13:23 
QuestionPrint multiple copies of a page? Pin
DaleEMoore24-Jan-08 10:49
DaleEMoore24-Jan-08 10:49 
GeneralRe: Print multiple copies of a page? Pin
Gareth H24-Jan-08 10:59
Gareth H24-Jan-08 10:59 
GeneralRe: Print multiple copies of a page? Pin
DaleEMoore24-Jan-08 11:22
DaleEMoore24-Jan-08 11:22 
Thank you for the dialog; I fear I have been unclear in my specification! I want to print multiple copies of a multi-page document. So
printDoc.PrinterSettings.Copies = dlg.PrinterSettings.Copies;
should set the copies and the number gets stuffed, but it seems to only control the first printing. And I've changed the source code, below, to identify the numberOfPages which also only seems to work on the first printing.

using System;
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
namespace MultipleCopies
{
    public partial class Form2 : Form
    {
        private PrintDocument printDoc = new PrintDocument();
        private int numberOfPages;
        public Form2()
        {
		InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
		printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage); 
		PrintDialog dlg = new PrintDialog();
		dlg.PrinterSettings = new PrinterSettings();
		if (dlg.ShowDialog() == DialogResult.OK) {
                	printDoc.PrinterSettings.Copies = dlg.PrinterSettings.Copies;
                	numberOfPages = 2;
			printDoc.Print();			
		}
        }
        private void printDoc_PrintPage(Object sender, PrintPageEventArgs e) 
	{
		String textToPrint = "Printing copies " + printDoc.PrinterSettings.Copies 
		  + ", pages " + numberOfPages;
		Font printFont = new Font("Courier New", 12);
		int leftMargin = e.MarginBounds.Left;
		int topMargin = e.MarginBounds.Top;
		e.Graphics.DrawString(textToPrint, printFont, Brushes.Black, 
		  leftMargin, topMargin);
        	numberOfPages--;
		if (numberOfPages < 1) 
                	e.HasMorePages = false;
            	else 
                	e.HasMorePages = true;
	}
        [STAThread]
        static void Main()
        {
            Application.Run(new Form2());
        }
    }
}

GeneralRe: Print multiple copies of a page? Pin
DaleEMoore24-Jan-08 11:30
DaleEMoore24-Jan-08 11:30 
QuestionIssue using .dll in Program vs Service Pin
abupsman24-Jan-08 9:43
abupsman24-Jan-08 9:43 
GeneralRe: Issue using .dll in Program vs Service Pin
Luc Pattyn24-Jan-08 10:15
sitebuilderLuc Pattyn24-Jan-08 10:15 
GeneralRe: Issue using .dll in Program vs Service Pin
abupsman24-Jan-08 10:30
abupsman24-Jan-08 10:30 
GeneralRe: Issue using .dll in Program vs Service Pin
Luc Pattyn24-Jan-08 10:51
sitebuilderLuc Pattyn24-Jan-08 10:51 
GeneralRe: Issue using .dll in Program vs Service Pin
abupsman24-Jan-08 11:56
abupsman24-Jan-08 11:56 
GeneralRe: Issue using .dll in Program vs Service Pin
Luc Pattyn24-Jan-08 12:04
sitebuilderLuc Pattyn24-Jan-08 12:04 
GeneralCustom tab control Pin
DanB198324-Jan-08 7:58
DanB198324-Jan-08 7:58 
GeneralRe: Custom tab control Pin
led mike24-Jan-08 9:41
led mike24-Jan-08 9:41 
GeneralRe: Custom tab control Pin
DanB198324-Jan-08 9:50
DanB198324-Jan-08 9:50 
GeneralRe: Custom tab control Pin
led mike24-Jan-08 10:31
led mike24-Jan-08 10:31 
GeneralRe: Custom tab control Pin
DanB198325-Jan-08 0:14
DanB198325-Jan-08 0:14 
GeneralRe: Custom tab control Pin
led mike25-Jan-08 5:56
led mike25-Jan-08 5:56 
GeneralRe: Custom tab control Pin
DanB198326-Jan-08 1:29
DanB198326-Jan-08 1:29 
QuestionWPF Transparent Window - can it still detect events? Pin
Member 429406224-Jan-08 7:44
Member 429406224-Jan-08 7:44 
AnswerRe: WPF Transparent Window - can it still detect events? Pin
i_want_to_learn_c#24-Jan-08 8:11
i_want_to_learn_c#24-Jan-08 8:11 
AnswerRe: WPF Transparent Window - can it still detect events? Pin
Paul Conrad24-Jan-08 8:39
professionalPaul Conrad24-Jan-08 8:39 

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.