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

点击事件

边栏推荐
猜你喜欢

TRACE32 - SNOOPer-based variable logging

TRACE32 - C source code association

OpenCV测量物体的尺寸技能 get~

Sentinel热点参数限流

【CUDA学习笔记】初识CUDA

思路迪医药冲刺港股:5个月亏2.9亿 泰格医药与先声药业是股东

UnityShader入门学习(一)——GPU与Shader

Female service community product design

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

AVH Deployment Practice (1) | Deploying the Flying Paddle Model on Arm Virtual Hardware
随机推荐
看交互设计如何集成到Scrum敏捷流程中
自动化测试如何创造业务价值?
R语言计算时间序列数据的移动平均值(滚动平均值、例如5日均线、10日均线等):使用zoo包中的rollmean函数计算k个周期移动平均值
charles进行弱网测试(app弱网测试怎么做)
Web自动化实战——Selenium4(自动化测试环境的搭建)
TRACE32——基于SNOOPer的变量记录
Advanced Mathematics - Commonly Used Indefinite Integral Formulas
OpenShift 4 - 定制 RHACS 安全策略,阻断生产集群使用高风险 Registry
Description of Hikvision camera streaming RTSP address rules
工程水文学名词解释总结
2021 OWASP TOP 10 Vulnerability Guide
R语言向前或者向后移动时间序列数据(自定义滞后或者超前的期数):使用dplyr包中的lag函数将时间序列数据向前移动一天(设置参数n为正值)
thread_local 变量的析构顺序
乡村基冲刺港交所:5个月期内亏2224万 SIG与红杉中国是股东
R语言检验样本是否符合正态性(检验样本是否来自一个正态分布总体):shapiro.test函数检验样本是否符合正态分布(normality test)
Efficient use of RecyclerView Section 3
Groupid(artifact id)
【MySQL】Mysql范式及外键作用
leetcode303场周赛复盘
mongo进入报错