Class HatchBrush
Namespace: Aspose.Imaging.Brushes
Assembly: Aspose.Imaging.dll (25.2.0)
یک قلم مستطیلی با سبک هچ، رنگ پیشزمینه و رنگ پسزمینه تعریف میکند. این کلاس قابل وراثت نیست.
[JsonObject(MemberSerialization.OptIn)]
public sealed class HatchBrush : Brush, IDisposable
وراثت
object ← DisposableObject ← Brush ← HatchBrush
پیادهسازیها
اعضای وراثتیافته
Brush.DeepClone(), Brush.Equals(object), Brush.GetHashCode(), Brush.Opacity, DisposableObject.Dispose(), DisposableObject.Disposed, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
مثالها
این مثال ایجاد و استفاده از اشیاء قلم را نشان میدهد. این مثال یک تصویر جدید ایجاد کرده و مستطیلها را بر روی سطح تصویر رسم میکند.```csharp [C#]
//یک نمونه از BmpOptions ایجاد کرده و ویژگیهای مختلف آن را تنظیم کنید
Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
bmpOptions.BitsPerPixel = 24;
//یک نمونه از FileCreateSource ایجاد کرده و آن را به عنوان منبع برای نمونه BmpOptions اختصاص دهید
//پارامتر بولی دوم تعیین میکند که آیا فایل ایجاد شده موقتی است یا خیر
bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);
//یک نمونه از تصویر در مسیر مشخص ایجاد کنید
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
{
//یک نمونه از Graphics ایجاد کرده و آن را با شیء تصویر مقداردهی اولیه کنید
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//سطح Graphics را با رنگ سفید پاک کنید
graphics.Clear(Aspose.Imaging.Color.White);
//یک نمونه از قلم با رنگ قرمز و عرض 5 ایجاد کنید
Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);
//یک نمونه از HatchBrush ایجاد کرده و ویژگیهای آن را تنظیم کنید
Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
brush.ForegroundColor = Aspose.Imaging.Color.Red;
//یک نمونه از قلم ایجاد کنید
//آن را با شیء HatchBrush و عرض مقداردهی اولیه کنید
Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);
//مستطیلها را با مشخص کردن شیء قلم رسم کنید
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))
});
//مستطیلها را با مشخص کردن شیء قلم رسم کنید
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))
});
// تمام تغییرات را ذخیره کنید.
image.Save();
}
## سازندهها
### <a id="Aspose_Imaging_Brushes_HatchBrush__ctor"></a> HatchBrush\(\)
```csharp
public HatchBrush()
ویژگیها
BackgroundColor
رنگ فضاهای بین خطوط هچ را دریافت یا تنظیم میکند.
public Color BackgroundColor { get; set; }
مقدار ویژگی
مثالها
این مثال ایجاد و استفاده از اشیاء قلم را نشان میدهد. این مثال یک تصویر جدید ایجاد کرده و مستطیلها را بر روی سطح تصویر رسم میکند.```csharp [C#]
//یک نمونه از BmpOptions ایجاد کرده و ویژگیهای مختلف آن را تنظیم کنید
Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
bmpOptions.BitsPerPixel = 24;
//یک نمونه از FileCreateSource ایجاد کرده و آن را به عنوان منبع برای نمونه BmpOptions اختصاص دهید
//پارامتر بولی دوم تعیین میکند که آیا فایل ایجاد شده موقتی است یا خیر
bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);
//یک نمونه از تصویر در مسیر مشخص ایجاد کنید
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
{
//یک نمونه از Graphics ایجاد کرده و آن را با شیء تصویر مقداردهی اولیه کنید
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//سطح Graphics را با رنگ سفید پاک کنید
graphics.Clear(Aspose.Imaging.Color.White);
//یک نمونه از قلم با رنگ قرمز و عرض 5 ایجاد کنید
Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);
//یک نمونه از HatchBrush ایجاد کرده و ویژگیهای آن را تنظیم کنید
Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
brush.ForegroundColor = Aspose.Imaging.Color.Red;
//یک نمونه از قلم ایجاد کنید
//آن را با شیء HatchBrush و عرض مقداردهی اولیه کنید
Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);
//مستطیلها را با مشخص کردن شیء قلم رسم کنید
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))
});
//مستطیلها را با مشخص کردن شیء قلم رسم کنید
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))
});
// تمام تغییرات را ذخیره کنید.
image.Save();
}
### <a id="Aspose_Imaging_Brushes_HatchBrush_ForegroundColor"></a> ForegroundColor
رنگ خطوط هچ را دریافت یا تنظیم میکند.
```csharp
public Color ForegroundColor { get; set; }
مقدار ویژگی
مثالها
این مثال ایجاد و استفاده از اشیاء قلم را نشان میدهد. این مثال یک تصویر جدید ایجاد کرده و مستطیلها را بر روی سطح تصویر رسم میکند.```csharp [C#]
//یک نمونه از BmpOptions ایجاد کرده و ویژگیهای مختلف آن را تنظیم کنید
Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
bmpOptions.BitsPerPixel = 24;
//یک نمونه از FileCreateSource ایجاد کرده و آن را به عنوان منبع برای نمونه BmpOptions اختصاص دهید
//پارامتر بولی دوم تعیین میکند که آیا فایل ایجاد شده موقتی است یا خیر
bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);
//یک نمونه از تصویر در مسیر مشخص ایجاد کنید
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
{
//یک نمونه از Graphics ایجاد کرده و آن را با شیء تصویر مقداردهی اولیه کنید
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//سطح Graphics را با رنگ سفید پاک کنید
graphics.Clear(Aspose.Imaging.Color.White);
//یک نمونه از قلم با رنگ قرمز و عرض 5 ایجاد کنید
Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);
//یک نمونه از HatchBrush ایجاد کرده و ویژگیهای آن را تنظیم کنید
Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
brush.ForegroundColor = Aspose.Imaging.Color.Red;
//یک نمونه از قلم ایجاد کنید
//آن را با شیء HatchBrush و عرض مقداردهی اولیه کنید
Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);
//مستطیلها را با مشخص کردن شیء قلم رسم کنید
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))
});
//مستطیلها را با مشخص کردن شیء قلم رسم کنید
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))
});
// تمام تغییرات را ذخیره کنید.
image.Save();
}
### <a id="Aspose_Imaging_Brushes_HatchBrush_HatchStyle"></a> HatchStyle
سبک هچ این قلم را دریافت یا تنظیم میکند.
```csharp
public HatchStyle HatchStyle { get; set; }