示例#1
0
        /// <summary>
        /// 第二次进来,会移除以前的
        /// </summary>
        /// <param name="mapGrid"></param>
        public static void AddParentGrid(Grid mapGrid)
        {
            if (mapGrid.Children.Count > 0)
            {
                mapGrid.Children.RemoveRange(0, mapGrid.Children.Count);
            }
            WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
            MapForm          mapForm          = MapForm.GetInstance();

            mapForm.Width           = (int)mapGrid.ActualWidth;
            mapForm.Height          = (int)mapGrid.ActualHeight;
            windowsFormsHost.Width  = mapGrid.Width;
            windowsFormsHost.Height = mapGrid.Height;
            mapForm.TopLevel        = false;
            windowsFormsHost.Child  = mapForm;
            mapGrid.Children.Add(windowsFormsHost);
        }
示例#2
0
 private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     MapForm.AddParentGrid(mapGrid);
 }
示例#3
0
 private MapFormCustom()
 {
     InitializeComponent();
     MapForm.AddParentGrid(mapGrid);
 }