Class Pen

Class Pen

Tên không gian: Aspose.Imaging Tổng hợp: Aspose.Imaging.dll (25.4.0)

Định nghĩa một đối tượng được sử dụng để vẽ các dòng, curves và số.

public class Pen : TransparencySupporter

Inheritance

object TransparencySupporter Pen

Thành viên thừa kế

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

Ví dụ này cho thấy việc tạo và sử dụng các đối tượng Pen. ví dụ tạo ra một hình ảnh mới và vẽ Rectangles trên bề mặt Hình ảnh.

//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)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.Pen với màu cụ thể.

public Pen(Color color)

Parameters

color Color

Một cấu trúc Aspose.Imaging.Pen.Color mà chỉ ra màu sắc của Wl17.

Pen(Màu sắc, float)

Bắt đầu một ví dụ mới của lớp Aspose.Imaging.Pen với các thuộc tính cụ thể W L 17_ .Pin.Color và _www.

public Pen(Color color, float width)

Parameters

color Color

Một cấu trúc Aspose.Imaging.Pen.Color mà chỉ ra màu sắc của Wl17.

width float

Một giá trị cho thấy chiều rộng của Aspose.Imaging.Pen.

Examples

Ví dụ này cho thấy việc tạo và sử dụng các đối tượng Pen. ví dụ tạo ra một hình ảnh mới và vẽ Rectangles trên bề mặt Hình ảnh.

//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)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.Pen với cụ thể W L17.Brux.

public Pen(Brush brush)

Parameters

brush Brush

A Aspose.Imaging.Pen.Brush mà xác định các thuộc tính lấp đầy của Wl17.Pan.

Exceptions

ArgumentNullException

brush’ is null.

Pen(Nước hoa, float)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.Pen với các thông số cụ thể W L 17_ .Pin.Brush và _ www.wl17_.pen .

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

Parameters

brush Brush

A Aspose.Imaging.Pen.Brush mà xác định các đặc điểm của Wl17.Pan.

width float

Chiều rộng của Aspose.Imaging.Pen mới

Exceptions

ArgumentNullException

brush’ is null.

Properties

Alignment

Nhận hoặc đặt sự sắp xếp cho Aspose.Imaging.Pen này.

public PenAlignment Alignment { get; set; }

Giá trị bất động sản

PenAlignment

Exceptions

ArgumentException

Tính chất Aspose.Imaging.Pen.Alignment được thiết lập trên một không thể thay đổi W L 17.Tên, chẳng hạn như những thuộc lớp __ WL 17 _ Pen trả về.

Brush

Nhận hoặc thiết lập Aspose.Imaging.Pen.Brush mà xác định các thuộc tính của Wl17.Pan.

public Brush Brush { get; set; }

Giá trị bất động sản

Brush

Exceptions

ArgumentException

Các tài sản Aspose.Imaging.Pen.Brush được thiết lập trên một không thể thay đổi W L 17.Tên, chẳng hạn như những người được trả về bởi lớp __ WL 17 _.

Color

Nhận hoặc đặt màu của Aspose.Imaging.Pen.

public Color Color { get; set; }

Giá trị bất động sản

Color

Exceptions

ArgumentException

Tính chất Aspose.Imaging.Pen.Color được thiết lập trên một không thể thay đổi Wl17.Tin, chẳng hạn như những thứ được trả về bởi lớp __ WL16_ .Pin.

CompoundArray

Nhận hoặc đặt một loạt các giá trị mà chỉ ra một bút hợp chất. Một bút hợp chất rút ra một dòng hợp chất được tạo thành từ các dòng và không gian song song.

public float[] CompoundArray { get; set; }

Giá trị bất động sản

float [ ]

Exceptions

ArgumentException

Tính chất Aspose.Imaging.Pen.CompoundArray được thiết lập trên một không thể thay đổi _Wl17_pen, chẳng hạn như những gì được trả về bởi lớp __ WL16_pen.

CustomEndCap

Nhận hoặc đặt một mũ tùy chỉnh để sử dụng ở cuối các dòng kéo với Aspose.Imaging.Pen này.

public CustomLineCap CustomEndCap { get; set; }

Giá trị bất động sản

CustomLineCap

Exceptions

ArgumentException

Tài sản của Aspose.Imaging.Pen.CustomEndCap được thiết lập trên một không thể thay đổi Wl17.Fen, chẳng hạn như những tài sản được trả về bởi lớp __ WL16_ .FEN.

CustomStartCap

Nhận hoặc đặt một bản vẽ tùy chỉnh để sử dụng ở đầu các dòng được kéo với Aspose.Imaging.Pen.

public CustomLineCap CustomStartCap { get; set; }

Giá trị bất động sản

CustomLineCap

Exceptions

ArgumentException

