我正在开展一个项目,我需要在中间添加一个带文字的圆圈.我正在使用下面的代码.但我的问题是圆圈太小,当我调整它的大小时,它会重叠其他控件.我想绘制与正方形相同宽度的圆圈,或者如何使背景透明?
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
using (Bitmap bitmap = new Bitmap(this.Width, this.Height))
{
using (Graphics graphics = Graphics.FromImage(bitmap))
{
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.Clear(this.BackColor);
using (SolidBrush brush = new SolidBrush(this._FillColor))
{
graphics.FillEllipse(brush, 0x18 - 6, 0x18 - 6, (this.Width - 0x30) + 12, (this.Height - 0x30) + 12);
}
Brush FontColor = new SolidBrush(this.ForeColor);
SizeF MS = graphics.MeasureString(Convert.ToString(Convert.ToInt32((100 / _Maximum) * _Value)), Font);
graphics.DrawString(Convert.ToString(Convert.ToInt32((100 / _Maximum) * _Value)), Font, FontColor, Convert.ToInt32((Width / 2 - MS.Width / 2) + …
Run Code Online (Sandbox Code Playgroud) 我正在做一个允许用户自定义a属性的项目Control
.我有了一个控制像一个形式Label
,TextBox
,Button
和PropertyGrid
控制.当用户点击Label
我显示的属性Label
在ProeprtyGrid
这是所有使用以下代码精细工作:
propertyGrid1.SelectedObject = SelectedControl;
Run Code Online (Sandbox Code Playgroud)
但我只是想表明像一些性质BackColor
,Font
,ForeColor
,Text
.是否可以隐藏属性,因为我不希望用户更改或显示它们?如果有,怎么样?