刚接触WPF 我在用WPF做一个聊天程序 想实现类似QQ的效果
登陆后 移除用户和密码的输入框 在原窗口上添加一个新的<Grid Name="abc"><ListBox></ListBox></Grid> 各位高手帮帮忙 先谢谢了
登陆后 移除用户和密码的输入框 在原窗口上添加一个新的<Grid Name="abc"><ListBox></ListBox></Grid> 各位高手帮帮忙 先谢谢了
解决方案 »
- 求几个正则表达式
- 小学题,不得其解,求助!!!
- .........关于byte[]与string转换计算问题........
- c#.net 中如何设置table?使其全充满整个窗体!
- 熟悉Microsoft Office Picture Manager开发的朋友进来!
- 有关winform打印的问题
- C#的字符串如何输出\"。例如:有一个字符串(i am a \" student)如何在C#中输出?
- GDI+作图时出现如下错误,不知何故???
- www3.ccw.com.cn隆重推出.net论坛
- 怎么关闭登录界面
- 求一条以日期和user为条件分组的SQL语句
- 模拟浏览器GET提交如何获取Cookie id
<TextBox Height="23" HorizontalAlignment="Left" Margin="124,110,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" />
<PasswordBox Height="23" HorizontalAlignment="Left" Margin="126,160,0,0" Name="passwordBox1" VerticalAlignment="Top" Width="120" />
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="360,127,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
</Grid> private void button1_Click(object sender, RoutedEventArgs e)
{
g1.Children.Clear();
Grid _grid = new Grid(){ Name="abc"};
ListBox _listbox=new ListBox();
_grid.Children.Add(_listbox);
g1.Children.Add(_grid);
}
<Grid>
<ListBox Grid.Column="1" ScrollViewer.VerticalScrollBarVisibility="Auto" MouseLeftButtonDown="ListBox_MouseLeftButtonDown">
<StackPanel Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<Image Source="Img\Mask 03_32x32.png" />
<TextBlock VerticalAlignment="Center">Marcus</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<Image Source="Img\Mask 02_32x32.png" />
<TextBlock VerticalAlignment="Center">Fergus</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<Image Source="Img\Mask 04_32x32.png" />
<TextBlock VerticalAlignment="Center">Jay</TextBlock>
</StackPanel>
<DockPanel MouseLeftButtonDown="DockPanel_MouseLeftButtonDown">
<Image Source="Img\Mask 03_32x32.png" />
<TextBlock VerticalAlignment="Center">Marcus</TextBlock>
</DockPanel>
</ListBox>
</Grid>
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/up-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<ListBox Grid.Column="1" ScrollViewer.VerticalScrollBarVisibility="Auto" MouseLeftButtonDown="ListBox_MouseLeftButtonDown"> <StackPanel Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<Image Source="Img\Mask 03_32x32.png" />
<TextBlock VerticalAlignment="Center">Marcus</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<Image Source="Img\Mask 02_32x32.png" />
<TextBlock VerticalAlignment="Center">Fergus</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<Image Source="Img\Mask 04_32x32.png" />
<TextBlock VerticalAlignment="Center">Jay</TextBlock>
</StackPanel>
<DockPanel MouseLeftButtonDown="DockPanel_MouseLeftButtonDown">
<Image Source="Img\Mask 03_32x32.png" />
<TextBlock VerticalAlignment="Center">Marcus</TextBlock>
</DockPanel> </ListBox>
</Grid></UserControl>
private void button1_Click(object sender, RoutedEventArgs e)
{
g1.Children.Clear();
g1.Children.Add(new UserControl1());
}
<Grid xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
<ListBox Grid.Column='1' ScrollViewer.VerticalScrollBarVisibility='Auto'>
<StackPanel Orientation='Horizontal' >
<Image Source='Img\Mask 03_32x32.png' />
<TextBlock VerticalAlignment='Center'>Marcus</TextBlock>
</StackPanel>
<StackPanel Orientation='Horizontal' >
<Image Source='Img\Mask 02_32x32.png' />
<TextBlock VerticalAlignment='Center'>Fergus</TextBlock>
</StackPanel>
<StackPanel Orientation='Horizontal' >
<Image Source='Img\Mask 04_32x32.png' />
<TextBlock VerticalAlignment='Center'>Jay</TextBlock>
</StackPanel>
<DockPanel >
<Image Source='Img\Mask 03_32x32.png' />
<TextBlock VerticalAlignment='Center'>Marcus</TextBlock>
</DockPanel>
</ListBox>
</Grid>";
System.IO.MemoryStream _dd = new System.IO.MemoryStream(System.Text.Encoding.Default.GetBytes(dd));
Grid _Grid = (Grid)XamlReader.Load(_dd);
g1.Children.Clear();
g1.Children.Add(_Grid);
借此帖想再问个问题 关于<image>数据绑定 public string FacePath
{
get { return String.Format(@"face\{0}.bmp", faceId); }
set { facePath = value; }
} private int faceId; public int FaceId
{
get { return faceId; }
set { faceId = value; }
}得到的FacePath是face\\66.bmp
怎么是双斜杠????