• WPF—QQ界面(四):单击QQ昵称弹出个人简介窗口的效果实现


    效果分析:当鼠标左键单击QQ的昵称时,会弹出另一个关于个人信息的窗口。

    此处用到的是Popup。

    设置鼠标触发Popup事件,该事件触发会跳转到另一个自定义窗口。

    前台代码:

    <Button Content="邓不利东" FontSize="24" FontStyle="Normal" Foreground="Black" Background="Transparent" BorderBrush="Transparent"
                        Cursor="Hand" Click="Popup_CP_Click"/>

    后台Popup_CP_Click的事件触发:

    private void Popup_CP_Click(object sender, RoutedEventArgs e)   
            {
                MyProfile myprofile = new MyProfile();
                myprofile.ShowDialog();
            }

    触发事件中MyProfile myprofile = new MyProfile(); 是新建一个MyProfile的窗口,因此,我们新建窗口的时候,将 Title 设为 MyProfile 即可。

    如下:

    <Window x:Class="QQ_presentation.MyProfile"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MyProfile" Height="700" Width="560"
            ResizeMode="NoResize">

    此时就能将主窗口与自定义窗口建立连接了,用Popup弹出自定义窗口。

    最终效果图如下:

    右图即为Popup出的新窗口。

  • 相关阅读:
    nginx基本命令
    一堆LCT板子
    17?17!
    ……妈妈我会写维修数列了!
    bzoj3744 Gty的妹子序列
    Noip2016 总结&反思
    bzoj4025 二分图
    [SHOI2008]堵塞的交通traffic
    bzoj4237 稻草人
    BestCoder Round #90
  • 原文地址:https://www.cnblogs.com/danieldong/p/5342702.html
Copyright © 2020-2023  润新知