//Override OnBeginPrint to set up the font we are going to use
		protected override void OnBeginPrint(PrintEventArgs ev) 
		{
			base.OnBeginPrint(ev) ;

			competitors = CommonCode.GetCompetitors(Patrol);

			labelDocument = CommonCode.Settings.PrinterSettings.LabelResultDocument;
			printFont = new Font(labelDocument.FontName, labelDocument.FontSize, 
				System.Drawing.FontStyle.Regular);
		}
		//Override OnBeginPrint to set up the font we are going to use
		protected override void OnBeginPrint(PrintEventArgs ev) 
		{
			base.OnBeginPrint(ev) ;

			_competitors = _commonCode.GetCompetitors();
			_nrofseries = _commonCode.GetStationsCount();
			_competition = _commonCode.GetCompetitions()[0];

			_labelDocument = _commonCode.Settings.PrinterSettings.LabelMirrorPrintDocument;
			_printFont = new Font(_labelDocument.FontName, _labelDocument.FontSize, 
				FontStyle.Regular);
		}
		private void createDefaultLabels()
		{
			mirrorPrintLabelDocument = new PrintLabelDocument(
				PrintLabelDocument.PrintLabelDocumentTypeEnum.Avery6150,
				210, 297, 4, 8, 50, 30, 20, 20, 0, 0, "Arial", 10);
			stickPrintLabelDocument = new PrintLabelDocument(
				PrintLabelDocument.PrintLabelDocumentTypeEnum.Avery6150,
				210, 297, 4, 8, 50, 30, 20, 20, 0, 0, "Arial", 10);
			resultLabelDocument = new PrintLabelDocument(
				PrintLabelDocument.PrintLabelDocumentTypeEnum.Avery6150,
				210, 297, 4, 8, 50, 30, 20, 20, 0, 0, "Arial", 10);
		}
Esempio n. 4
0
		private void saveSettingsLabels(ISettings settings)
		{
			//PrintLabelDocument doc = settings.PrinterSettings.MirrorPrintLabelDocument;
			int horizontalInnerMarginMm = (int)numLabelsInnerMarginHorisontal.Value;
			int labelXSizeMm = (int)numLabelsLabelSizeX.Value;
			int labelYSizeMm = (int)numLabelsLabelSizeY.Value;
			int leftMarginMm = (int)numLabelsLeftMargin.Value;
			int nrOfLabelsX = (int)numLabelsNrOfLabelsX.Value;
			int nrOfLabelsY = (int)numLabelsNrOfLabelsY.Value;
			int topMarginMm = (int)numLabelsTopMargin.Value;
			int verticalInnerMarginMm = (int)numLabelsInnerMarginVertical.Value;

			string fontName = ddLabelsFont.SelectedItem.ToString();
			int fontSize = (int)numLabelsFontSize.Value;
			PrintLabelDocument.PrintLabelDocumentTypeEnum printLabelDocumentType = 
				(PrintLabelDocument.PrintLabelDocumentTypeEnum)
				ddLabelType.SelectedItem;

			PrintLabelDocument doc = new PrintLabelDocument(
				printLabelDocumentType, 
				210, 
				297, 
				nrOfLabelsX, 
				nrOfLabelsY, 
				labelXSizeMm, 
				labelYSizeMm, 
				leftMarginMm, 
				topMarginMm, 
				horizontalInnerMarginMm, 
				verticalInnerMarginMm, 
				fontName, 
				fontSize);
			switch (ddLabelUsage.SelectedIndex)
			{
				case 0: // Speglar
					settings.PrinterSettings.LabelMirrorPrintDocument = doc;
					break;
				case 1: // Resultat
					settings.PrinterSettings.LabelResultDocument = doc;
					break;
			}

		}
		private void addVerticalRuler(PrintPageEventArgs ev, PrintLabelDocument doc)
		{
			System.Drawing.Pen pen = new Pen(System.Drawing.Color.Black, 1);
			Font font = new Font("Times New Roman", 12);
			float xPos = doc.ConvertXmmToDpi(150);

			ev.Graphics.DrawLine(pen, xPos, 0, xPos, doc.ConvertYmmToDpi(doc.DocumentSizeYmm - 9));
			for (int i = 0; i < doc.DocumentSizeYmm - 9; i++)
			{
				float thisMmLineHeight = 5;
				if (i % 10 == 0)
					thisMmLineHeight = thisMmLineHeight * 2;

				ev.Graphics.DrawLine(pen, 
					xPos, doc.ConvertYmmToDpi(i), 
					xPos + thisMmLineHeight, doc.ConvertYmmToDpi(i));

				if (i % 10 == 0)
				{
					ev.Graphics.DrawString(i.ToString(), font, Brushes.Black,
						xPos + 20, doc.ConvertYmmToDpi(i));
				}
			}
		}