本文整理匯總了C#中System.Windows.Controls.RadioButton.SetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# RadioButton.SetValue方法的具體用法?C# RadioButton.SetValue怎麽用?C# RadioButton.SetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Controls.RadioButton
的用法示例。
在下文中一共展示了RadioButton.SetValue方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: cnvPaint_Drop
void cnvPaint_Drop(object sender, DragEventArgs e)
{
try
{
if (e.Data.GetData(typeof(Button)) != null)
{
if (((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Name.ToString() == "cnvControls")
{
Point p = e.GetPosition((IInputElement)cnvPaint);
Button btn = new Button();
btn.Height = 25;
btn.Width = 100;
btn.Content = "Button";
btn.PreviewMouseDown += new MouseButtonEventHandler(btnDrag_PreviewMouseDown);
btn.SetValue(Canvas.LeftProperty, 10.0);
btn.SetValue(Canvas.TopProperty, 10.0);
ctlPOD objPOD = new ctlPOD();
objPOD.AllowDrop = true;
objPOD.Height = 25;
objPOD.Width = 100;
objPOD.PreviewMouseDown += new MouseButtonEventHandler(objPOD_PreviewMouseDown);
objPOD.SetValue(Canvas.LeftProperty, p.X);
objPOD.SetValue(Canvas.TopProperty, p.Y);
MyPropGrid.ControlToBind = objPOD;
objPOD.cnvPOD.Children.Add(btn);
currentControl = objPOD;
cnvPaint.Children.Add(objPOD);
}
else if ((((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Parent).GetType() == typeof(ctlPOD))
{
if (currentControl.rect.Visibility == Visibility.Visible)
{
Point p = e.GetPosition((IInputElement)cnvPaint);
((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Parent.SetValue(Canvas.LeftProperty, p.X - PrePoint.X);
((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Parent.SetValue(Canvas.TopProperty, p.Y - PrePoint.Y);
}
}
}
else if (e.Data.GetData(typeof(TabControl)) != null)
{
if (((Canvas)((TabControl)e.Data.GetData(typeof(TabControl))).Parent).Name.ToString() == "cnvControls")
{
Point p = e.GetPosition((IInputElement)cnvPaint);
TabControl lbl = new TabControl();
//lbl.Content = "TabControl";
lbl.HorizontalContentAlignment = HorizontalAlignment.Center;
lbl.Height = 25;
lbl.Width = 100;
lbl.PreviewMouseDown += new MouseButtonEventHandler(tabDrag999_PreviewMouseDown);
lbl.SetValue(Canvas.LeftProperty, 10.0);
lbl.SetValue(Canvas.TopProperty, 10.0);
ctlPOD objPOD = new ctlPOD();
objPOD.cnvPOD.Children.Add(lbl);
objPOD.AllowDrop = true;
objPOD.Height = 25;
objPOD.Width = 100;
objPOD.SetValue(Canvas.LeftProperty, p.X);
objPOD.SetValue(Canvas.TopProperty, p.Y);
MyPropGrid.ControlToBind = objPOD;
objPOD.KeyDown += new KeyEventHandler(objPOD_KeyDown);
objPOD.PreviewMouseDown += new MouseButtonEventHandler(objPOD_PreviewMouseDown);
currentControl = objPOD;
cnvPaint.Children.Add(objPOD);
}
else if ((((Canvas)((TabControl)e.Data.GetData(typeof(TabControl))).Parent).Parent).GetType() == typeof(ctlPOD))
{
Point p = e.GetPosition((IInputElement)cnvPaint);
((Canvas)((TabControl)e.Data.GetData(typeof(TabControl))).Parent).Parent.SetValue(Canvas.LeftProperty, p.X - PrePoint.X);
((Canvas)((TabControl)e.Data.GetData(typeof(TabControl))).Parent).Parent.SetValue(Canvas.TopProperty, p.Y - PrePoint.Y);
}
}
else if (e.Data.GetData(typeof(Label)) != null)
{
if (((Canvas)((Label)e.Data.GetData(typeof(Label))).Parent).Name.ToString() == "cnvControls")
{
Point p = e.GetPosition((IInputElement)cnvPaint);
Label lbl = new Label();
lbl.Content = "Label";
lbl.HorizontalContentAlignment = HorizontalAlignment.Center;
lbl.Height = 25;
lbl.Width = 100;
lbl.PreviewMouseDown += new MouseButtonEventHandler(lblDrag_PreviewMouseDown);
lbl.SetValue(Canvas.LeftProperty, 10.0);
lbl.SetValue(Canvas.TopProperty, 10.0);
ctlPOD objPOD = new ctlPOD();
objPOD.cnvPOD.Children.Add(lbl);
objPOD.AllowDrop = true;
objPOD.Height = 25;
objPOD.Width = 100;
objPOD.SetValue(Canvas.LeftProperty, p.X);
objPOD.SetValue(Canvas.TopProperty, p.Y);
MyPropGrid.ControlToBind = objPOD;
objPOD.KeyDown += new KeyEventHandler(objPOD_KeyDown);
//.........這裏部分代碼省略.........
示例2: cnvPaint_Drop
void cnvPaint_Drop(object sender, DragEventArgs e)
{
if (e.Data.GetData(typeof(Button)) != null)
{
if (((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Name.ToString() == "cnvControls")
{
Point p = e.GetPosition((IInputElement)cnvPaint);
Button btn = new Button();
btn.Height = 25;
btn.Width = 100;
btn.Content = "Button";
btn.Background = Brushes.Transparent;
btn.PreviewMouseDown += new MouseButtonEventHandler(btnDrag_PreviewMouseDown);
btn.SetValue(Canvas.LeftProperty, 10.0);
btn.SetValue(Canvas.TopProperty, 10.0);
ctlPOD objPOD = new ctlPOD();
objPOD.AllowDrop = true;
objPOD.Height = 25;
objPOD.Width = 100;
objPOD.SetValue(Canvas.LeftProperty, p.X);
objPOD.SetValue(Canvas.TopProperty, p.Y);
MyPropGrid.ControlToBind = objPOD;
objPOD.PreviewMouseDown += new MouseButtonEventHandler(objPOD_PreviewMouseDown);
objPOD.cnvPOD.Children.Add(btn);
currentControl = objPOD;
cnvPaint.Children.Add(objPOD);
}
else if ((((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Parent).GetType() == typeof(ctlPOD))
{
//v
// if (currentControl.rect.Visibility == Visibility.Visible)
{
Point p = e.GetPosition((IInputElement)cnvPaint);
((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Parent.SetValue(Canvas.LeftProperty, p.X - PrePoint.X);
((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Parent.SetValue(Canvas.TopProperty, p.Y - PrePoint.Y);
}
}
}
else if (e.Data.GetData(typeof(Label)) != null)
{
if (((Canvas)((Label)e.Data.GetData(typeof(Label))).Parent).Name.ToString() == "cnvControls")
{
Point p = e.GetPosition((IInputElement)cnvPaint);
Label lbl = new Label();
lbl.Content = "Label";
lbl.Background = Brushes.Transparent;
lbl.Foreground = Brushes.Black ;
lbl.HorizontalContentAlignment = HorizontalAlignment.Center;
lbl.Height = 25;
lbl.Width = 100;
lbl.PreviewMouseDown += new MouseButtonEventHandler(lblDrag_PreviewMouseDown);
lbl.SetValue(Canvas.LeftProperty, 10.0);
lbl.SetValue(Canvas.TopProperty, 10.0);
ctlPOD objPOD = new ctlPOD();
objPOD.cnvPOD.Children.Add(lbl);
objPOD.AllowDrop = true;
objPOD.Height = 25;
objPOD.Width = 100;
objPOD.SetValue(Canvas.LeftProperty, p.X);
objPOD.SetValue(Canvas.TopProperty, p.Y);
MyPropGrid.ControlToBind = objPOD;
objPOD.KeyDown += new KeyEventHandler(objPOD_KeyDown);
objPOD.PreviewMouseDown += new MouseButtonEventHandler(objPOD_PreviewMouseDown);
currentControl = objPOD;
cnvPaint.Children.Add(objPOD);
}
else if ((((Canvas)((Label)e.Data.GetData(typeof(Label))).Parent).Parent).GetType() == typeof(ctlPOD))
{
Point p = e.GetPosition((IInputElement)cnvPaint);
((Canvas)((Label)e.Data.GetData(typeof(Label))).Parent).Parent.SetValue(Canvas.LeftProperty, p.X - PrePoint.X);
((Canvas)((Label)e.Data.GetData(typeof(Label))).Parent).Parent.SetValue(Canvas.TopProperty, p.Y - PrePoint.Y);
}
}
else if (e.Data.GetData(typeof(TextBox)) != null)
{
if (((Canvas)((TextBox)e.Data.GetData(typeof(TextBox))).Parent).Name.ToString() == "cnvControls")
{
Point p = e.GetPosition((IInputElement)cnvPaint);
TextBox txt = new TextBox();
txt.Cursor = Cursors.Arrow;
txt.Background = Brushes.Transparent;
txt.Height = 25;
txt.Width = 100;
txt.Text = "TextBox";
txt.MouseDown += new MouseButtonEventHandler(txt_MouseDown);
txt.PreviewMouseDown += new MouseButtonEventHandler(txtDrag_PreviewMouseDown);
txt.SetValue(Canvas.LeftProperty, 10.0);
txt.SetValue(Canvas.TopProperty, 10.0);
ctlPOD objPOD = new ctlPOD();
//.........這裏部分代碼省略.........
示例3: cnvPaint_Drop
void cnvPaint_Drop(object sender, DragEventArgs e)
{
try
{
if (e.Data.GetData(typeof(Button)) != null)
{
if (((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Name.ToString() == "cnvControls")
{
Point p = e.GetPosition((IInputElement)cnvPaint);
Button btn = new Button();
btn.Height = 25;
btn.Width = 100;
btn.Content = "Button";
btn.PreviewMouseDown += new MouseButtonEventHandler(btnDrag_PreviewMouseDown);
btn.SetValue(Canvas.LeftProperty, 10.0);
btn.SetValue(Canvas.TopProperty, 10.0);
ctlPOD objPOD = new ctlPOD();
objPOD.AllowDrop = true;
objPOD.Height = 25;
objPOD.Width = 100;
objPOD.PreviewMouseDown += new MouseButtonEventHandler(objPOD_PreviewMouseDown);
objPOD.SetValue(Canvas.LeftProperty, p.X);
objPOD.SetValue(Canvas.TopProperty, p.Y);
MyPropGrid.ControlToBind = objPOD;
objPOD.cnvPOD.Children.Add(btn);
currentControl = objPOD;
cnvPaint.Children.Add(objPOD);
}
else if ((((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Parent).GetType() == typeof(ctlPOD))
{
if (currentControl.rect.Visibility == Visibility.Visible)
{
Point p = e.GetPosition((IInputElement)cnvPaint);
((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Parent.SetValue(Canvas.LeftProperty, p.X - PrePoint.X);
((Canvas)((Button)e.Data.GetData(typeof(Button))).Parent).Parent.SetValue(Canvas.TopProperty, p.Y - PrePoint.Y);
}
}
}
else if (e.Data.GetData(typeof(TabControl)) != null)
{
if (((Canvas)((TabControl)e.Data.GetData(typeof(TabControl))).Parent).Name.ToString() == "cnvControls")
{
Point p = e.GetPosition((IInputElement)cnvPaint);
TabControl lbl = new TabControl();
//lbl.Content = "TabControl";
lbl.HorizontalContentAlignment = HorizontalAlignment.Center;
lbl.Height = 25;
lbl.Width = 100;
lbl.PreviewMouseDown += new MouseButtonEventHandler(tabDrag999_PreviewMouseDown);
lbl.SetValue(Canvas.LeftProperty, 10.0);
lbl.SetValue(Canvas.TopProperty, 10.0);
ctlPOD objPOD = new ctlPOD();
objPOD.cnvPOD.Children.Add(lbl);
objPOD.AllowDrop = true;
objPOD.Height = 25;
objPOD.Width = 100;
objPOD.SetValue(Canvas.LeftProperty, p.X);
objPOD.SetValue(Canvas.TopProperty, p.Y);
MyPropGrid.ControlToBind = objPOD;
objPOD.KeyDown += new KeyEventHandler(objPOD_KeyDown);
objPOD.PreviewMouseDown += new MouseButtonEventHandler(objPOD_PreviewMouseDown);
currentControl = objPOD;
cnvPaint.Children.Add(objPOD);
}
else if ((((Canvas)((TabControl)e.Data.GetData(typeof(TabControl))).Parent).Parent).GetType() == typeof(ctlPOD))
{
Point p = e.GetPosition((IInputElement)cnvPaint);
((Canvas)((TabControl)e.Data.GetData(typeof(TabControl))).Parent).Parent.SetValue(Canvas.LeftProperty, p.X - PrePoint.X);
((Canvas)((TabControl)e.Data.GetData(typeof(TabControl))).Parent).Parent.SetValue(Canvas.TopProperty, p.Y - PrePoint.Y);
}
}
else if (e.Data.GetData(typeof(Label)) != null)
{
if (((Canvas)((Label)e.Data.GetData(typeof(Label))).Parent).Name.ToString() == "cnvControls")
{
Point p = e.GetPosition((IInputElement)cnvPaint);
Label lbl = new Label();
lbl.Content = "Label";
lbl.HorizontalContentAlignment = HorizontalAlignment.Center;
lbl.Height = 25;
lbl.Width = 100;
lbl.PreviewMouseDown += new MouseButtonEventHandler(lblDrag_PreviewMouseDown);
lbl.SetValue(Canvas.LeftProperty, 10.0);
lbl.SetValue(Canvas.TopProperty, 10.0);
ctlPOD objPOD = new ctlPOD();
objPOD.cnvPOD.Children.Add(lbl);
objPOD.AllowDrop = true;
objPOD.Height = 25;
objPOD.Width = 100;
objPOD.SetValue(Canvas.LeftProperty, p.X);
objPOD.SetValue(Canvas.TopProperty, p.Y);
MyPropGrid.ControlToBind = objPOD;
objPOD.KeyDown += new KeyEventHandler(objPOD_KeyDown);
//.........這裏部分代碼省略.........
示例4: AddButton
void AddButton(string caption)
{
var btn = new RadioButton();
btn.Content = caption;
btn.Margin = new Thickness(4, 0, 4, 0);
btn.IsChecked = (int)_testType == this.Children.Count;
btn.Checked += btn_Checked;
btn.SetValue(Grid.ColumnProperty, this.Children.Count);
this.Children.Add(btn);
}