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()
דוגמאות
דוגמה זו מציגה את יצירת ושימוש באובייקטי Pen. הדוגמה יוצרת תמונה חדשה ומציירת מלבנים על פני התמונה.```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);
//צור מופע של Image בנתיב שנבחר
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
{
//צור מופע של Graphics והתחל אותו עם אובייקט Image
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//נקה את שטח ה-Grapics עם צבע לבן
graphics.Clear(Aspose.Imaging.Color.White);
//צור מופע של Pen עם צבע אדום ורוחב 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;
//צור מופע של Pen
//התחל אותו עם אובייקט HatchBrush ורוחב
Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);
//צייר מלבנים על ידי ציון אובייקט Pen
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))
});
//צייר מלבנים על ידי ציון אובייקט Pen
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; }
ערך המאפיין
דוגמאות
דוגמה זו מציגה את יצירת ושימוש באובייקטי Pen. הדוגמה יוצרת תמונה חדשה ומציירת מלבנים על פני התמונה.```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);
//צור מופע של Image בנתיב שנבחר
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
{
//צור מופע של Graphics והתחל אותו עם אובייקט Image
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//נקה את שטח ה-Grapics עם צבע לבן
graphics.Clear(Aspose.Imaging.Color.White);
//צור מופע של Pen עם צבע אדום ורוחב 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;
//צור מופע של Pen
//התחל אותו עם אובייקט HatchBrush ורוחב
Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);
//צייר מלבנים על ידי ציון אובייקט Pen
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))
});
//צייר מלבנים על ידי ציון אובייקט Pen
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; }
ערך המאפיין
דוגמאות
דוגמה זו מציגה את יצירת ושימוש באובייקטי Pen. הדוגמה יוצרת תמונה חדשה ומציירת מלבנים על פני התמונה.```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);
//צור מופע של Image בנתיב שנבחר
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
{
//צור מופע של Graphics והתחל אותו עם אובייקט Image
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//נקה את שטח ה-Grapics עם צבע לבן
graphics.Clear(Aspose.Imaging.Color.White);
//צור מופע של Pen עם צבע אדום ורוחב 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;
//צור מופע של Pen
//התחל אותו עם אובייקט HatchBrush ורוחב
Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);
//צייר מלבנים על ידי ציון אובייקט Pen
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))
});
//צייר מלבנים על ידי ציון אובייקט Pen
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; }