本文整理汇总了C#中PdfSharp.Drawing.XRect.Inflate方法的典型用法代码示例。如果您正苦于以下问题:C# XRect.Inflate方法的具体用法?C# XRect.Inflate怎么用?C# XRect.Inflate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PdfSharp.Drawing.XRect
的用法示例。
在下文中一共展示了XRect.Inflate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawTitle
/// <summary>
/// Draws the page title and footer.
/// </summary>
public void DrawTitle(PdfPage page, XGraphics gfx, string title)
{
XRect rect = new XRect(new XPoint(), gfx.PageSize);
rect.Inflate(-10, -15);
XFont font = new XFont("Verdana", 14, XFontStyle.Bold);
gfx.DrawString(title, font, XBrushes.MidnightBlue, rect, XStringFormats.TopCenter);
rect.Offset(0, 5);
font = new XFont("Verdana", 8, XFontStyle.Italic);
XStringFormat format = new XStringFormat();
format.Alignment = XStringAlignment.Near;
format.LineAlignment = XLineAlignment.Far;
gfx.DrawString("Created with " + PdfSharp.ProductVersionInfo.Producer, font, XBrushes.DarkOrchid, rect, format);
font = new XFont("Verdana", 8);
format.Alignment = XStringAlignment.Center;
gfx.DrawString(Program.s_document.PageCount.ToString(), font, XBrushes.DarkOrchid, rect, format);
Program.s_document.Outlines.Add(title, page, true);
}
示例2: DrawBorder
public static void DrawBorder(XRect rect,IExportColumn column,XGraphics graphics)
{
var pen = new XPen(ToXColor(column.ForeColor),1);
rect.Inflate(new XSize(2,2));
graphics.DrawRectangle(pen,rect);
}
示例3: PrijmovyPokladniDoklad
public void PrijmovyPokladniDoklad()
{
string filename = String.Format("tempfile.pdf", Guid.NewGuid().ToString("D").ToUpper());
int cislo = 1234554666;
String datum ="24.07.2014";
double DPH = 21;
double cenaBezDPH = 100;
double DPHzCeny = (DPH / 100) * cenaBezDPH;
double cenenaCelkem = DPHzCeny + cenaBezDPH;
String cenaSlovy= "stodvacetjedna";
String prijatoOd="Apple asdjaosidjaosidasoidjasoijdoasij dasibdoaisjdbisuahd ajbsdoahus bj";
double DIC=12222222;
String ucelPlatby="vypalne";
int number = 1;
PdfPage page = document.AddPage();
page.Size = PageSize.A4;
XGraphics gfx = XGraphics.FromPdfPage(page);
XFont font = new XFont("Tahoma", 15, XFontStyle.Bold,new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always));
XFont font2 = new XFont("Tahoma", 11, XFontStyle.Regular, new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always));
BeginBox(gfx, number);
gfx.DrawString("Prijmový pokladní doklad", font, XBrushes.Black, new XRect(24,11,195,18), XStringFormats.TopLeft);
gfx.DrawString("č."+ cislo.ToString(), font2, XBrushes.Black, new XRect(222, 14, 71, 13), XStringFormats.TopLeft);
gfx.DrawString("ze dne " + datum, font2, XBrushes.Black, new XRect(295, 14, 104, 13), XStringFormats.TopLeft);
//razitko
XRect r = new XRect(24, 35, 204, 86);
gfx.DrawRoundedRectangle(new XSolidBrush(this.shadowColor), r, new XSize(15 + 8, 15 + 8));
r.Inflate(-2, -2);
gfx.DrawRoundedRectangle(new XSolidBrush(this.backColor2), r, new XSize(15 + 8, 15 + 8));
gfx.DrawRoundedRectangle(new XSolidBrush(this.shadowColor), new XRect(310, 38, 80, 21), new XSize(3 + 8, 3 + 8));
gfx.DrawString("Cena bez DPH", font2, XBrushes.Black, new XRect(235, 42, 70, 13), XStringFormats.TopLeft);
gfx.DrawString(cenaBezDPH.ToString()+" Kč", font2, XBrushes.Black, new XRect(315, 42, 70, 13), XStringFormats.TopLeft);
gfx.DrawRoundedRectangle(new XSolidBrush(this.shadowColor), new XRect(310, 68, 80, 21), new XSize(3 + 8, 3 + 8));
gfx.DrawString("+ "+DPH+"% DPH", font2, XBrushes.Black, new XRect(235, 72, 70, 13), XStringFormats.TopLeft);
gfx.DrawString(DPHzCeny.ToString() + " Kč", font2, XBrushes.Black, new XRect(315, 72, 70, 13), XStringFormats.TopLeft);
gfx.DrawRoundedRectangle(new XSolidBrush(this.shadowColor), new XRect(310, 98, 80, 21), new XSize(3 + 8, 3 + 8));
gfx.DrawString("Celkem Kč", font2, XBrushes.Black, new XRect(235, 102, 70, 13), XStringFormats.TopLeft);
gfx.DrawString(cenenaCelkem.ToString() , font2, XBrushes.Black, new XRect(315, 102, 70, 13), XStringFormats.TopLeft);
gfx.DrawString("Slovy", font2, XBrushes.Black, new XRect(24, 132, 40, 21), XStringFormats.TopLeft);
gfx.DrawRoundedRectangle(new XSolidBrush(this.shadowColor), new XRect(55, 128, 335, 21), new XSize(3 + 8, 3 + 8));
gfx.DrawString(cenaSlovy, font2, XBrushes.Black, new XRect(55, 128, 335, 21), XStringFormats.Center);
gfx.DrawString("Přijato od ", font2, XBrushes.Black, new XRect(24, 168, 30, 21), XStringFormats.TopLeft);
if (prijatoOd.Length > 60)
{
int devider = prijatoOd.IndexOf(" ", 50);
gfx.DrawString( prijatoOd.Substring(0, devider), font2, XBrushes.Black, new XRect(76, 168, 335, 21), XStringFormats.TopLeft);
gfx.DrawString(prijatoOd.Substring(devider,prijatoOd.Length-devider), font2, XBrushes.Black, new XRect(24, 188, 240, 21), XStringFormats.Center);
}
gfx.DrawString("DIČ "+DIC, font2, XBrushes.Black, new XRect(275, 193, 335, 21), XStringFormats.TopLeft);
gfx.DrawString("Účel platby ", font2, XBrushes.Black, new XRect(24, 220, 30, 21), XStringFormats.TopLeft);
gfx.DrawString(ucelPlatby, font2, XBrushes.Black, new XRect(85, 220, 335, 21), XStringFormats.TopLeft);
gfx.DrawString("Přijal:", font2, XBrushes.Black, new XRect(207, 242, 219, 45), XStringFormats.TopLeft);
EndBox(gfx);
// Save the s_document...
try
{
document.Save(filename);
}
catch(Exception e){
filename += "(1)";
}
// ...and start a viewer
Process.Start(filename);
}
示例4: Inflate
/// <summary>
/// Creates a rectangle that results from expanding or shrinking the specified rectangle by the specified width and height amounts, in all directions.
/// </summary>
public static XRect Inflate(XRect rect, double width, double height)
{
rect.Inflate(width, height);
return rect;
}
示例5: DrawHeaderAndFooter
public void DrawHeaderAndFooter(PdfDocument document, PdfPage page, XGraphics gfx, string title)
{
//PropSpect Logo
var filename = Path.Combine(p.ServerProperty.MapPath("~/Content/Images"), "PropSpect.png");
XImage image = XImage.FromFile(filename);
gfx.DrawImage(image, 20, 20, 120, 50);
//Title Text
XRect rect = new XRect(new XPoint(), gfx.PageSize);
rect.Inflate(-10, -25);
gfx.DrawString(title, p.Font16Bold, XBrushes.Black, rect, XStringFormats.TopCenter);
//Title Date
if (!string.IsNullOrEmpty(title))
{
rect.Inflate(0, -18);
gfx.DrawString("Date: " + DateTime.Now.ToString("yyyy-MM-dd"), p.Font14, XBrushes.Black, rect, XStringFormats.TopCenter);
}
//Customer Logo
filename = Path.Combine(p.ServerProperty.MapPath("~/Content/Images"), "olea.png");
image = XImage.FromFile(filename);
gfx.DrawImage(image, page.Width - 20 - 120, 20, 120, 50);
//Footer
rect = new XRect(20, page.Height - 20, page.Width - 40, 10);
XStringFormat format = new XStringFormat();
format.Alignment = XStringAlignment.Near;
format.LineAlignment = XLineAlignment.Far;
gfx.DrawString("Copyright: Paideia Solutions 2016", p.Font8Italic, XBrushes.Black, rect, format);
format.Alignment = XStringAlignment.Far;
gfx.DrawString(document.PageCount.ToString(), p.Font8Italic, XBrushes.Black, rect, format);
//document.Outlines.Add(title, page, true);
}
示例6: Main
static void Main()
{
// Get a fresh copy of the sample PDF file
string filename = "Portable Document Format.pdf";
File.Copy(Path.Combine("../../../../../PDFs/", filename),
Path.Combine(Directory.GetCurrentDirectory(), filename), true);
// Create the output document
PdfDocument outputDocument = new PdfDocument();
// Show single pages
// (Note: one page contains two pages from the source document)
outputDocument.PageLayout = PdfPageLayout.SinglePage;
XFont font = new XFont("Verdana", 8, XFontStyle.Bold);
XStringFormat format = new XStringFormat();
format.Alignment = XStringAlignment.Center;
format.LineAlignment = XLineAlignment.Far;
XGraphics gfx;
XRect box;
// Open the external document as XPdfForm object
XPdfForm form = XPdfForm.FromFile(filename);
for (int idx = 0; idx < form.PageCount; idx += 2)
{
// Add a new page to the output document
PdfPage page = outputDocument.AddPage();
page.Orientation = PageOrientation.Landscape;
double width = page.Width;
double height = page.Height;
int rotate = page.Elements.GetInteger("/Rotate");
gfx = XGraphics.FromPdfPage(page);
// Set page number (which is one-based)
form.PageNumber = idx + 1;
box = new XRect(0, 0, width / 2, height);
// Draw the page identified by the page number like an image
gfx.DrawImage(form, box);
// Write document file name and page number on each page
box.Inflate(0, -10);
gfx.DrawString(String.Format("- {1} -", filename, idx + 1),
font, XBrushes.Red, box, format);
if (idx + 1 < form.PageCount)
{
// Set page number (which is one-based)
form.PageNumber = idx + 2;
box = new XRect(width / 2, 0, width / 2, height);
// Draw the page identified by the page number like an image
gfx.DrawImage(form, box);
// Write document file name and page number on each page
box.Inflate(0, -10);
gfx.DrawString(String.Format("- {1} -", filename, idx + 2),
font, XBrushes.Red, box, format);
}
}
// Save the document...
filename = "TwoPagesOnOne_tempfile.pdf";
outputDocument.Save(filename);
// ...and start a viewer.
Process.Start(filename);
}
示例7: Inflate
/// <summary>
/// Inflates the rectangle by the specified size.
/// </summary>
public static XRect Inflate(XRect rect, double x, double y)
{
rect.Inflate(x, y);
return rect;
}
示例8: DrawTitle
/// <summary>
/// Draws the page title and footer.
/// </summary>
private void DrawTitle(PdfSharp.Pdf.PdfPage page, XGraphics gfx, string title)
{
XRect rect = new XRect(new XPoint(), gfx.PageSize);
rect.Inflate(-10, -15);
XFont font = new XFont("Verdana", 14, XFontStyle.Bold);
gfx.DrawString(title, font, XBrushes.MidnightBlue, rect, XStringFormats.TopCenter);
//_document.Outlines.Add(title, page, true);
}
示例9: BeginBox
public static void BeginBox(XGraphics gfx, int number, string title,
double borderWidth, double borderHeight,
XColor shadowColor, XColor backColor, XColor backColor2,
XPen borderPen)
{
const int dEllipse = 15;
XRect rect = new XRect(0, 20, 300, 200);
if (number % 2 == 0)
rect.X = 300 - 5;
rect.Y = 40 + ((number - 1) / 2) * (200 - 5);
rect.Inflate(-10, -10);
XRect rect2 = rect;
rect2.Offset(borderWidth, borderHeight);
gfx.DrawRoundedRectangle(new XSolidBrush(shadowColor), rect2, new XSize(dEllipse + 8, dEllipse + 8));
XLinearGradientBrush brush = new XLinearGradientBrush(rect, backColor, backColor2, XLinearGradientMode.Vertical);
gfx.DrawRoundedRectangle(borderPen, brush, rect, new XSize(dEllipse, dEllipse));
rect.Inflate(-5, -5);
XFont font = new XFont("Verdana", 12, XFontStyle.Regular);
gfx.DrawString(title, font, XBrushes.Navy, rect, XStringFormats.TopCenter);
rect.Inflate(-10, -5);
rect.Y += 20;
rect.Height -= 20;
state = gfx.Save();
gfx.TranslateTransform(rect.X, rect.Y);
}