Tài sản của Aspose.Imaging.Pen.CustomStartCap được thiết lập trên một không thể thay đổi Wl17.Fen, chẳng hạn như những tài sản được trả về bởi lớp __ WL16_ .FEN.

DashCap

Nhận hoặc đặt phong cách chìa khóa được sử dụng ở cuối các mảnh vỡ mà tạo ra các đường dây được kéo bằng Aspose.Imaging.Pen này.

public DashCap DashCap { get; set; }

Giá trị bất động sản

DashCap

Exceptions

ArgumentException

Tài sản của Aspose.Imaging.Pen.DashCap được thiết lập trên một không thể thay đổi W L 17.Tên, chẳng hạn như những tài sản được trả về bởi lớp __ WL 17 _.

DashOffset

Nhận hoặc đặt khoảng cách từ sự khởi đầu của một dòng đến sự khởi đầu của một mô hình dash.

public float DashOffset { get; set; }

Giá trị bất động sản

float

DashPattern

Nhận hoặc đặt một loạt các ổ đĩa và không gian tùy chỉnh.

public float[] DashPattern { get; set; }

Giá trị bất động sản

float [ ]

Exceptions

ArgumentException

Tính chất của Aspose.Imaging.Pen.DashPattern được đặt trên một không thể thay đổi Wl17.Fen, chẳng hạn như những gì được trả về bởi lớp __ WL16_ .FEN.

DashStyle

Nhận hoặc đặt phong cách được sử dụng cho các dòng dán kéo với Aspose.Imaging.Pen này.

public DashStyle DashStyle { get; set; }

Giá trị bất động sản

DashStyle

Exceptions

ArgumentException

Tính chất Aspose.Imaging.Pen.DashStyle được thiết lập trên một không thể thay đổi Wl17.Fen, chẳng hạn như những gì được trả về bởi lớp __ WL16_ .FEN.

EndCap

Nhận hoặc đặt phong cách cap được sử dụng ở cuối các dòng kéo với Aspose.Imaging.Pen này.

public LineCap EndCap { get; set; }

Giá trị bất động sản

LineCap

Exceptions

ArgumentException

Các tài sản Aspose.Imaging.Pen.EndCap được thiết lập trên một không thể thay đổi Wl17.Fen, chẳng hạn như những gì được trả về bởi lớp __ WL16_ .FEN.

LineJoin

Nhận hoặc đặt phong cách kết nối cho các kết thúc của hai dòng liên tiếp kéo với Aspose.Imaging.Pen này.

public LineJoin LineJoin { get; set; }

Giá trị bất động sản

LineJoin

Exceptions

ArgumentException

Các tài sản Aspose.Imaging.Pen.LineJoin được thiết lập trên một không thể thay đổi Wl17.Tên, chẳng hạn như những người được trả về bởi lớp __ WL16_ .Tăng.

MiterLimit

Nhận hoặc đặt giới hạn độ dày của liên kết trên một góc được đo.

public float MiterLimit { get; set; }

Giá trị bất động sản

float

Exceptions

ArgumentException

Các tài sản Aspose.Imaging.Pen.MiterLimit được thiết lập trên một không thể thay đổi Wl17.Fen, chẳng hạn như những tài nguyên được trả về bởi lớp __ WL16_ .FEN.

PenType

Nhận phong cách của các dòng được rút ra với Aspose.Imaging.Pen.

[JsonIgnore]
public PenType PenType { get; }

Giá trị bất động sản

PenType

StartCap

Nhận hoặc đặt phong cách cap được sử dụng ở đầu các dòng kéo với Aspose.Imaging.Pen này.

public LineCap StartCap { get; set; }

Giá trị bất động sản

LineCap

Exceptions

ArgumentException

Tài sản của Aspose.Imaging.Pen.StartCap được thiết lập trên một không thể thay đổi W L 17.Tên, chẳng hạn như những tài sản được trả về bởi lớp __ WL 17 _.

Transform

Nhận hoặc đặt một bản sao của biến đổi địa phương cho Aspose.Imaging.Pen này.

public Matrix Transform { get; set; }

Giá trị bất động sản

Matrix

Exceptions

ArgumentException

Các tài sản Aspose.Imaging.Pen.Transform được thiết lập trên một không thể thay đổi Wl17.Tên, chẳng hạn như những người được trả về bởi lớp __ WL16_ .Tăng.

Width

Nhận hoặc đặt chiều rộng của Aspose.Imaging.Pen này, trong các đơn vị của đối tượng đồ họa được sử dụng để vẽ.

public float Width { get; set; }

Giá trị bất động sản

float

Exceptions

ArgumentException

Các tài sản Aspose.Imaging.Pen.Width được thiết lập trên một không thể thay đổi Wl17.Fen, chẳng hạn như những người được trả về bởi lớp __ WL16_ .FEN.

