0
Q
重繪複選框
A
回答
2
這裏是你如何重繪複選框一個非常簡單的例子:
public class CustomCheckBox : CheckBox
{
public CustomCheckBox()
{
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
}
protected override void OnPaint(PaintEventArgs pevent)
{
base.OnPaint(pevent);
if (this.Checked)
{
pevent.Graphics.FillRectangle(new SolidBrush(Color.Blue), new Rectangle(0, 0, 16, 16));
}
else
{
pevent.Graphics.FillRectangle(new SolidBrush(Color.Red), new Rectangle(0, 0, 16, 16));
}
}
}
它的工作原理,但它的四周邊緣非常粗糙!然而,它確實說明了你如何繪製自定義控件。
相關問題
- 1. 重繪Highcharts複選框
- 2. 點擊繪製複選框
- 3. 選擇NG重複複選框硒
- 4. 角度NG重複選中複選框
- 5. 基於值重複選擇複選框
- 6. 重新繪製一個expandableListView對複選框事件
- 7. Matlab GUI多重繪圖複選框控件
- 8. Qt:複選框和QItemDelegate-沒有繪製複選框時發生選擇
- 9. 重置複選框ID
- 10. 組合框重複選項
- 11. jQuery重置複選框值
- 12. 繪製一個複選框在TListView的
- 13. 使用itextsharp繪製複選框
- 14. 無法在QStyledItemDelegate中繪製複選框
- 15. WinForms:控件ListView複選框繪畫
- 16. 重複繪製
- 17. AngularJS:讓與NG-重複複選框
- 18. jsf布爾複選框與UI重複
- 19. asp複選框列表重複方向
- 20. 用複選框重複控制?
- 21. 重複圖像複選框部分
- 22. 複選框不可嵌套NG-重複
- 23. UITableViewCell複選框重複滾動
- 24. PHP重複區域和複選框
- 25. 表複選框和NG-重複(角JS)
- 26. 複選框和複選框
- 27. 表單重定向複選框選擇
- 28. 選中複選框,重置輸入
- 29. Orbeon 4.10 - 從複選框填充重複重複的網格
- 30. WPF取消選擇帶複選框的複選框 - 複選框組合框
好的,那麼爲什麼不使用BackColor和ForeColor屬性? –
我想要藍色滴答的顏色和文本的顏色黑色..我似乎無法實現這與backColor/foreColor。 – p0enkie
這是正確的方向:http://social.msdn.microsoft.com/Forums/en-US/winformsdesigner/thread/27932a94-b63b-4293-ae82-f10171691888/ – Blachshma