[英]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.