Class Pen

Class Pen

ชื่อพื้นที่: Aspose.Imaging การประกอบ: Aspose.Imaging.dll (25.5.0)

กําหนดวัตถุที่ใช้ในการดึงเส้นโค้งและตัวเลข

public class Pen : TransparencySupporter

Inheritance

object TransparencySupporter Pen

อนุญาโตตุลาการ

TransparencySupporter.Equals(object) , TransparencySupporter.GetHashCode() , TransparencySupporter.Equals(TransparencySupporter) , TransparencySupporter.Opacity , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

ตัวอย่างนี้แสดงให้เห็นถึงการสร้างและใช้วัตถุ Pen ตัวอย่างนี้สร้างภาพใหม่และดึงมุมตรงบนพื้นผิวของภาพ

//Create an instance of BmpOptions and set its various properties
                                                                                                                                       Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                                                       bmpOptions.BitsPerPixel = 24;

                                                                                                                                       //Create an instance of FileCreateSource and assign it as Source for the instance of BmpOptions
                                                                                                                                       //Second Boolean parameter determines if the file to be created IsTemporal or not
                                                                                                                                       bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);

                                                                                                                                       //Create an instance of Image at specified Path
                                                                                                                                       using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
                                                                                                                                       {
                                                                                                                                           //Create an instance of Graphics and initialize it with Image object
                                                                                                                                           Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                           //Clear the Graphics sutface with White Color
                                                                                                                                           graphics.Clear(Aspose.Imaging.Color.White);

                                                                                                                                           //Create an instance of Pen with color Red and width 5
                                                                                                                                           Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);

                                                                                                                                           //Create an instance of HatchBrush and set its properties
                                                                                                                                           Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
                                                                                                                                           brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
                                                                                                                                           brush.ForegroundColor = Aspose.Imaging.Color.Red;

                                                                                                                                           //Create an instance of Pen
                                                                                                                                           //initialize it with HatchBrush object and width
                                                                                                                                           Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);

                                                                                                                                           //Draw Rectangles by specifying Pen object
                                                                                                                                           graphics.DrawRectangles(pen, new[]
                                                                                                                                           {
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(210, 210), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                           });

                                                                                                                                           //Draw Rectangles by specifying Pen object
                                                                                                                                           graphics.DrawRectangles(brusedpen, new[]
                                                                                                                                           {
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                           });

                                                                                                                                           // save all changes.
                                                                                                                                           image.Save();
                                                                                                                                       }

Constructors

Pen(Color)

เริ่มต้นตัวอย่างใหม่ของคลาส Aspose.Imaging.Pen ด้วยสีที่ระบุ

public Pen(Color color)

Parameters

color Color

โครงสร้าง Aspose.Imaging.Pen.Color ที่แสดงให้เห็นถึงสีของ Aspose.Imaging.Pen

Pen(สี, float)

เริ่มต้นตัวอย่างใหม่ของคลาส Aspose.Imaging.Pen ด้วยคุณสมบัติที่ระบุ Aspose.Imaging.Pen.Color และ Aspose.Imaging.Pen.Width

public Pen(Color color, float width)

Parameters

color Color

โครงสร้าง Aspose.Imaging.Pen.Color ที่แสดงให้เห็นถึงสีของ Aspose.Imaging.Pen

width float

หมายถึงความกว้างของ Aspose.Imaging.Pen

Examples

ตัวอย่างนี้แสดงให้เห็นถึงการสร้างและใช้วัตถุ Pen ตัวอย่างนี้สร้างภาพใหม่และดึงมุมตรงบนพื้นผิวของภาพ

