WPF的MID父窗体与子窗体 有没有简单一点的方法实现WPF的MID父窗体与子窗体。有代码可实现就立即给分了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CSDN的牛人呢,都跑哪去了啊。郁闷,是不是我的贴发的有问题啊。。 参考http://blog.csdn.net/qghboy/archive/2009/09/16/4560424.aspx 我也是过这个方法,虽然和C#的MDI不太一样,但是也可以让一个window在另外一个里面的 Window1.xaml<Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Grid> <Button Margin="78,97,105,123" Click="Button_Click">Test</Button> </Grid></Window>window1.xaml.csusing System;using System.Windows;using System.Windows.Controls;using System.Windows.Interop;namespace WpfApplication1{ /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { public Window1() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { Window2 w2 = new Window2(); w2.Show(); WindowInteropHelper parentHelper = new WindowInteropHelper(this); WindowInteropHelper childHelper = new WindowInteropHelper(w2); Win32Native.SetParent(childHelper.Handle, parentHelper.Handle); } } public class Win32Native { [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SetParent")] public extern static IntPtr SetParent(IntPtr childPtr, IntPtr parentPtr); } }window2就是默认的我就不写出来了。你再试试 可以了,谢谢 LorenLiu,谢谢各位了。 C# 多线程循环执行 计数器 如何重绘winform的窗体边框? 请问如何给枚举类型每个元素写注释? datatable合并行 在sql+C#+winform中,点击gridview里面的行,然后把行里面的值分别显示在旁边的文本框里 如何获得自己定制的ListView中的ListViewItem的一个事例的物理路径全称 .net编程 Server 反馈给PLC的数据 PLC 丢包 运行ASP.NET2.0的页面时出现的错误 winform如何实现拉伸窗口边缘窗口按照初始长宽比缩放大小 大伙来帮个忙阿。asp.net页面的问题(求急) 数字判断 C#关于窗体传值问题 求教
郁闷,是不是我的贴发的有问题啊。。
我也是过这个方法,虽然和C#的MDI不太一样,但是也可以让一个window在另外一个里面的
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<Button Margin="78,97,105,123" Click="Button_Click">Test</Button>
</Grid>
</Window>
window1.xaml.csusing System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Interop;namespace WpfApplication1
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
} private void Button_Click(object sender, RoutedEventArgs e)
{
Window2 w2 = new Window2();
w2.Show(); WindowInteropHelper parentHelper = new WindowInteropHelper(this);
WindowInteropHelper childHelper = new WindowInteropHelper(w2); Win32Native.SetParent(childHelper.Handle, parentHelper.Handle);
}
} public class Win32Native
{
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SetParent")]
public extern static IntPtr SetParent(IntPtr childPtr, IntPtr parentPtr);
}
}window2就是默认的我就不写出来了。你再试试