Click here to Skip to main content
16,005,141 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Print multiple copies of a page? Pin
DaleEMoore24-Jan-08 11:30
DaleEMoore24-Jan-08 11:30 
Thanks to your help I was able to blow away some of the fog in my mind and realize I should be handling my variables differently. The following code has resolved my problem.

using System;
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
namespace MultipleCopies
{
    public partial class Form2 : Form
    {
        private PrintDocument printDoc;
        private int numberOfPages;
        public Form2()
        {
		InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
		printDoc = new PrintDocument();
		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());
        }
    }
}

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 
GeneralRe: WPF Transparent Window - can it still detect events? Pin
DaveyM6924-Jan-08 11:01
professionalDaveyM6924-Jan-08 11:01 

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.