//Create an instance of BmpOptions and set its various properties
                                                                                                                                       Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                                                       bmpOptions.BitsPerPixel = 24;

                                                                                                                                       //Create an instance of FileCreateSource and assign it as Source for the instance of BmpOptions
                                                                                                                                       //Second Boolean parameter determines if the file to be created IsTemporal or not
                                                                                                                                       bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);

                                                                                                                                       //Create an instance of Image at specified Path
                                                                                                                                       using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
                                                                                                                                       {
                                                                                                                                           //Create an instance of Graphics and initialize it with Image object
                                                                                                                                           Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                           //Clear the Graphics sutface with White Color
                                                                                                                                           graphics.Clear(Aspose.Imaging.Color.White);

                                                                                                                                           //Create an instance of Pen with color Red and width 5
                                                                                                                                           Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);

                                                                                                                                           //Create an instance of HatchBrush and set its properties
                                                                                                                                           Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
                                                                                                                                           brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
                                                                                                                                           brush.ForegroundColor = Aspose.Imaging.Color.Red;

                                                                                                                                           //Create an instance of Pen
                                                                                                                                           //initialize it with HatchBrush object and width
                                                                                                                                           Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);

                                                                                                                                           //Draw Rectangles by specifying Pen object
                                                                                                                                           graphics.DrawRectangles(pen, new[]
                                                                                                                                           {
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(210, 210), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                           });

                                                                                                                                           //Draw Rectangles by specifying Pen object
                                                                                                                                           graphics.DrawRectangles(brusedpen, new[]
                                                                                                                                           {
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                           });

                                                                                                                                           // save all changes.
                                                                                                                                           image.Save();
                                                                                                                                       }

Pen(Brush)

เริ่มต้นตัวอย่างใหม่ของคลาส Aspose.Imaging.Pen กับ Aspose.Imaging.Pen.Brush ที่ระบุ

public Pen(Brush brush)

Parameters

brush Brush

A Aspose.Imaging.Pen.Brush ซึ่งกําหนดคุณสมบัติการเติมของ Aspose.Imaging.Pen นี้

Exceptions

ArgumentNullException

brush’ is null.

Pen(แบริ่ง, float)

เริ่มต้นตัวอย่างใหม่ของคลาส Aspose.Imaging.Pen กับ Aspose.Imaging.Pen.Brush และ Aspose.Imaging.Pen.Width ที่ระบุ

[JsonConstructor]
public Pen(Brush brush, float width)

Parameters

brush Brush

A Aspose.Imaging.Pen.Brush ซึ่งกําหนดลักษณะของ Aspose.Imaging.Pen นี้

width float

ความกว้างของ Aspose.Imaging.Pen ใหม่

Exceptions

ArgumentNullException

brush’ is null.

Properties

Alignment

รับหรือตั้งค่าการปรับตัวสําหรับ Aspose.Imaging.Pen นี้

public PenAlignment Alignment { get; set; }

คุณสมบัติมูลค่า

PenAlignment

Exceptions

ArgumentException

คุณสมบัติ Aspose.Imaging.Pen.Alignment ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นเดียวกับคุณสมบัติที่กลับจากชั้น Aspose.Imaging.Pen

Brush

ได้รับหรือตั้งค่า Aspose.Imaging.Pen.Brush ซึ่งกําหนดคุณสมบัติของ Aspose.Imaging.Pen นี้

public Brush Brush { get; set; }

คุณสมบัติมูลค่า

Brush

Exceptions

ArgumentException

คุณสมบัติ Aspose.Imaging.Pen.Brush ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นเดียวกับที่ส่งกลับจากชั้น Aspose.Imaging.Pen

Color

ได้รับหรือตั้งค่าสีของ Aspose.Imaging.Pen นี้

public Color Color { get; set; }

คุณสมบัติมูลค่า

Color

Exceptions

ArgumentException

คุณสมบัติ Aspose.Imaging.Pen.Color ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นที่ส่งกลับโดย Class Aspose.Imaging.Pen

CompoundArray

รับหรือตั้งค่าจํานวนของมูลค่าที่ระบุ قلمผสม قلم قلم قلم قلم قلم قلم قلم قلم قلم قلم قلم قلم قلم

public float[] CompoundArray { get; set; }

คุณสมบัติมูลค่า

float [ ]

Exceptions

ArgumentException

คุณสมบัติของ Aspose.Imaging.Pen.CompoundArray ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นเดียวกับประเภทของ Aspose.Imaging.Pen

