1 / 8

renad

Graphics GDI+. Contents. www.renad.org. Graphics GDI+. Contents. www.renad.org. המחלקה Brush. Graphics GDI+. Contents. www.renad.org. המחלקה Brush. מחלקה שמגדירה את הסגנון והצבע למילוי צורה. המחלקה Graphics מכילה מתודות למילוי הצורות של רוב מתודות הציור.

inga
Télécharger la présentation

renad

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GraphicsGDI+ Contents www.renad.org

  2. GraphicsGDI+ Contents www.renad.org המחלקה Brush

  3. GraphicsGDI+ Contents www.renad.org המחלקה Brush • מחלקה שמגדירה את הסגנון והצבע למילוי צורה. • המחלקה Graphics מכילה מתודות למילוי הצורות של רוב מתודות הציור. • מתודות אלו עובדות בדיוק כמו מתודות הציור, השוני הוא שהן מקבלות אובייקט מסוג מברשת במקום אובייקט מסוג עט. • Brush היא מחלקה מופשטת וצריך להשתמש במחלקות הנגזרות שלה על מנת שנוכל למלות את הצורות. Brush b = new SolidBrush(Color.Green);

  4. GraphicsGDI+ Contents www.renad.org סוגי המברשות של המחלקה Brush • SolidBrush : מילוי פשוט של צבע אחד. • HatchBrush : מילוי ע"י תבנית שמכילה שני סוגים של קווים אופקיים, מאונכים או אלכסוניים . • TextureBrush : מילוי ע"י תמונה. • PathGradientBrush: מילוי ע"י מעבר הדרגתי של צבעים מנקודה מסויימת. • LinearGradientBrush : מילוי ע"י מעבר הדרגתי מצבע אחד לשני.

  5. GraphicsGDI+ Contents www.renad.org FillEllipse • מלוי אליפסה בצבע ירוק. • בדוגמה הבאה נשתמש בשתי שיטות: • בראשונה נעשה שימוש ישיר במברשת. • בשנייה ניצור את האובייקט המתאים ולאחר מכן נשתמש בו. Graphics gr = this.CreateGraphics(); gr.FillEllipse(Brushes.Green, 40, 70, 150, 100); Graphics gr = this.CreateGraphics(); Brush b = new SolidBrush(Color.Green); gr.FillEllipse(b, 40, 70, 150, 100);

  6. GraphicsGDI+ Contents www.renad.org FillEllipse • הפעם נשתמש באירוע MouseMove של הטופס. • בעזרת המברשת נמלא אליפסה בצבע ירוק ונצייר בצורה חופשית: private void TestForm_MouseMove(object sender, MouseEventArgs e) { Graphics gr = this.CreateGraphics(); gr.FillEllipse(Brushes.Green, e.X, e.Y, 15, 15); {

  7. GraphicsGDI+ Contents www.renad.org FillRectangle • בדוגמה הבאה נראה איך אפשר למלאות מלבן בצבע אדום בעזרת המתודה FillRectangle. Graphics g = this.CreateGraphics(); g. FillRectangle(Brushes.Red, 60, 10, 100, 200);

  8. GraphicsGDI+ Contents www.renad.org HatchBrush Graphics gr = e.Graphics; HatchBrush hatch1 = new HatchBrush(HatchStyle.Vertical, Color.Yellow, Color.Blue); gr.FillEllipse(hatch1, 50, 10, 100, 150); Graphics gr = e.Graphics; HatchBrush hatch1 = new HatchBrush(HatchStyle. HorizontalBrick, Color.Yellow, Color.Blue); gr.FillEllipse(hatch1, 50, 10, 100, 150);

More Related