本文整理汇总了C#中SolidBrush.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# SolidBrush.Dispose方法的具体用法?C# SolidBrush.Dispose怎么用?C# SolidBrush.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolidBrush
的用法示例。
在下文中一共展示了SolidBrush.Dispose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawLabels
// ===================================================================
protected void DrawLabels(ref Graphics g)
{
SizeF maxSize = g.MeasureString(m_MaxLabel, Font);
SizeF minSize = g.MeasureString(m_MinLabel, Font);
int textWidth = (int)((maxSize.Width > minSize.Width)
? maxSize.Width
: minSize.Width) + 6;
SolidBrush textBrush = new SolidBrush(m_TextColor);
/* Draw the labels (max: Top) (min: Bottom) */
g.DrawString(m_MaxLabel, Font, textBrush,
textWidth / 2 - (maxSize.Width / 2),
2);
g.DrawString(m_MinLabel, Font, textBrush,
textWidth / 2 - (minSize.Width / 2),
Height - minSize.Height - 2);
textBrush.Dispose();
/* Draw the bordering line */
Pen borderPen = new Pen(m_GridColor, 1);
g.DrawLine(borderPen, textWidth + 6, 0, textWidth + 6, Height);
borderPen.Dispose();
/* Update the offset so we don't draw the graph over the labels */
m_OffsetX = textWidth + 6;
}
示例2: DrawBar
// ===================================================================
private void DrawBar(Rectangle rect, Line line, ref Graphics g)
{
SolidBrush barBrush = new SolidBrush(line.m_Color);
g.FillRectangle(barBrush, rect);
barBrush.Dispose();
}
示例3: DoPaint
public virtual void DoPaint(Graphics gr)
{
if ((this.GetRules() & SelectionRules.Visible) != SelectionRules.None)
{
bool primary = false;
if (this.selUIsvc.selSvc != null)
{
primary = this.component == this.selUIsvc.selSvc.PrimarySelection;
primary = primary == (this.selUIsvc.selSvc.SelectionCount <= 1);
}
Rectangle rectangle = new Rectangle(this.outerRect.X, this.outerRect.Y, 7, 7);
Rectangle innerRect = this.innerRect;
Rectangle outerRect = this.outerRect;
Region clip = gr.Clip;
System.Drawing.Color control = SystemColors.Control;
if ((this.control != null) && (this.control.Parent != null))
{
control = this.control.Parent.BackColor;
}
Brush brush = new SolidBrush(control);
gr.ExcludeClip(innerRect);
gr.FillRectangle(brush, outerRect);
brush.Dispose();
gr.Clip = clip;
ControlPaint.DrawSelectionFrame(gr, false, outerRect, innerRect, control);
if (((this.GetRules() & (SelectionRules.None | SelectionRules.Locked)) == SelectionRules.None) && ((this.GetRules() & SelectionRules.AllSizeable) != SelectionRules.None))
{
ControlPaint.DrawGrabHandle(gr, rectangle, primary, this.sizes[0] != 0);
rectangle.X = innerRect.X + innerRect.Width;
ControlPaint.DrawGrabHandle(gr, rectangle, primary, this.sizes[2] != 0);
rectangle.Y = innerRect.Y + innerRect.Height;
ControlPaint.DrawGrabHandle(gr, rectangle, primary, this.sizes[7] != 0);
rectangle.X = outerRect.X;
ControlPaint.DrawGrabHandle(gr, rectangle, primary, this.sizes[5] != 0);
rectangle.X += (outerRect.Width - 7) / 2;
ControlPaint.DrawGrabHandle(gr, rectangle, primary, this.sizes[6] != 0);
rectangle.Y = outerRect.Y;
ControlPaint.DrawGrabHandle(gr, rectangle, primary, this.sizes[1] != 0);
rectangle.X = outerRect.X;
rectangle.Y = innerRect.Y + ((innerRect.Height - 7) / 2);
ControlPaint.DrawGrabHandle(gr, rectangle, primary, this.sizes[3] != 0);
rectangle.X = innerRect.X + innerRect.Width;
ControlPaint.DrawGrabHandle(gr, rectangle, primary, this.sizes[4] != 0);
}
else
{
ControlPaint.DrawLockedFrame(gr, outerRect, primary);
}
}
}