当前位置:网站首页>button控件的使用
button控件的使用
2022-07-31 15:08:00 【济南医疗小程序状元】
button控件的使用
<Window x:Class="WpfApp1.control.Windowbutton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1.control"
mc:Ignorable="d"
Title="Windowbutton" Height="450" Width="800">
<Grid>
<Button Width="100" Height="30" HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="I is a 按钮" Margin="30,30,0,0"
Background="Teal"
BorderThickness="5,0,0,0" BorderBrush="Transparent"
Foreground="White"
Click="Button_Click" MouseMove="Button_MouseMove"
>
</Button>
</Grid>
</Window>
XAML.CS文件
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace WpfApp1.control
{
/// <summary>
/// Windowbutton.xaml 的交互逻辑
/// </summary>
public partial class Windowbutton : Window
{
public Windowbutton()
{
InitializeComponent();
}
/// <summary>
/// 按钮的点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("按钮被点击了,点击事件");
}
private void Button_MouseMove(object sender, MouseEventArgs e)
{
//MessageBox.Show("鼠标移动到按钮上面,点击事件");
}
}
}
效果
点击事件
边栏推荐
- LeetCode二叉树系列——226.翻转二叉树
- UnityShader入门学习(一)——GPU与Shader
- Spark学习(3)-Spark环境搭建-Standalone
- Female service community product design
- 大健云仓冲刺美股:增营收反减利润 京东与DCM是股东
- R语言的画图代码及差异性分析[通俗易懂]
- 2021 OWASP TOP 10 Vulnerability Guide
- AVH Deployment Practice (1) | Deploying the Flying Paddle Model on Arm Virtual Hardware
- SIGABRT 报错时的注意事项和解决方法
- 英文语法-时与态
猜你喜欢
随机推荐
AVH Deployment Practice (1) | Deploying the Flying Paddle Model on Arm Virtual Hardware
How to grab configuration information for DELL SC compellent storage system
Architecture actual combat battalion module 8 message queue table structure design
Unity Shader入门精要学习——透明效果
网线RJ45接口针脚[通俗易懂]
格林美瑞交所IPO:募资3.8亿美元 更多中国企业将赴欧洲上市
SIGABRT 报错时的注意事项和解决方法
Groupid(artifact id)
分成两栏后文字顺序混乱的问题解决【写期刊论文时】
实现防抖与节流函数
Synchronized and volatile interview brief summary
R语言计算时间序列数据的移动平均值(滚动平均值、例如5日均线、10日均线等):使用zoo包中的rollmean函数计算k个周期移动平均值
Introduction to BigDecimal, common methods
Trigonometric identity transformation formula
Ubantu专题5:设置静态ip地址
leetcode303场周赛复盘
How useful is four-quadrant time management?
7、常见面试口语提问问题汇总
如何进行需求分析评审
梅克尔工作室-第一次