CustomEndCap

ได้รับหรือตั้งค่าแคปที่กําหนดเองที่จะใช้ในตอนท้ายของเส้นดึงด้วย Aspose.Imaging.Pen นี้

public CustomLineCap CustomEndCap { get; set; }

คุณสมบัติมูลค่า

CustomLineCap

Exceptions

ArgumentException

คุณสมบัติของ Aspose.Imaging.Pen.CustomEndCap ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นเดียวกับที่ส่งกลับจากชั้น Aspose.Imaging.Pen

CustomStartCap

ได้รับหรือตั้งค่าแคปที่กําหนดเองที่จะใช้ในตอนแรกของเส้นดึงด้วย Aspose.Imaging.Pen นี้

public CustomLineCap CustomStartCap { get; set; }

คุณสมบัติมูลค่า

CustomLineCap

Exceptions

ArgumentException

คุณสมบัติของ Aspose.Imaging.Pen.CustomStartCap ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นเดียวกับที่ส่งกลับจากชั้น Aspose.Imaging.Pen

DashCap

รับหรือตั้งค่าสไตล์ cap ที่ใช้ในตอนท้ายของแผ่นที่ประกอบด้วยเส้นด้ายดึงด้วย Aspose.Imaging.Pen นี้

public DashCap DashCap { get; set; }

คุณสมบัติมูลค่า

DashCap

Exceptions

ArgumentException

คุณสมบัติของ Aspose.Imaging.Pen.DashCap ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นเดียวกับที่กลับมาโดยชั้น Aspose.Imaging.Pen

DashOffset

รับหรือตั้งค่าระยะห่างจากจุดเริ่มต้นของเส้นไปจนถึงจุดเริ่มต้นของรูปแบบดัช

public float DashOffset { get; set; }

คุณสมบัติมูลค่า

float

DashPattern

รับหรือตั้งค่าชุดของแผ่นและพื้นที่ที่กําหนดเอง

public float[] DashPattern { get; set; }

คุณสมบัติมูลค่า

float [ ]

Exceptions

ArgumentException

คุณสมบัติของ Aspose.Imaging.Pen.DashPattern ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นที่ส่งกลับจากชั้น Aspose.Imaging.Pen

DashStyle

รับหรือตั้งค่าสไตล์ที่ใช้สําหรับเส้นด้ายดึงด้วย Aspose.Imaging.Pen นี้

public DashStyle DashStyle { get; set; }

คุณสมบัติมูลค่า

DashStyle

Exceptions

ArgumentException

คุณสมบัติ Aspose.Imaging.Pen.DashStyle ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่สามารถเปลี่ยนแปลงได้เช่นเดียวกับประเภท Aspose.Imaging.Pen ที่จะกลับมา

EndCap

ได้รับหรือตั้งค่าสไตล์ cap ที่ใช้ในตอนท้ายของเส้นดึงด้วย Aspose.Imaging.Pen นี้

public LineCap EndCap { get; set; }

คุณสมบัติมูลค่า

LineCap

Exceptions

ArgumentException

คุณสมบัติของ Aspose.Imaging.Pen.EndCap ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นเดียวกับที่ส่งกลับจากชั้น Aspose.Imaging.Pen

LineJoin

รับหรือตั้งค่ารูปแบบการเข้าร่วมสําหรับปลายของสองเส้นต่อเนื่องที่นํามาใช้กับ Aspose.Imaging.Pen นี้

public LineJoin LineJoin { get; set; }

คุณสมบัติมูลค่า

LineJoin

Exceptions

ArgumentException

คุณสมบัติของ Aspose.Imaging.Pen.LineJoin ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นเดียวกับประเภทของ Aspose.Imaging.Pen

MiterLimit

ได้รับหรือตั้งข้อ จํากัด ของความหนาของข้อต่อบนมุมที่วัด

public float MiterLimit { get; set; }

คุณสมบัติมูลค่า

float

Exceptions

ArgumentException

