// Hattinger Tobias private void pbxCodeOutputC128_Paint(object sender, PaintEventArgs e) { if (encodeText.Length < 80) { try { Image codeImage = XDCodes.CreateImage(encodeText, XDCodes.CodeTypes.Code128); float scaleFactorY = (float)pbxCodeOutputC128.Height / (float)codeImage.Height; float scaleFactorX = (float)pbxCodeOutputC128.Width / (float)codeImage.Width; float scaleFactor; if (scaleFactorX > scaleFactorY) { scaleFactor = scaleFactorY; } else { scaleFactor = scaleFactorX; } e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor; e.Graphics.ScaleTransform(scaleFactor, scaleFactor); e.Graphics.DrawImage(codeImage, 1, 1); } catch (Exception ex) { } } }
// Hattinger Tobias private void pbxCodeOutputPDF417_Paint(object sender, PaintEventArgs e) { Image codeImage = XDCodes.CreateImage(encodeText, XDCodes.CodeTypes.PDF417); float scaleFactorY = (float)pbxCodeOutputPDF417.Height / (float)codeImage.Height; float scaleFactorX = (float)pbxCodeOutputPDF417.Width / (float)codeImage.Width; float scaleFactor; if (scaleFactorX > scaleFactorY) { scaleFactor = scaleFactorY; } else { scaleFactor = scaleFactorX; } e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor; e.Graphics.ScaleTransform(scaleFactor, scaleFactor); e.Graphics.DrawImage(codeImage, 1, 1); }