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

点击事件

边栏推荐
猜你喜欢
随机推荐
R language ggplot2 visualization: use the ggmapplot function of the ggpubr package to visualize the MA plot (MA-plot), the font.legend parameter and the font.main parameter to set the title and legend
Getting started with UnityShader (1) - GPU and Shader
DBeaver连接MySQL 8.x时Public Key Retrieval is not allowed 错误解决
Nuget打包并上传教程
Word table to Excel
NPM Taobao mirror (latest version) released a new version of npm mirror at 2021-11-21 16:53:52 [easy to understand]
【CUDA学习笔记】初识CUDA
Node实现数据加密
TRACE32 - C source code association
R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化分组箱图、使用ggpar函数改变图形化参数(legend、修改可视化图像的图例在整图中的位置)
R语言ggstatsplot包ggbarstats函数可视化条形图、并添加假设检验结果(包含样本数、统计量、效应大小及其置信区间、显著性、组间两两比较、贝叶斯假设)、检验结果报告符合APA标准
Network cable RJ45 interface pins [easy to understand]
OpenShift 4 - Customize RHACS security policies to prevent production clusters from using high-risk registry
QGIS 加载WMS数据,重新投影
自动化测试如何创造业务价值?
Jmeter常用的十大组件
R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化分组箱图、使用ggpar函数改变图形化参数(caption、添加、修改可视化图像的题注、脚注内容)
消息队列消息数据存储MySQL表设计
sentinel与nacos持久化
TCP详解