คุณสมบัติ Aspose.Imaging.Pen.MiterLimit ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นเดียวกับคุณสมบัติที่กลับจากชั้น Aspose.Imaging.Pen

PenType

ได้รับสไตล์ของเส้นดึงด้วย Aspose.Imaging.Pen นี้

[JsonIgnore]
public PenType PenType { get; }

คุณสมบัติมูลค่า

PenType

StartCap

รับหรือตั้งค่าสไตล์ cap ที่ใช้ในตอนแรกของเส้นดึงด้วย Aspose.Imaging.Pen นี้

public LineCap StartCap { get; set; }

คุณสมบัติมูลค่า

LineCap

Exceptions

ArgumentException

คุณสมบัติของ Aspose.Imaging.Pen.StartCap ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นเดียวกับที่ส่งกลับจากชั้น Aspose.Imaging.Pen

Transform

รับหรือตั้งค่าสําเนาของการเปลี่ยนแปลงทางภูมิศาสตร์สําหรับ Aspose.Imaging.Pen นี้

public Matrix Transform { get; set; }

คุณสมบัติมูลค่า

Matrix

Exceptions

ArgumentException

คุณสมบัติ Aspose.Imaging.Pen.Transform ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่มีการเปลี่ยนแปลงเช่นเดียวกับคุณสมบัติที่กลับจากชั้น Aspose.Imaging.Pen

Width

ได้รับหรือตั้งค่าความกว้างของ Aspose.Imaging.Pen นี้ในหน่วยของวัตถุกราฟิกที่ใช้ในการวาด

public float Width { get; set; }

คุณสมบัติมูลค่า

float

Exceptions

ArgumentException

คุณสมบัติ Aspose.Imaging.Pen.Width ตั้งอยู่บน Aspose.Imaging.Pen ที่ไม่สามารถเปลี่ยนแปลงได้เช่นเดียวกับคุณสมบัติที่กลับจากชั้น Aspose.Imaging.Pen

Methods

Equals(วัตถุ)

ตรวจสอบว่าวัตถุนั้นเท่าเทียมกันหรือไม่

public override bool Equals(object obj)

Parameters

obj object

วัตถุอื่น ๆ

Returns

bool

ผลการเปรียบเทียบเท่าเทียม

Equals(Pen)

ตรวจสอบว่าวัตถุนั้นเท่าเทียมกันหรือไม่

protected bool Equals(Pen other)

Parameters

other Pen

วัตถุอื่น ๆ

Returns

bool

ผลการเปรียบเทียบเท่าเทียม

GetHashCode()

รับรหัส hash ของวัตถุปัจจุบัน

public override int GetHashCode()

Returns

int

รหัส hash

MultiplyTransform(Matrix)

multiplies the transformation matrix for this Aspose.Imaging.Pen by the specified Aspose.Imaging.Matrix

public void MultiplyTransform(Matrix matrix)

Parameters

matrix Matrix

Aspose.Imaging.Matrix วัตถุโดยที่ที่จะเพิ่มขึ้นแม่เหล็กการแปลง

MultiplyTransform(Matrix และ MatrixOrder)

multiplies the transformation matrix for this Aspose.Imaging.Pen by the specified Aspose.Imaging.Matrix in the specified order

public void MultiplyTransform(Matrix matrix, MatrixOrder order)

Parameters

matrix Matrix

The Aspose.Imaging.Matrix โดยที่ที่จะ multiply matrix การแปลง

order MatrixOrder

คําสั่งที่ต้องดําเนินการกระบวนการเพิ่มขึ้น

ResetTransform()

รีไซเคิลแม่พิมพ์การเปลี่ยนแปลงทางภูมิศาสตร์สําหรับ Aspose.Imaging.Pen นี้เพื่อความ identity

public void ResetTransform()

RotateTransform(เฟอร์รี่)

การหมุนการเปลี่ยนแปลงทางภูมิศาสตร์ในท้องถิ่นตามมุมที่ระบุ วิธีการนี้กําหนดการหมุนไปสู่การเปลี่ยนแปลง

