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
implements
الأعضاء الموروثة
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
//المعامل الثاني من نوع Boolean يحدد ما إذا كان الملف الذي سيتم إنشاؤه مؤقتًا أم لا
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.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
//المعامل الثاني من نوع Boolean يحدد ما إذا كان الملف الذي سيتم إنشاؤه مؤقتًا أم لا
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.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
//المعامل الثاني من نوع Boolean يحدد ما إذا كان الملف الذي سيتم إنشاؤه مؤقتًا أم لا
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.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; }