АвтоАвтоматизацияАрхитектураАстрономияАудитБиологияБухгалтерияВоенное делоГенетикаГеографияГеологияГосударствоДомДругоеЖурналистика и СМИИзобретательствоИностранные языкиИнформатикаИскусствоИсторияКомпьютерыКулинарияКультураЛексикологияЛитератураЛогикаМаркетингМатематикаМашиностроениеМедицинаМенеджментМеталлы и СваркаМеханикаМузыкаНаселениеОбразованиеОхрана безопасности жизниОхрана ТрудаПедагогикаПолитикаПравоПриборостроениеПрограммированиеПроизводствоПромышленностьПсихологияРадиоРегилияСвязьСоциологияСпортСтандартизацияСтроительствоТехнологииТорговляТуризмФизикаФизиологияФилософияФинансыХимияХозяйствоЦеннообразованиеЧерчениеЭкологияЭконометрикаЭкономикаЭлектроникаЮриспунденкция

Clipping in Nested Containers

Читайте также:
  1. Chapter 5. Clipping
  2. Clipping Region
  3. Quality Settings in Nested Containers
  4. Shortening. Types of clipping: apocope, aphaeresis, syncope. Acronyms.
  5. Transformations in Nested Containers
  6. Weiler–Atherton Clipping Algorithm
  7. Контейнеры-рефрижераторы (refrigerated containers)

The following example demonstrates how nested containers handle clipping regions. The code creates a Graphics object and a container within that Graphics object. The clipping region of the Graphics object is a rectangle, and the clipping region of the container is an ellipse. The code makes two calls to the DrawLine method. The first call to DrawLine is inside the container, and the second call to DrawLine is outside the container (after the call to EndContainer). The first line is clipped by the intersection of the two clipping regions. The second line is clipped only by the rectangular clipping region of the Graphics object.

Graphics graphics = e.Graphics; GraphicsContainer graphicsContainer; Pen redPen = new Pen(Color.Red, 2); Pen bluePen = new Pen(Color.Blue, 2); SolidBrush aquaBrush = new SolidBrush(Color.FromArgb(255, 180, 255, 255)); SolidBrush greenBrush = new SolidBrush(Color.FromArgb(255, 150, 250, 130));   graphics.SetClip(new Rectangle(50, 65, 150, 120)); graphics.FillRectangle(aquaBrush, 50, 65, 150, 120);   graphicsContainer = graphics.BeginContainer(); // Create a path that consists of a single ellipse. GraphicsPath path = new GraphicsPath(); path.AddEllipse(75, 50, 100, 150);   // Construct a region based on the path. Region region = new Region(path); graphics.FillRegion(greenBrush, region);   graphics.SetClip(region, CombineMode.Replace); graphics.DrawLine(redPen, 50, 0, 350, 300); graphics.EndContainer(graphicsContainer);   graphics.DrawLine(bluePen, 70, 0, 370, 300);

The following illustration shows the two clipped lines.

 



1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 |

Поиск по сайту:



Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав. Студалл.Орг (0.003 сек.)