簡體   English   中英

如何使用DrawingContext c#在WPF中繪制復選框

[英]How to Draw checkbox in WPF using DrawingContext c#

嗨我需要在矩形中繪制一個復選框。在c#WPF中有任何預定義的方法。或者如何在WPF中實現這個senario。

你可以試試這個:

 CheckBox checkbox = new CheckBox();
 checkbox.Content = "Content";
 checkbox.Height = 50;
 checkbox.Width = 100;
 checkbox.IsChecked = true;
 checkbox.HorizontalAlignment = HorizontalAlignment.Left;

 VisualBrush vb = new VisualBrush(checkbox);
 drawingContext.DrawRectangle(vb, null, new Rect(50, 50, 100, 50));

1.)創建Rectanle

2.)創建復選框

3.)使用rectangle.Controls.Add(復選框)

希望這可以幫助 :)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM