当前位置:网站首页>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("鼠标移动到按钮上面,点击事件");
}
}
}
效果

点击事件

边栏推荐
- abaqus find contact pairs报错:surface name is already in use
- OpenCV测量物体的尺寸技能 get~
- Matlab矩阵基本操作(定义,运算)
- Nuget package and upload tutorial
- UnityShader入门学习(一)——GPU与Shader
- 基于最小二乘法和SVM从天气预报中预测太阳能发电量(Matlab代码实现)
- AVH部署实践 (一) | 在Arm虚拟硬件上部署飞桨模型
- NC | 斯坦福申小涛等开发数据可重复分析计算框架TidyMass
- 名创优品斥资6.95亿购买创始人叶国富所持办公楼股权
- 2021 OWASP TOP 10 漏洞指南
猜你喜欢

Efficient use of RecyclerView Section 1

Word表格转到Excel中

【CUDA学习笔记】初识CUDA

mongo进入报错

大健云仓冲刺美股:增营收反减利润 京东与DCM是股东

Public Key Retrieval is not allowed error solution when DBeaver connects to MySQL 8.x

AVH Deployment Practice (1) | Deploying the Flying Paddle Model on Arm Virtual Hardware

Introductory UnityShader learning (2) - the rendering pipeline

Description of Hikvision camera streaming RTSP address rules

abaqus find contact pairs报错:surface name is already in use
随机推荐
R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化箱图、使用font函数自定义图例标题文本(legend.title)字体的大小、颜色、样式(粗体、斜体)
NPM淘宝镜像(最新版本)于2021-11-21 16:53:52发布新版本npm镜像[通俗易懂]
Destruction order of thread_local variables
Getting started with UnityShader (1) - GPU and Shader
力扣:714. 买卖股票的最佳时机含手续费
Spark学习(3)-Spark环境搭建-Standalone
Architecture actual combat battalion module 8 message queue table structure design
435. 无重叠区间
模板与泛型编程值typelist实现
OpenShift 4 - Deploy Redis Cluster with Operator
Small test knife: Go reflection helped me convert Excel to Struct
R语言检验样本是否符合正态性(检验样本是否来自一个正态分布总体):shapiro.test函数检验样本是否符合正态分布(normality test)
R language ggplot2 visualization: use the ggboxplot function of the ggpubr package to visualize the grouped box plot, use the ggpar function to change the graphical parameters (caption, add, modify th
/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件的作用
TRACE32——常用操作
看交互设计如何集成到Scrum敏捷流程中
TRACE32 - SNOOPer-based variable logging
名创优品斥资6.95亿购买创始人叶国富所持办公楼股权
RecyclerView高效使用第三节
工程水文学名词解释总结