WPF ”真正的“高仿QQ

时常可以在各种论坛 博客 看到 各种所谓的 高仿QQ。

说实话 越看越想笑呢。(PS:纯粹的 抨击 那些 不追求 UI 完美主义者)

例如:

     

本次模仿 采用 C# WPF XAML , 总共耗时 1 小时

 

 关键代码:

<Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="182"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Border>
            <Grid>
                <Border>
                    <Image gif:ImageBehavior.AnimatedSource="Images/back.gif" Stretch="Fill"  />
                </Border>
                <Image Source="Images/logo-banner.png" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,15,0,0"></Image>
                <Border Background="#00FFFFFF"></Border>
                <TextBlock Margin="0,9,70,0"  FontFamily="{StaticResource IconFont}" 
                Text="" VerticalAlignment="Top" HorizontalAlignment="Right"  FontSize="12"/>
            </Grid>
        </Border>
        <Border Grid.Row="1"  Background="#FFEBF2F9" CornerRadius="0,0,3,3">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="130"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition Width="100"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid>
                    <Ellipse Width="80" Height="80" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="42,12,0,0">
                        <Ellipse.Fill>
                            <ImageBrush ImageSource="jacket.jpg"/>
                        </Ellipse.Fill>
                    </Ellipse>
                    <Button FontFamily="{StaticResource IconFont}" Margin="5,0,0,5" Content="" FontSize="25" HorizontalAlignment="Left" VerticalAlignment="Bottom" Style="{DynamicResource ButtonStyle1}"></Button>
                </Grid>
                <Grid Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition Height="20"></RowDefinition>
                        <RowDefinition Height="55"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Border Background="White" Grid.Row="0" Width="195" Height="60" BorderThickness="1" BorderBrush="#FFD1D1D1" CornerRadius="3" VerticalAlignment="Bottom">
                        <Grid>
                            <Border VerticalAlignment="Center" Background="#FFD1D1D1" Height="1"></Border>
                            <TextBox Text="944095635" BorderThickness="0"  Margin="6,5,16,0" VerticalAlignment="Top" Height="20" VerticalContentAlignment="Center" ></TextBox>
                            <TextBlock Margin="0,9,7,0"  FontFamily="{StaticResource IconFont}" Text="" VerticalAlignment="Top" HorizontalAlignment="Right" Foreground="#FFB4B4B4" FontSize="12"/>
                            <PasswordBox Password="********" BorderThickness="0"  Margin="6,0,6,5" VerticalAlignment="Bottom" Height="20" VerticalContentAlignment="Center" ></PasswordBox>
                            <TextBlock Margin="0,0,5,6"  FontFamily="{StaticResource IconFont}" Text="" VerticalAlignment="Bottom" HorizontalAlignment="Right" Foreground="#FFB4B4B4" FontSize="16"/>
                        </Grid>
                    </Border>
                    <Grid Grid.Row="1" VerticalAlignment="Center" Margin="2,3,2,0">
                        <CheckBox Style="{StaticResource QQCheckBox}" Content="记住密码" HorizontalAlignment="Left" IsChecked="True"></CheckBox>
                        <CheckBox Style="{StaticResource QQCheckBox}" Content="自动登录" HorizontalAlignment="Right"></CheckBox>
                    </Grid>
                    <Button Grid.Row="2" Content="登  录" Width="195" Height="32" Style="{DynamicResource ButtonStyle3}" Background="#FF00B2DE" ></Button>
                </Grid>
                <Grid Grid.Column="2">
                    <StackPanel Margin="0,9,35,0">
                        <Button  Margin="8" Content="注册账号"  HorizontalAlignment="Left" VerticalAlignment="Bottom" Style="{DynamicResource ButtonStyle2}"></Button>
                        <Button  Margin="8" Content="找回密码"  HorizontalAlignment="Left" VerticalAlignment="Bottom" Style="{DynamicResource ButtonStyle2}"></Button>
                    </StackPanel>
                    <Button  Margin="0,0,5,5"  Style="{StaticResource CodeButton}" HorizontalAlignment="Right" VerticalAlignment="Bottom" ></Button>
                </Grid>
            </Grid>
        </Border>
    </Grid>

  

 

 软件效果:

 

源码下载

 

开源地址:https://github.com/944095635/WPF.QQSignIN

转载于:https://www.cnblogs.com/DMSkin/p/8398637.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
WPF仿QQ贴边自动隐藏功能主要是通过设置窗口的动画效果来实现的。首先,需要监听窗口的位置变化事件,当窗口靠近屏幕边缘时,触发隐藏动画效果。其次,可以使用WPF自带的动画库,如DoubleAnimation、Storyboard等,来定义窗口隐藏时的动画效果。在动画完成后,将窗口的Visibility属性设置为Collapsed来实现窗口的隐藏。 下面是实现这一功能的一段简单源码示例: ```csharp private void Window_LocationChanged(object sender, EventArgs e) { double screenWidth = SystemParameters.PrimaryScreenWidth; double screenHeight = SystemParameters.PrimaryScreenHeight; double pixelsFromTop = this.Top; double pixelsFromBottom = screenHeight - this.Top - this.ActualHeight; double pixelsFromLeft = this.Left; double pixelsFromRight = screenWidth - this.Left - this.ActualWidth; double boundary = 10; // 靠边触发隐藏的距离阈值 if (pixelsFromTop < boundary || pixelsFromBottom < boundary || pixelsFromLeft < boundary || pixelsFromRight < boundary) { // 如果靠近边缘,执行隐藏动画 DoubleAnimation animation = new DoubleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(0.5))); this.BeginAnimation(UIElement.OpacityProperty, animation); } else { // 如果不靠近边缘,取消隐藏动画 DoubleAnimation animation = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(0.5))); this.BeginAnimation(UIElement.OpacityProperty, animation); } } ``` 这段代码中,通过监听窗口的LocationChanged事件,计算窗口与屏幕边缘的距离,并根据一定的阈值来触发隐藏动画效果。当窗口靠近边缘时,执行隐藏动画,动画完成后将窗口的Opacity属性设置为0,实现窗口的隐藏。当窗口远离边缘时,取消隐藏动画,并将窗口的Opacity属性设置为1,使窗口重新显示出来。通过这种方式,就可以实现仿QQ贴边自动隐藏的效果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值