本文整理汇总了C#中System.Windows.Controls.UserControl.setLocation方法的典型用法代码示例。如果您正苦于以下问题:C# UserControl.setLocation方法的具体用法?C# UserControl.setLocation怎么用?C# UserControl.setLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.UserControl
的用法示例。
在下文中一共展示了UserControl.setLocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadControl
//.........这里部分代码省略.........
{
NavigationImage navImageControl = new NavigationImage(obj.Property("Screen").Value, obj);
navImageControl.MouseLeftButtonUp += new MouseButtonEventHandler(Navigaton_Image_MouseLeftButtonUp);
navImageControl.MouseRightButtonDown += new MouseButtonEventHandler(Navigaton_Image_MouseRightButtonDown);
canGUI.Children.Add(navImageControl);
double dX = Convert.ToDouble(obj.Property("X").Value);
double dY = Convert.ToDouble(obj.Property("Y").Value);
int dZ = Convert.ToInt32(obj.Property("ZOrder").Value);
Canvas.SetLeft(navImageControl, dX * gWidthRatio);
Canvas.SetTop(navImageControl, dY * gHeightRatio);
Canvas.SetZIndex(navImageControl, dZ);
navImageControl.Location.X = dX;
navImageControl.Location.Y = dY;
navImageControl.Width = navImageControl.ImageWidth * gWidthRatio;
navImageControl.Height = navImageControl.ImageHeight * gHeightRatio;
navImages.Add(navImageControl);
controlTypes.Add(typeof(NavigationImage));
navImageControl.PreviewMouseMove += new MouseEventHandler(DragSource_PreviewMouseMove);
}
catch (MySqlException myerror)
{ MessageBox.Show("GUI Error Load Navigation Image: " + myerror.Message); }
}
else if (obj.Type == "CONTROL CAMERA VIEWER")
{
try
{
string stream = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Stream Address").Value;
VideoStreamViewer vsv = new VideoStreamViewer(stream, obj, gAppName);
vsv.MouseRightButtonDown += new MouseButtonEventHandler(VideoStreamViewer_MouseRightButtonDown);
canGUI.Children.Add(vsv);
double dX = Convert.ToDouble(obj.Property("X").Value);
double dY = Convert.ToDouble(obj.Property("Y").Value);
int dZ = Convert.ToInt32(obj.Property("ZOrder").Value);
Canvas.SetLeft(vsv, dX * gWidthRatio);
Canvas.SetTop(vsv, dY * gHeightRatio);
Canvas.SetZIndex(vsv, dZ);
vsv.Location.X = dX;
vsv.Location.Y = dY;
cameraViewers.Add(vsv);
controlTypes.Add(typeof(VideoStreamViewer));
vsv.PreviewMouseMove += new MouseEventHandler(DragSource_PreviewMouseMove);
}
catch (MySqlException myerror)
{ MessageBox.Show("GUI Error Load Camera Viewer: " + myerror.Message); }
}
else if (obj.BaseType == "USER CONTROL")
{
string sUCType = obj.Property("Control Type").Value;
sUCType = sUCType.Replace("USER CONTROL ", "");
OSAE.Types.AvailablePlugin selectedPlugin = GlobalUserControls.OSAEUserControls.AvailablePlugins.Find(sUCType);
selectedPlugin.Instance.InitializeMainCtrl(obj, gAppName, gCurrentUser);
dynamic uc = new UserControl();
uc = selectedPlugin.Instance.mainCtrl;
uc.MouseRightButtonDown += new MouseButtonEventHandler(UserControl_MouseRightButtonDown);
uc.PreviewMouseMove += new MouseEventHandler(DragSource_PreviewMouseMove);
double dX = Convert.ToDouble(obj.Property("X").Value);
double dY = Convert.ToDouble(obj.Property("Y").Value);
int dZ = Convert.ToInt32(obj.Property("ZOrder").Value);
Canvas.SetLeft(uc, dX * gWidthRatio);
Canvas.SetTop(uc, dY * gHeightRatio);
Canvas.SetZIndex(uc, dZ);
uc.setLocation(dX, dY);
uc.Width = uc.ControlWidth * gWidthRatio;
uc.Height = uc.ControlHeight * gHeightRatio;
canGUI.Children.Add(uc);
userControls.Add(uc);
controlTypes.Add(uc.GetType());
}
else if (obj.Type == "CONTROL BROWSER")
{
if (gDebug) Log.Debug("Loading BrowserControl: " + obj.Name);
try
{
OSAE.UI.Controls.BrowserFrame bf = new OSAE.UI.Controls.BrowserFrame(obj);
bf.MouseRightButtonDown += new MouseButtonEventHandler(Broswer_Control_MouseRightButtonDown);
//OSAE.UI.Controls.StaticLabel sl = new OSAE.UI.Controls.StaticLabel(obj);
canGUI.Children.Add(bf);
int dZ = Int32.Parse(obj.Property("ZOrder").Value);
bf.Location.X = Double.Parse(obj.Property("X").Value);
bf.Location.Y = Double.Parse(obj.Property("Y").Value);
bf.Width = Double.Parse(obj.Property("Width").Value) * gWidthRatio;
bf.Height = Double.Parse(obj.Property("Height").Value) * gHeightRatio;
bf.ControlWidth = bf.Width;
bf.ControlHeight = bf.Height;
Canvas.SetLeft(bf, bf.Location.X * gWidthRatio);
Canvas.SetTop(bf, bf.Location.Y * gHeightRatio);
Canvas.SetZIndex(bf, dZ);
browserFrames.Add(bf);
controlTypes.Add(typeof(OSAE.UI.Controls.BrowserFrame));
//
bf.PreviewMouseMove += new MouseEventHandler(DragSource_PreviewMouseMove);
}
catch (Exception ex)
{
Log.Error("Error updating BrowserControl", ex);
return;
}
}
}));
}