Here are the examples of the csharp api class System.Drawing.Region.Complement(System.Drawing.Rectangle) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
0
1. Example
Project: xenadmin
Source File: BlueBorderPanel.cs
Source File: BlueBorderPanel.cs
private IntPtr GetHRegion() { //Define a Clip Region to pass back to WM_NCPAINTs wParam. //Must be in Screen Coordinates. IntPtr hRgn; Rectangle winRect = this.Parent.RectangleToScreen(this.Bounds); Rectangle clientRect = this.RectangleToScreen(this.ClientRectangle); Region updateRegion = new Region(winRect); updateRegion.Complement(clientRect); using (Graphics g = this.CreateGraphics()) hRgn = updateRegion.GetHrgn(g); updateRegion.Dispose(); return hRgn; }
0
2. Example
Project: Sardauscan
Source File: TaskListBox.cs
Source File: TaskListBox.cs
protected override void OnPaint(PaintEventArgs e) { Region iRegion = new Region(e.ClipRectangle); e.Graphics.FillRegion(new SolidBrush(SkinInfo.BackColor), iRegion); if (this.Items.Count > 0) { for (int i = 0; i < this.Items.Count; ++i) { System.Drawing.Rectangle irect = this.GetItemRectangle(i); if (e.ClipRectangle.IntersectsWith(irect)) { if ((this.SelectionMode == SelectionMode.One && this.SelectedIndex == i) || (this.SelectionMode == SelectionMode.MultiSimple && this.SelectedIndices.Contains(i)) || (this.SelectionMode == SelectionMode.MultiExtended && this.SelectedIndices.Contains(i))) { OnDrawItem(new DrawItemEventArgs(e.Graphics, this.Font, irect, i, DrawItemState.Selected, SkinInfo.ForeColor, SkinInfo.BackColor)); } else { OnDrawItem(new DrawItemEventArgs(e.Graphics, this.Font, irect, i, DrawItemState.Default, SkinInfo.ForeColor, SkinInfo.BackColor)); } iRegion.Complement(irect); } } } base.OnPaint(e); }
0
3. Example
Project: winauth
Source File: AuthenticatorListBox.cs
Source File: AuthenticatorListBox.cs
protected override void OnPaint(PaintEventArgs e) { using (var brush = new SolidBrush(this.BackColor)) { Region region = new Region(e.ClipRectangle); e.Graphics.FillRegion(brush, region); if (this.Items.Count > 0) { for (int i = 0; i < this.Items.Count; ++i) { Rectangle irect = this.GetItemRectangle(i); if (e.ClipRectangle.IntersectsWith(irect)) { if ((this.SelectionMode == SelectionMode.One && this.SelectedIndex == i) || (this.SelectionMode == SelectionMode.MultiSimple && this.SelectedIndices.Contains(i)) || (this.SelectionMode == SelectionMode.MultiExtended && this.SelectedIndices.Contains(i))) { DrawItemEventArgs diea = new DrawItemEventArgs(e.Graphics, this.Font, irect, i, DrawItemState.Selected, this.ForeColor, this.BackColor); OnDrawItem(diea, e.ClipRectangle); base.OnDrawItem(diea); } else { DrawItemEventArgs diea = new DrawItemEventArgs(e.Graphics, this.Font, irect, i, DrawItemState.Default, this.ForeColor, this.BackColor); OnDrawItem(diea, e.ClipRectangle); base.OnDrawItem(diea); } region.Complement(irect); } } } } base.OnPaint(e); }
0
4. Example
Project: Zero-K-Infrastructure
Source File: PlayerListBox.cs
Source File: PlayerListBox.cs
protected override void OnPaint(PaintEventArgs e) { var itemRegion = new Region(e.ClipRectangle); SetStyle(ControlStyles.SupportsTransparentBackColor, true); if (!this.RenderParentsBackgroundImage(e)) e.Graphics.FillRegion(new SolidBrush(BackColor), itemRegion); if (base.Items.Count > 0) { for (var i = 0; i < base.Items.Count; ++i) { var itemRectangle = GetItemRectangle(i); if (e.ClipRectangle.IntersectsWith(itemRectangle)) { if ((SelectionMode == SelectionMode.One && SelectedIndex == i) || (SelectionMode == SelectionMode.MultiSimple && SelectedIndices.Contains(i)) || (SelectionMode == SelectionMode.MultiExtended && SelectedIndices.Contains(i))) OnDrawItem(new DrawItemEventArgs(e.Graphics, Font, itemRectangle, i, DrawItemState.Selected, ForeColor, BackColor)); else OnDrawItem(new DrawItemEventArgs(e.Graphics, Font, itemRectangle, i, DrawItemState.Default, ForeColor, BackColor)); itemRegion.Complement(itemRectangle); } } } base.OnPaint(e); }