本文整理汇总了C#中iTextSharp.text.Rectangle.HasBorder方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.HasBorder方法的具体用法?C# Rectangle.HasBorder怎么用?C# Rectangle.HasBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.Rectangle
的用法示例。
在下文中一共展示了Rectangle.HasBorder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Rectangle
/**
* Adds a border (complete or partially) to the current path..
*
* @param rectangle a <CODE>Rectangle</CODE>
*/
public void Rectangle(Rectangle rectangle)
{
// the coordinates of the border are retrieved
float x1 = rectangle.Left;
float y1 = rectangle.Bottom;
float x2 = rectangle.Right;
float y2 = rectangle.Top;
// the backgroundcolor is set
BaseColor background = rectangle.BackgroundColor;
if (background != null) {
SaveState();
SetColorFill(background);
Rectangle(x1, y1, x2 - x1, y2 - y1);
Fill();
RestoreState();
}
// if the element hasn't got any borders, nothing is added
if (! rectangle.HasBorders()) {
return;
}
// if any of the individual border colors are set
// we draw the borders all around using the
// different colors
if (rectangle.UseVariableBorders) {
VariableRectangle(rectangle);
}
else {
// the width is set to the width of the element
if (rectangle.BorderWidth != iTextSharp.text.Rectangle.UNDEFINED) {
SetLineWidth(rectangle.BorderWidth);
}
// the color is set to the color of the element
BaseColor color = rectangle.BorderColor;
if (color != null) {
SetColorStroke(color);
}
// if the box is a rectangle, it is added as a rectangle
if (rectangle.HasBorder(iTextSharp.text.Rectangle.BOX)) {
this.Rectangle(x1, y1, x2 - x1, y2 - y1);
}
// if the border isn't a rectangle, the different sides are added apart
else {
if (rectangle.HasBorder(iTextSharp.text.Rectangle.RIGHT_BORDER)) {
MoveTo(x2, y1);
LineTo(x2, y2);
}
if (rectangle.HasBorder(iTextSharp.text.Rectangle.LEFT_BORDER)) {
MoveTo(x1, y1);
LineTo(x1, y2);
}
if (rectangle.HasBorder(iTextSharp.text.Rectangle.BOTTOM_BORDER)) {
MoveTo(x1, y1);
LineTo(x2, y1);
}
if (rectangle.HasBorder(iTextSharp.text.Rectangle.TOP_BORDER)) {
MoveTo(x1, y2);
LineTo(x2, y2);
}
}
Stroke();
if (color != null) {
ResetRGBColorStroke();
}
}
}