使用WPF制作一个类似QQ的界面
![](https://pic002.cnblogs.com/images/2011/153342/2011033116445794.png)
界面比较简陋,但是应该山寨了QQ界面的80%。如果有时间,我会继续完善这个demo。
1 <Window x:Class="Qlike.MainWindow"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Title="QLike 2010" Height="382" Width="248"
5 Background="DimGray" WindowStyle="None" MinHeight="382" MinWidth="248">
6 <Window.Resources>
7 <SolidColorBrush x:Key="ForeColor">YellowGreen</SolidColorBrush>
8 <SolidColorBrush x:Key="BackColor">DimGray</SolidColorBrush>
9 </Window.Resources>
10 <Grid>
11 <Grid.RowDefinitions>
12 <RowDefinition Height="*"/> <!--Title 0-->
13 <RowDefinition Height="2*" /> <!--Photo 1-->
14 <RowDefinition Height="*"/> <!--Search 2-->
15 <RowDefinition Height="8*"/> <!--Main 3-->
16 <RowDefinition Height="1.2*"/> <!--Wiget 4-->
17 </Grid.RowDefinitions>
18 <Canvas Grid.Row="0" Grid.ColumnSpan="2" Height="18">
19 <TextBlock Canvas.Left="0" Canvas.Top="0" Foreground="{StaticResource ForeColor}" FontWeight="ExtraBold">QLike 2010</TextBlock>
20 <StackPanel Canvas.Right="0" Canvas.Top="0" Orientation="Horizontal">
21 <Button> - </Button>
22 <Button Background="AliceBlue"> [] </Button>
23 <Button Click="Button_Click" Background="Red"> X </Button>
24 </StackPanel>
25 </Canvas>
26 <Grid Grid.Row="1">
27 <Grid.RowDefinitions>
28 <RowDefinition/>
29 <RowDefinition/>
30 </Grid.RowDefinitions>
31 <Grid.ColumnDefinitions>
32 <ColumnDefinition Width="Auto"/>
33 <ColumnDefinition/>
34 </Grid.ColumnDefinitions>
35 <Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Source="Img/usertile16.bmp"/>
36 <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
37 <Label VerticalAlignment="Center" Foreground="{StaticResource ForeColor}">Baesky</Label>
38 <ComboBox VerticalAlignment="Center" IsEditable="True" BorderBrush="{StaticResource BackColor}"
39 Foreground="{StaticResource ForeColor}" Background="{StaticResource BackColor}">
40 <ComboBoxItem>[我在线上]</ComboBoxItem>
41 <ComboBoxItem>[忙碌]</ComboBoxItem>
42 <ComboBoxItem>[离开]</ComboBoxItem>
43 </ComboBox>
44 </StackPanel>
45 <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">
46 <Button Background="Transparent">
47 <Image Source="Img\Facebook_creatures.ico" Height="20"/>
48 </Button>
49 <Button Background="Transparent">
50 <Image Source="Img\Feed_creatures.ico" Height="20"/>
51 </Button>
52 <Button Background="Transparent">
53 <Image Source="Img\Flickr_creatures.ico" Height="20"/>
54 </Button>
55 <Button Background="Transparent">
56 <Image Source="Img\Twitter_creatures.ico" Height="20"/>
57 </Button>
58 </StackPanel>
59 </Grid>
60 <TextBox Grid.Row="2" Grid.ColumnSpan="2" Foreground="Gray">搜索栏</TextBox>
61 <Grid Grid.Row="3">
62 <Grid.RowDefinitions>
63 <RowDefinition/>
64 </Grid.RowDefinitions>
65 <Grid.ColumnDefinitions>
66 <ColumnDefinition Width="Auto"/>
67 <ColumnDefinition/>
68 </Grid.ColumnDefinitions>
69 <StackPanel Grid.Column="0" Orientation="Vertical">
70 <Button Background="Transparent">
71 <Image Source="Img\Tree_01.ico" Height="20"/>
72 </Button>
73 <Button Background="Transparent">
74 <Image Source="Img\Tree_02.ico" Height="20"/>
75 </Button>
76 <Button Background="Transparent">
77 <Image Source="Img\Tree_03.ico" Height="20"/>
78 </Button>
79 <Button Background="Transparent">
80 <Image Source="Img\Tree_04.ico" Height="20"/>
81 </Button>
82 </StackPanel>
83 <ListBox Grid.Column="1" ScrollViewer.VerticalScrollBarVisibility="Visible">
84 <ListBoxItem>
85 <Expander Header="偶滴好友">
86 <StackPanel Orientation="Horizontal">
87 <Image Source="Img\Mask 01_32x32.png" />
88 <TextBlock VerticalAlignment="Center">Ferdinand</TextBlock>
89 </StackPanel>
90 </Expander>
91 </ListBoxItem>
92 <ListBoxItem>
93 <Expander Header="朋友们">
94 <StackPanel>
95 <StackPanel Orientation="Horizontal">
96 <Image Source="Img\Mask 03_32x32.png" />
97 <TextBlock VerticalAlignment="Center">Marcus</TextBlock>
98 </StackPanel>
99 <StackPanel Orientation="Horizontal">
100 <Image Source="Img\Mask 02_32x32.png" />
101 <TextBlock VerticalAlignment="Center">Fergus</TextBlock>
102 </StackPanel>
103 <StackPanel Orientation="Horizontal">
104 <Image Source="Img\Mask 04_32x32.png" />
105 <TextBlock VerticalAlignment="Center">Jay</TextBlock>
106 </StackPanel>
107 </StackPanel>
108 </Expander>
109 </ListBoxItem>
110 </ListBox>
111 </Grid>
112 <StatusBar Grid.Row="4" Background="Transparent" >
113 <Button Background="Transparent" Padding="0,0,0,0" Margin="0,0,0,0">
114 <Image Source="Img\InterneExplorer.png"/>
115 </Button>
116 <Button Background="Transparent" Padding="0,0,0,0" Margin="-6,0,0,0">
117 <Image Source="Img\Internet.png"/>
118 </Button>
119 <Button Background="Transparent" Padding="0,0,0,0" Margin="-6,0,0,0">
120 <Image Source="Img\Neighborhood.png"/>
121 </Button>
122 <Button Background="Transparent" Padding="0,0,0,0" Margin="-6,0,0,0" BorderBrush="{StaticResource BackColor}">
123 <Image Source="Img\Mac.png"/>
124 </Button>
125 </StatusBar>
126 </Grid>
127 </Window>
posted on 2011-03-31 16:48 Meta.Grfx 阅读(7553) 评论(15) 编辑 收藏 举报