Methods

Equals(đối tượng)

Kiểm tra xem các đối tượng có bình đẳng hay không.

public override bool Equals(object obj)

Parameters

obj object

đối tượng khác.

Returns

bool

Kết quả so sánh bình đẳng

Equals(Pen)

Kiểm tra xem các đối tượng có bình đẳng hay không.

protected bool Equals(Pen other)

Parameters

other Pen

đối tượng khác.

Returns

bool

Kết quả so sánh bình đẳng

GetHashCode()

Nhận mã hash của đối tượng hiện tại.

public override int GetHashCode()

Returns

int

Mã hash

MultiplyTransform(Matrix)

Tối đa hóa matrice chuyển đổi cho Aspose.Imaging.Pen này thông qua matrix cụ thể Wl17.Matrix.

public void MultiplyTransform(Matrix matrix)

Parameters

matrix Matrix

Các đối tượng Aspose.Imaging.Matrix bằng cách đó để tăng cường matrix biến đổi.

MultiplyTransform(Matrix và MatrixOrder)

Tỷ số chuyển đổi cho Aspose.Imaging.Pen này bằng cách cụ thể WR17.Matrix trong thứ tự được chỉ định.

public void MultiplyTransform(Matrix matrix, MatrixOrder order)

Parameters

matrix Matrix

WL17_.Matrix bằng cách đó để tăng cường matrix chuyển đổi.

order MatrixOrder

Lệnh trong đó để thực hiện hoạt động gia tăng.

ResetTransform()

Khôi phục lại bản đồ biến đổi địa phương cho Aspose.Imaging.Pen này để nhận dạng.

public void ResetTransform()

RotateTransform(Sông)

xoay chuyển đổi địa phương bằng góc cụ thể. phương pháp này liên kết chuyển đổi với chuyển đổi.

public void RotateTransform(float angle)

Parameters

angle float

góc của xoay.

RotateTransform(Đánh giá MatrixOrder)

xoay chuyển đổi địa phương theo góc cụ thể trong lệnh cụ thể.

public void RotateTransform(float angle, MatrixOrder order)

Parameters

angle float

góc của xoay.

order MatrixOrder

A Aspose.Imaging.MatrixOrder mà chỉ ra liệu để bổ sung hoặc cài đặt matrix xoay.

ScaleTransform(Float , Float)

Tích thước biến đổi địa phương bằng các yếu tố cụ thể. phương pháp này phụ thuộc vào toán học quy mô để biến đổi.

public void ScaleTransform(float sx, float sy)

Parameters

sx float

Các yếu tố để quy mô chuyển đổi trong hướng x-axis.

sy float

Các yếu tố để quy mô chuyển đổi trong hướng y-axis.

ScaleTransform(Float, Float và MatrixOrder)

Tích thước biến đổi địa phương theo các yếu tố cụ thể trong thứ tự cụ thể.

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

Parameters

sx float

Các yếu tố để quy mô chuyển đổi trong hướng x-axis.

sy float

Các yếu tố để quy mô chuyển đổi trong hướng y-axis.

order MatrixOrder

A Aspose.Imaging.MatrixOrder cho biết liệu bạn có nên bổ sung hoặc cài đặt matrix.

SetLineCap(Đánh giá LineCap, LineCap, DashCap)

Thiết lập các giá trị xác định phong cách của vỏ được sử dụng để kết thúc các dòng kéo bởi Aspose.Imaging.Pen.

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

Parameters

startCap LineCap

Một Aspose.Imaging.LineCap mà đại diện cho phong cách cap để sử dụng ở đầu của các dòng được rút ra với này Wl17.Pen.

endCap LineCap

Một Aspose.Imaging.LineCap mà đại diện cho phong cách chìa khóa để sử dụng ở cuối các dòng được rút ra với Wl17.Pen.

dashCap DashCap

Một Aspose.Imaging.LineCap đại diện cho phong cách chìa khóa để sử dụng ở đầu hoặc cuối của các dòng dán kéo với này Wl17.Pen.

TranslateTransform(Float , Float)

Nó dịch chuyển đổi địa phương bằng các kích thước cụ thể. phương pháp này liên quan đến chuyển đổi.

public void TranslateTransform(float dx, float dy)

Parameters

dx float

Giá trị của phiên dịch trong x.

dy float

Giá trị của phiên dịch trong y.

TranslateTransform(Float, Float và MatrixOrder)

Chuyển đổi địa chất địa phương theo các chiều cụ thể trong thứ tự cụ thể.

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

Parameters

dx float

Giá trị của phiên dịch trong x.

dy float

Giá trị của phiên dịch trong y.

order MatrixOrder

Lệnh (prepend hoặc append) để áp dụng phiên dịch.

 Tiếng Việt