嗨我需要在矩形中绘制一个复选框。在c#WPF中有任何预定义的方法。或者如何在WPF中实现这个senario。
You may try this:
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.) Create the Rectanle
2.) Create the checkbox
3.) use rectangle.Controls.Add(checkbox)
Hope this helps :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.