/// <summary> /// /// </summary> /// <param name="labelCount"></param> /// <returns></returns> public PrintLabel GetLabel(int labelCount) { if (labelCount >= (_nrOfLabelsX * _nrOfLabelsY) | labelCount < 0) { throw new PrintLabelDoesNotExistException("Label does not exist"); } int line = labelCount / _nrOfLabelsX; int nrInLine = labelCount - (line * _nrOfLabelsX); int xInMm = leftMarginMm + nrInLine * (_labelXSizeMm + _horizontalInnerMarginMm); int yInMm = topMarginMm + line * (_labelYSizeMm + _verticalInnerMarginMm); float x = ConvertXmmToDpi(xInMm); float y = ConvertYmmToDpi(yInMm); float sizeX = ConvertXmmToDpi(_labelXSizeMm); float sizeY = ConvertYmmToDpi(_labelYSizeMm); float marginalLeft = ConvertXmmToDpi(leftMarginMm); float marginalTop = ConvertYmmToDpi(topMarginMm); var toReturn = new PrintLabel(x, y, sizeX, sizeY, marginalLeft, marginalTop); return(toReturn); }
private void printCompetitor(PrintPageEventArgs ev, Structs.Competitor competitor, PrintLabel label) { Trace.WriteLine("Competitor: " + competitor.CompetitorId); ResultsReturn result = CommonCode.ResultsGetCompetitor(competitor); float y = label.Y + label.MarginalTop; float x = label.X + label.MarginalLeft; string shooterClass = getShooterClassString( CommonCode.GetCompetitor(result.CompetitorId)); ev.Graphics.DrawString( shooterClass, printFont, Brushes.Black, x, y, new StringFormat()); float indent = ev.Graphics.MeasureString("RES", printFont).Width; x = x + indent; ev.Graphics.DrawString( result.ShooterName, printFont, Brushes.Black, x, y, new StringFormat()); y += printFont.Height; Structs.Club club = CommonCode.GetClub( result.ClubId); ev.Graphics.DrawString( club.Name, printFont, Brushes.Black, x, y, new StringFormat()); y += printFont.Height; string resultString = ""; switch (CommonCode.CompetitionCurrent.Type) { case Structs.CompetitionTypeEnum.Field: resultString = getResultStringField(result); break; case Structs.CompetitionTypeEnum.MagnumField: resultString = getResultStringField(result); break; case Structs.CompetitionTypeEnum.Precision: resultString = result.HitsTotal.ToString() + " p"; break; } ev.Graphics.DrawString( resultString, printFont, Brushes.Black, x, y, new StringFormat()); y += printFont.Height; }
/// <summary> /// /// </summary> /// <param name="labelCount"></param> /// <returns></returns> public PrintLabel GetLabel(int labelCount) { if (labelCount >= (_nrOfLabelsX * _nrOfLabelsY) | labelCount < 0) { throw new PrintLabelDoesNotExistException("Label does not exist"); } int line = labelCount / _nrOfLabelsX; int nrInLine = labelCount-(line*_nrOfLabelsX); int xInMm = leftMarginMm + nrInLine*(_labelXSizeMm + _horizontalInnerMarginMm); int yInMm = topMarginMm + line*(_labelYSizeMm + _verticalInnerMarginMm); float x = ConvertXmmToDpi(xInMm); float y = ConvertYmmToDpi(yInMm); float sizeX = ConvertXmmToDpi(_labelXSizeMm); float sizeY = ConvertYmmToDpi(_labelYSizeMm); float marginalLeft = ConvertXmmToDpi(leftMarginMm); float marginalTop = ConvertYmmToDpi(topMarginMm); var toReturn = new PrintLabel(x, y, sizeX, sizeY, marginalLeft, marginalTop); return toReturn; }
private void PrintCompetitor(PrintPageEventArgs ev, Structs.Competitor competitor, int serie, PrintLabel label) { Trace.WriteLine("Competitor: " + _competitors[_currentCompetitor].CompetitorId + "\r\nSerie: " + _currentCompetitorSeries); var shooter = _commonCode.GetShooter(competitor.ShooterId); var y = label.Y + label.MarginalTop; var x = label.X + label.MarginalLeft; ev.Graphics.DrawString( shooter.Surname + " " + shooter.Givenname + " (" + shooter.CardNr + ")", _printFont, Brushes.Black, x, y, new StringFormat()); y += _printFont.Height; ev.Graphics.DrawString( "Lag " + competitor.PatrolId + ", Serie " + (serie+1), _printFont, Brushes.Black, x, y, new StringFormat()); y += _printFont.Height; ev.Graphics.DrawString( _competition.Name + ", " + _competition.StartTime.ToShortDateString(), _printFont, Brushes.Black, x, y, new StringFormat()); y += _printFont.Height; }
private void printCompetitor(PrintPageEventArgs ev, PrintLabel label, int i) { Font printFont = new Font("Times New Roman", 12); float y = label.Y + label.MarginalTop; float x = label.X + label.MarginalLeft; string shooterClass = "A" + i.ToString(); ev.Graphics.DrawString( shooterClass, printFont, Brushes.Black, x, y, new StringFormat()); float indent = ev.Graphics.MeasureString("RES", printFont).Width; x = x + indent; ev.Graphics.DrawString( "Skytt nr " + i.ToString(), printFont, Brushes.Black, x, y, new StringFormat()); y += printFont.Height; ev.Graphics.DrawString( "PSK Test", printFont, Brushes.Black, x, y, new StringFormat()); y += printFont.Height; string resultString = "6/12"; ev.Graphics.DrawString( resultString, printFont, Brushes.Black, x, y, new StringFormat()); y += printFont.Height; }
private void printLabelBorders(PrintPageEventArgs ev, PrintLabel label) { Pen pen = new Pen(Brushes.Black,1); ev.Graphics.DrawLine(pen, label.X, label.Y, label.X, label.Y + label.SizeY); ev.Graphics.DrawLine(pen, label.X, label.Y + label.SizeY, label.X + label.SizeX, label.Y + label.SizeY); ev.Graphics.DrawLine(pen, label.X + label.SizeX, label.Y + label.SizeY, label.X + label.SizeX, label.Y); ev.Graphics.DrawLine(pen, label.X + label.SizeX, label.Y, label.X, label.Y); }