public void RotateTransform(float angle)

Parameters

angle float

มุมของหมุน

RotateTransform(ตลับลูกปืน, MatrixOrder)

การหมุนการเปลี่ยนแปลงทางภูมิศาสตร์ในท้องถิ่นตามมุมที่ระบุในคําสั่งที่ระบุ

public void RotateTransform(float angle, MatrixOrder order)

Parameters

angle float

มุมของหมุน

order MatrixOrder

A Aspose.Imaging.MatrixOrder ซึ่งระบุว่าจะขยายหรือขยายเส้นด้ายหมุน

ScaleTransform(เฟอร์รี่, เฟอร์รี่)

การสแกนการเปลี่ยนแปลงทางภูมิศาสตร์ในท้องถิ่นโดยปัจจัยที่ระบุ วิธีการนี้กําหนดการสแกนของแม่เหล็กเพื่อการเปลี่ยนแปลง

public void ScaleTransform(float sx, float sy)

Parameters

sx float

ปัจจัยที่ให้การเปลี่ยนแปลงในทิศทาง x-axis

sy float

ปัจจัยที่ให้การเปลี่ยนแปลงในทิศทาง y-axis

ScaleTransform(เฟอร์รี่, เฟอร์รี่, MatrixOrder)

การสแกนการเปลี่ยนแปลงทางภูมิศาสตร์ในท้องถิ่นโดยปัจจัยที่ระบุในคําสั่งที่ระบุ

public void ScaleTransform(float sx, float sy, MatrixOrder order)

Parameters

sx float

ปัจจัยที่ให้การเปลี่ยนแปลงในทิศทาง x-axis

sy float

ปัจจัยที่ให้การเปลี่ยนแปลงในทิศทาง y-axis

order MatrixOrder

A Aspose.Imaging.MatrixOrder ซึ่งระบุว่าจะขยายหรือขยายเส้นด้ายการสแกน

SetLineCap(LineCap, LineCap, DashCap)

หมายเลขที่กําหนดค่าที่กําหนดรูปแบบของหมวกที่ใช้ในการปลายเส้นดึงโดย Aspose.Imaging.Pen นี้

public void SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap)

Parameters

startCap LineCap

A Aspose.Imaging.LineCap ซึ่งแสดงให้เห็นถึงสไตล์ cap ที่จะใช้ในตอนแรกของเส้นดึงด้วย Aspose.Imaging.Pen นี้

endCap LineCap

A Aspose.Imaging.LineCap ซึ่งแสดงให้เห็นถึงสไตล์ cap ที่จะใช้ในตอนท้ายของเส้นดึงด้วย Aspose.Imaging.Pen นี้

dashCap DashCap

A Aspose.Imaging.LineCap ซึ่งแสดงให้เห็นถึงสไตล์ cap ที่จะใช้ในจุดเริ่มต้นหรือจุดสิ้นสุดของเส้นด้ายดึงด้วย Aspose.Imaging.Pen นี้

TranslateTransform(เฟอร์รี่, เฟอร์รี่)

การแปลการเปลี่ยนแปลงทางภูมิศาสตร์ในท้องถิ่นตามขนาดที่ระบุ วิธีการนี้กําหนดการแปลเพื่อการเปลี่ยนแปลง

public void TranslateTransform(float dx, float dy)

Parameters

dx float

หมายเลขค่าของการแปลใน x

dy float

ประโยชน์ของการแปลใน Y

TranslateTransform(เฟอร์รี่, เฟอร์รี่, MatrixOrder)

แปลงการเปลี่ยนแปลงทางภูมิศาสตร์ในท้องถิ่นตามขนาดที่ระบุในคําสั่งที่ระบุ

public void TranslateTransform(float dx, float dy, MatrixOrder order)

Parameters

dx float

หมายเลขค่าของการแปลใน x

dy float

ประโยชน์ของการแปลใน Y

order MatrixOrder

คําสั่ง (prepend หรือ append) ที่จะใช้การแปล

 แบบไทย