本文整理匯總了C#中System.Drawing.Region.IsEmpty方法的典型用法代碼示例。如果您正苦於以下問題:C# Region.IsEmpty方法的具體用法?C# Region.IsEmpty怎麽用?C# Region.IsEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.Region
的用法示例。
在下文中一共展示了Region.IsEmpty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ctor_GraphicsPath
public void ctor_GraphicsPath () {
GraphicsPath path = new GraphicsPath ();
path.AddRectangle (rect);
Region r1 = new Region (path);
r1.Xor (r);
Assert.IsTrue (r1.IsEmpty (t.Graphics));
}
示例2: CheckEmpty
// a region with an "empty ctor" graphic path is "empty" (i.e. not infinite)
private void CheckEmpty (string prefix, Region region)
{
Assert.IsTrue (region.IsEmpty (graphic), prefix + "IsEmpty");
Assert.IsFalse (region.IsInfinite (graphic), prefix + "graphic");
RectangleF rect = region.GetBounds (graphic);
Assert.AreEqual (0f, rect.X, prefix + "GetBounds.X");
Assert.AreEqual (0f, rect.Y, prefix + "GetBounds.Y");
Assert.AreEqual (0f, rect.Width, prefix + "GetBounds.Width");
Assert.AreEqual (0f, rect.Height, prefix + "GetBounds.Height");
}
示例3: EmptyRegionWithInfiniteRegion
public void EmptyRegionWithInfiniteRegion ()
{
Region empty = new Region ();
empty.MakeEmpty ();
Assert.IsTrue (empty.IsEmpty (graphic), "IsEmpty");
Region region = new Region ();
Assert.IsTrue (region.IsInfinite (graphic), "IsInfinite");
region.Union (empty);
Assert.IsTrue (region.IsInfinite (graphic), "Union-IsInfinite");
region.Xor (empty);
Assert.IsTrue (region.IsInfinite (graphic), "Xor-IsInfinite");
region.Exclude (empty);
Assert.IsTrue (region.IsInfinite (graphic), "Exclude-IsInfinite");
region.Intersect (empty);
Assert.IsTrue (region.IsEmpty (graphic), "Intersect-IsEmpty");
region.MakeInfinite ();
region.Complement (empty);
Assert.IsTrue (region.IsEmpty (graphic), "Complement-IsEmpty");
}
示例4: EmptyPathWithInfiniteRegion
public void EmptyPathWithInfiniteRegion ()
{
GraphicsPath gp = new GraphicsPath ();
Region region = new Region ();
Assert.IsTrue (region.IsInfinite (graphic), "IsInfinite");
region.Union (gp);
Assert.IsTrue (region.IsInfinite (graphic), "Union-IsInfinite");
region.Xor (gp);
Assert.IsTrue (region.IsInfinite (graphic), "Xor-IsInfinite");
region.Exclude (gp);
Assert.IsTrue (region.IsInfinite (graphic), "Exclude-IsInfinite");
region.Intersect (gp);
Assert.IsTrue (region.IsEmpty (graphic), "Intersect-IsEmpty");
region.MakeInfinite ();
region.Complement (gp);
Assert.IsTrue (region.IsEmpty (graphic), "Complement-IsEmpty");
}
示例5: OnPaint
protected override void OnPaint(PaintEventArgs e)
{
DateTime startDate = DateTime.Today;
DateTime endDate = DateTime.Today.AddDays(1);
Region clippingRegion = e.Graphics.Clip;
foreach (GuideProgramCell cell in _guideProgramCells)
{
Rectangle visibleRectangle = new Rectangle(cell.Rectangle.Location, cell.Rectangle.Size);
visibleRectangle.Intersect(e.ClipRectangle);
Region cellRegion = new Region(visibleRectangle);
cellRegion.Intersect(clippingRegion);
if (cellRegion.IsEmpty(e.Graphics))
{
continue;
}
bool clipLeft = (visibleRectangle.Left != cell.Rectangle.Left) || cell.ClipLeft;
bool clipRight = (visibleRectangle.Right != cell.Rectangle.Right) || cell.ClipRight;
Padding innerPadding = new Padding(2, 2, 2, 2);
bool onNow = false;
if (_cursorAtTime.HasValue)
{
DateTime cursorTime = DateTime.Today.Add(_cursorAtTime.Value);
onNow = (cell.StartTime <= cursorTime) && (cell.StopTime > cursorTime);
}
bool isRecording = IsRecording(cell);
e.Graphics.SetClip(visibleRectangle);
if (cell.GuideProgram == null)
{
e.Graphics.FillRectangle(_unusedAreaBrush, visibleRectangle);
}
else if (!cell.IsBroadcasted)
{
e.Graphics.FillRectangle(_channelNotBroadcastedCellBrush, visibleRectangle);
}
else if (cell == _highlightedCell)
{
e.Graphics.FillRectangle(isRecording ? _highlightRecordingCellBrush : (onNow ? _highlightOnNowCellBrush : _highlightCellBrush), visibleRectangle);
}
else if (isRecording)
{
e.Graphics.FillRectangle(_recordingCellBrush, visibleRectangle);
}
else if (onNow)
{
e.Graphics.FillRectangle(_onNowCellBrush, visibleRectangle);
}
if (cell.IsTop)
{
e.Graphics.DrawLine(_epgBorderPen, visibleRectangle.Left, cell.Rectangle.Top, visibleRectangle.Right - 1, cell.Rectangle.Top);
innerPadding.Top++;
}
if (clipLeft)
{
e.Graphics.DrawLine(_epgDashedBorderPen, visibleRectangle.Left, cell.Rectangle.Top, visibleRectangle.Left, cell.Rectangle.Bottom - 1);
innerPadding.Left++;
}
else if (cell.Rectangle.Left == 0)
{
e.Graphics.DrawLine(_epgBorderPen, visibleRectangle.Left, cell.Rectangle.Top, visibleRectangle.Left, cell.Rectangle.Bottom - 1);
innerPadding.Left++;
}
Pen rightBorderPen = _epgBorderPen;
if (clipRight)
{
rightBorderPen = _epgDashedBorderPen;
}
e.Graphics.DrawLine(_epgBorderPen, visibleRectangle.Right - 1, cell.Rectangle.Bottom - 1, visibleRectangle.Left, cell.Rectangle.Bottom - 1);
e.Graphics.DrawLine(rightBorderPen, visibleRectangle.Right - 1, cell.Rectangle.Top, visibleRectangle.Right - 1, cell.Rectangle.Bottom - 1);
int innerWidth = visibleRectangle.Width - innerPadding.Horizontal;
int innerHeight = cell.Rectangle.Height - innerPadding.Vertical;
if (cell.GuideProgram != null
&& innerWidth > 0
&& innerHeight > 0)
{
Rectangle innerRectangle = new Rectangle(visibleRectangle.Left + innerPadding.Left, cell.Rectangle.Top + innerPadding.Top, innerWidth, innerHeight);
e.Graphics.SetClip(innerRectangle);
TimeSpan time = cell.GuideProgram.StartTime.TimeOfDay;
TimeSpan endTime = cell.GuideProgram.StopTime.TimeOfDay;
string timeText = EpgTimeControl.GetTimeString(time);
string endTimeText = EpgTimeControl.GetTimeString(endTime);
string timeLabelText = timeText;
if (clipLeft)
{
timeLabelText = "<" + timeText;
}
if (clipRight)
{
timeLabelText = timeText + "-" + endTimeText;
}
e.Graphics.DrawString(timeLabelText, _timeFont, _timeBrush, innerRectangle.Left, innerRectangle.Top);
//.........這裏部分代碼省略.........
示例6: OnPaint
protected override void OnPaint(PaintEventArgs e)
{
Region clippingRegion = e.Graphics.Clip;
using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
{
foreach (var cell in _channelCells)
{
Rectangle visibleRectangle = new Rectangle(cell.Rectangle.Location, cell.Rectangle.Size);
visibleRectangle.Intersect(e.ClipRectangle);
Region cellRegion = new Region(visibleRectangle);
cellRegion.Intersect(clippingRegion);
if (cellRegion.IsEmpty(e.Graphics))
{
continue;
}
e.Graphics.SetClip(visibleRectangle);
Padding innerPadding = new Padding(2, 2, 2, 2);
if (cell.Channel != null)
{
Rectangle innerRectangle = new Rectangle(cell.Rectangle.Left + innerPadding.Left, cell.Rectangle.Top + innerPadding.Top,
cell.Rectangle.Width - innerPadding.Horizontal, cell.Rectangle.Height - innerPadding.Vertical);
Image logoImage = null;
try
{
logoImage = ChannelLogosCache.GetLogoImage(tvSchedulerAgent, cell.Channel, (int)(64 * _widthFactor), (int)(64 * _heightFactor));
}
catch
{
logoImage = null;
}
if (logoImage == null)
{
e.Graphics.DrawString(cell.Channel.DisplayName, _channelFont, _channelBrush,
new RectangleF(innerRectangle.Left, innerRectangle.Top + 6, innerRectangle.Width, innerRectangle.Height));
}
else
{
e.Graphics.DrawImage(logoImage, innerRectangle.Left + (int)Math.Round((innerRectangle.Width - logoImage.Width) / 2F),
innerRectangle.Top + (int)Math.Round((innerRectangle.Height - logoImage.Height) / 2F),
logoImage.Width, logoImage.Height);
}
}
}
}
base.OnPaint(e);
}
示例7: Draw
public virtual void Draw (Graphics dc, Rectangle clip_rectangle, LinkLabel label)
{
Rectangle client_rect = label.PaddingClientRectangle;
label.DrawImage (dc, label.Image, client_rect, label.ImageAlign);
if (label.pieces == null)
return;
// Paint all text as disabled.
if (!label.Enabled) {
dc.SetClip (clip_rectangle);
ThemeEngine.Current.CPDrawStringDisabled (
dc, label.Text, label.Font, label.BackColor, client_rect, label.string_format);
return;
}
Font font, link_font = ThemeEngine.Current.GetLinkFont (label);
Region text_region = new Region (new Rectangle());
// Draw links.
for (int i = 0; i < label.pieces.Length; i ++) {
LinkLabel.Piece piece = label.pieces[i];
if (piece.link == null) {
text_region.Union (piece.region);
continue;
}
Color color = GetPieceColor (label, piece, i);
if ( (label.LinkBehavior == LinkBehavior.AlwaysUnderline) ||
(label.LinkBehavior == LinkBehavior.SystemDefault) ||
((label.LinkBehavior == LinkBehavior.HoverUnderline) && piece.link.Hovered) )
font = link_font;
else
font = label.Font;
dc.Clip = piece.region;
dc.Clip.Intersect (clip_rectangle);
dc.DrawString (label.Text, font,
ThemeEngine.Current.ResPool.GetSolidBrush (color),
client_rect, label.string_format);
// Draw focus rectangle
if ((piece.link != null) && piece.link.Focused) {
foreach (RectangleF rect in piece.region.GetRegionScans (dc.Transform))
ControlPaint.DrawFocusRectangle (dc, Rectangle.Round (rect), label.ForeColor, label.BackColor);
}
}
// Draw normal text (without links).
if (!text_region.IsEmpty (dc)) {
dc.Clip = text_region;
dc.Clip.Intersect (clip_rectangle);
if (!dc.Clip.IsEmpty (dc))
dc.DrawString(label.Text, label.Font,
ThemeEngine.Current.ResPool.GetSolidBrush(label.ForeColor),
client_rect, label.string_format);
}
}
示例8: UpatePath
internal void UpatePath(Graphics g)
{
if ((base.pretime != base.OwnerDocument.ControlTime) || (base.graphPath == null)||(base.IsChanged))
{
PointF[] tfArray3;
if (base.graphPath == null)
{
base.graphPath = new GraphicsPath();
}
base.graphPath.Reset();
PointF tf1 = new PointF(this.X1, this.Y1);
PointF tf2 = new PointF(this.X2, this.Y2);
using (Matrix matrix1 = new Matrix())
{
using (Matrix matrix2 = new Matrix())
{
bool flag1 = false;
bool flag2 = false;
if (this.StartGraph != null)
{
flag1 = true;
matrix1.Multiply(this.startGraph.Transform.Matrix);
RectangleF ef1 = this.GetBounds(this.startGraph, matrix1);
PointF tf3 = new PointF(ef1.X + (ef1.Width / 2f), ef1.Y + (ef1.Height / 2f));
PointF[] tfArray1 = (this.startGraph as IGraph).ConnectPoints.Clone() as PointF[];
if ((this.startGraphPointIndex >= 0) && (this.startGraphPointIndex < tfArray1.Length))
{
flag1 = false;
using (Matrix matrix3 = this.startGraph.Transform.Matrix.Clone())
{
matrix3.TransformPoints(tfArray1);
tf3 = tfArray1[this.startGraphPointIndex];
}
using (Matrix matrix5 = this.Transform.Matrix.Clone())
{
matrix5.Invert();
PointF[] tfArray5=new PointF[]{tf3};
matrix5.TransformPoints(tfArray5);
tf3=tfArray5[0];
}
}
tf1 = tf3;
}
if (this.EndGraph != null)
{
flag2 = true;
matrix2.Multiply(this.endGraph.Transform.Matrix);
RectangleF ef2 = this.GetBounds(this.endGraph, matrix2);
PointF tf4 = new PointF(ef2.X + (ef2.Width / 2f), ef2.Y + (ef2.Height / 2f));
PointF[] tfArray2 =(this.endGraph as IGraph).ConnectPoints.Clone() as PointF[];
if ((this.endGraphPointIndex >= 0) && (this.endGraphPointIndex < tfArray2.Length))
{
flag2 = false;
using (Matrix matrix4 = this.endGraph.Transform.Matrix.Clone())
{
matrix4.TransformPoints(tfArray2);
tf4 = tfArray2[this.endGraphPointIndex];
}
using (Matrix matrix5 = this.Transform.Matrix.Clone())
{
matrix5.Invert();
PointF[] tfArray5=new PointF[]{tf4};
matrix5.TransformPoints(tfArray5);
tf4=tfArray5[0];
}
}
tf2 = tf4;
}
if ((flag1 || flag2) && (this.startGraph != this.endGraph))
{
PointF tf5 = tf1;
PointF tf6 = tf2;
using (GraphicsPath path1 = new GraphicsPath())
{
path1.AddLine(tf1, tf2);
path1.Widen(new Pen(Color.White, 0.1f));
if (flag1)
{
using (Region region1 = new Region(this.startGraph.GPath))
{
region1.Transform(matrix1);
region1.Intersect(path1);
if (!region1.IsEmpty(g))
{
tf5 = this.Intersect(region1.GetBounds(g), tf5);
using (Matrix matrix5 = this.Transform.Matrix.Clone())
{
matrix5.Invert();
PointF[] tfArray5=new PointF[]{tf5};
matrix5.TransformPoints(tfArray5);
tf5=tfArray5[0];
}
}
}
}
if (flag2)
{
using (Region region2 = new Region(this.endGraph.GPath))
//.........這裏部分代碼省略.........
示例9: GetHrgn_Empty_MakeInfinite
public void GetHrgn_Empty_MakeInfinite ()
{
Region r = new Region (new GraphicsPath ());
Assert.IsTrue (r.IsEmpty (graphic), "Empty");
Assert.IsFalse (r.IsInfinite (graphic), "!Infinite");
IntPtr h = r.GetHrgn (graphic);
Assert.IsFalse (h == IntPtr.Zero, "Handle!=0");
r.MakeInfinite ();
Assert.IsFalse (r.IsEmpty (graphic), "!Empty");
Assert.IsTrue (r.IsInfinite (graphic), "Infinite");
Assert.AreEqual (IntPtr.Zero, r.GetHrgn (graphic), "Handle==0");
r.ReleaseHrgn (h);
}
示例10: Complement_383878
public void Complement_383878 ()
{
using (Region clipRegion = new Region ()) {
clipRegion.MakeInfinite ();
Rectangle smaller = new Rectangle (5, 5, -10, -10);
Rectangle bigger = new Rectangle (-5, -5, 12, 12);
clipRegion.Intersect (smaller);
clipRegion.Complement (bigger);
Assert.IsFalse (clipRegion.IsEmpty (graphic), "IsEmpty");
Assert.IsFalse (clipRegion.IsInfinite (graphic), "IsInfinite");
RectangleF [] rects = clipRegion.GetRegionScans (new Matrix ());
Assert.AreEqual (2, rects.Length, "Length");
Assert.AreEqual (new RectangleF (5, -5, 2, 10), rects [0], "0");
Assert.AreEqual (new RectangleF (-5, 5, 12, 2), rects [1], "1");
}
}
示例11: TestInfiniteAndEmpty
public void TestInfiniteAndEmpty()
{
Bitmap bmp = new Bitmap (600, 800);
Graphics dc = Graphics.FromImage (bmp);
Rectangle rect1, rect2;
Region rgn1;
RectangleF [] rects;
Matrix matrix = new Matrix ();
rect1 = new Rectangle (500, 30, 60, 80);
rect2 = new Rectangle (520, 40, 60, 80);
rgn1 = new Region (rect1);
rgn1.Union (rect2);
Assert.AreEqual (false, rgn1.IsEmpty (dc));
Assert.AreEqual (false, rgn1.IsInfinite (dc));
rgn1.MakeEmpty();
Assert.AreEqual (true, rgn1.IsEmpty (dc));
rgn1 = new Region (rect1);
rgn1.Union (rect2);
rgn1.MakeInfinite ();
rects = rgn1.GetRegionScans (matrix);
Assert.AreEqual (1, rects.Length);
Assert.AreEqual (-4194304, rects[0].X);
Assert.AreEqual (-4194304, rects[0].Y);
Assert.AreEqual (8388608, rects[0].Width);
Assert.AreEqual (8388608, rects[0].Height);
Assert.AreEqual (true, rgn1.IsInfinite (dc));
}
示例12: GetHrgn_Infinite_MakeEmpty
public void GetHrgn_Infinite_MakeEmpty ()
{
Region r = new Region ();
Assert.IsFalse (r.IsEmpty (graphic), "!Empty");
Assert.IsTrue (r.IsInfinite (graphic), "Infinite");
Assert.AreEqual (IntPtr.Zero, r.GetHrgn (graphic), "Handle==0");
r.MakeEmpty ();
Assert.IsTrue (r.IsEmpty (graphic), "Empty");
Assert.IsFalse (r.IsInfinite (graphic), "!Infinite");
IntPtr h = r.GetHrgn (graphic);
Assert.IsFalse (h == IntPtr.Zero, "Handle!=0");
#if NET_2_0
r.ReleaseHrgn (h);
#endif
}
示例13: isContains
/// <summary>
/// 判斷點是否在graphicspath中,這個已經包含了直線判斷和文字判斷
/// </summary>
/// <param name="arrPointF"></param>
/// <param name="MousePoint"></param>
/// <returns></returns>
public virtual bool isContains(PointF MousePoint)
{
//我想用graphicspath來判斷這個是否在其中,這樣子會精簡很多
//隻有一句話了,很精簡
//return getGraphicsPath().IsVisible(MousePoint);
//首選用路徑判斷
GraphicsPath gpath = getGraphicsPath();//取得路徑
if (gpath.IsVisible(MousePoint))
{
return true;//返回真就可以了
}
//如下還的判斷線段
//GraphicsPath.PathTypes 屬性,這個返回的是一個數組
//值 含義
// 0 指示此點是圖形的起始點。
// 1 指示此點是線段的兩個終結點之一。
// 3 指示此點是立方貝塞爾樣條的終結點或控製點。
//0x7 對三個低序位(指示點類型)之外的所有位進行掩碼。
//0x20 指定此點是一個標記。
//0x80 指定此點是閉合子路徑(圖形)中的最後一點。
//一個選段總是前麵一個0,後邊一個1,因為第一個點是圖形的起始點
//取得所有點
PointF[] pathPointfs = gpath.PathPoints;
byte[] pathPointType1 = gpath.PathTypes;//獲得點的類型
//線段總是先一個0,再一個1
for (int i = 0; i < pathPointType1.Length; i++)
{
float fltDistance;
//直線的判定如果這個為1,就判斷前一個是否為0
if ((pathPointType1[i] == 1)//如果這個等於1
&& (i - 1 >= 0) && //並且上一個沒有超出邊界,實際上這個不太需要
(pathPointType1[i - 1] == 0))//並且上一個等於0
{
fltDistance = getPointLineDistance(pathPointfs[i], pathPointfs[i - 1], MousePoint);
//如果這個距離小於精度
if (fltDistance <= fltJingDu)
return true;
}
//為了應對string類型的,我決定每個點都判斷距離
fltDistance = getPointDistance(pathPointfs[i], MousePoint);
//如果這個距離小於精度
if (fltDistance <= fltJingDu)
return true;
}
//到這裏肯定返回假了
return false;
//如下的也沒有用,隻是為了增加別人破解的難度
Region region = new Region(getGraphicsPath());
region.Intersect(new RectangleF(MousePoint, new SizeF(10, 10)));
Bitmap bitmap = new Bitmap(1000, 1000);
Graphics g = Graphics.FromImage(bitmap);
g.PageUnit = GraphicsUnit.Millimeter;
return !region.IsEmpty(g);
//如下的沒有作用,隻是為了增加別人破解。
int intResult = PtInPolygon(MousePoint, getRealPoint());
if (intResult == -1)
return false;
return true;
/**
System.Drawing.Drawing2D.GraphicsPath myGraphicsPath=new System.Drawing.Drawing2D.GraphicsPath();
Region myRegion=new Region();
myGraphicsPath.Reset();
myGraphicsPath.AddPolygon(getRealPoint() );
myRegion.MakeEmpty();
myRegion.Union(myGraphicsPath);
//返回判斷點是否在多邊形裏
return myRegion.IsVisible(MousePoint);
* */
}
示例14: OnPaint
protected override void OnPaint(PaintEventArgs e)
{
Region clippingRegion = e.Graphics.Clip;
TimeSpan time = TimeSpan.FromHours(EpgControl.EpgHoursOffset);
int left = 0;
const int step = 15;
for (int count = 0; count < (24 * 60) / step; count++)
{
TimeSpan nextTime = time.Add(TimeSpan.FromMinutes(step));
int nextLeft = EpgTimeControl.GetTimeCursorPosition(nextTime, 0);
Rectangle visibleRectangle = new Rectangle(left - 1, 0, nextLeft - left + 1, this.Height);
visibleRectangle.Intersect(e.ClipRectangle);
Region cellRegion = new Region(visibleRectangle);
cellRegion.Intersect(clippingRegion);
if (!cellRegion.IsEmpty(e.Graphics))
{
int lineLeft = Math.Max(0, left - 1);
e.Graphics.DrawLine(_epgBorderPen, lineLeft, 0, lineLeft, this.Height - 1);
string timeText = EpgTimeControl.GetTimeString(time);
e.Graphics.DrawString(timeText, _timeFont, _timeBrush, lineLeft + 1, 2);
}
left = nextLeft;
time = nextTime;
}
if (this.CursorAtTime.HasValue)
{
int position = EpgTimeControl.GetTimeCursorPosition(_cursorAtTime.Value, -1);
e.Graphics.DrawLine(_cursorPen, position, 0, position, this.Height - 1);
e.Graphics.DrawLine(_cursorShadowPen, position + 1, 0, position + 1, this.Height - 1);
string timeText = EpgTimeControl.GetTimeString(this.CursorAtTime.Value);
SizeF size = e.Graphics.MeasureString(timeText, _cursorFont);
e.Graphics.FillRectangle(_cursorBgBrush, position + 2, 1, size.Width, size.Height);
e.Graphics.DrawString(timeText, _cursorFont, _cursorBrush, position + 2, 0);
}
base.OnPaint(e);
}
示例15: DetermineRegionToRefresh
private Region DetermineRegionToRefresh(object primarySelection)
{
Rectangle[] curSelectionBounds;
Rectangle[] prevSelectionBounds;
Region region = new Region(Rectangle.Empty);
if (this.curSelectionBounds.Length >= this.prevSelectionBounds.Length)
{
curSelectionBounds = this.curSelectionBounds;
prevSelectionBounds = this.prevSelectionBounds;
}
else
{
curSelectionBounds = this.prevSelectionBounds;
prevSelectionBounds = this.curSelectionBounds;
}
bool[] flagArray = new bool[prevSelectionBounds.Length];
for (int i = 0; i < prevSelectionBounds.Length; i++)
{
flagArray[i] = false;
}
for (int j = 0; j < curSelectionBounds.Length; j++)
{
bool flag = false;
Rectangle rect = curSelectionBounds[j];
for (int m = 0; m < prevSelectionBounds.Length; m++)
{
if (rect.IntersectsWith(prevSelectionBounds[m]))
{
Rectangle rectangle2 = prevSelectionBounds[m];
flag = true;
if (rect != rectangle2)
{
region.Union(rect);
region.Union(rectangle2);
}
flagArray[m] = true;
break;
}
}
if (!flag)
{
region.Union(rect);
}
}
for (int k = 0; k < flagArray.Length; k++)
{
if (!flagArray[k])
{
region.Union(prevSelectionBounds[k]);
}
}
using (Graphics graphics = this.behaviorService.AdornerWindowGraphics)
{
if ((!region.IsEmpty(graphics) || (primarySelection == null)) || primarySelection.Equals(this.prevPrimarySelection))
{
return region;
}
for (int n = 0; n < this.curSelectionBounds.Length; n++)
{
region.Union(this.curSelectionBounds[n]);
}
}
return region;
}