由于现如今H5的热门,做过不少与H5的交互工作了,现在总结一下。
初始化WebView
/**
* 初始化WebView
*/
private void initWebView() { // 设置setWebChromeClient对象
2025年06月08日
由于现如今H5的热门,做过不少与H5的交互工作了,现在总结一下。
初始化WebView
/**
* 初始化WebView
*/
private void initWebView() { // 设置setWebChromeClient对象
2025年06月07日
界面:
源代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
inirq();
}
private string str_rq;
private void inirq()
{
comboBox1.Items.Add("2001/1/1");
comboBox1.Items.Add("2001年1月");
comboBox1.Items.Add("2001年1月1日");
comboBox1.Items.Add("2001年1月1日 00:00");
comboBox1.Items.Add("2001年1月1日 00:00:00");
comboBox1.Items.Add("自定义格式");
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if(comboBox1.SelectedIndex==0)
{
str_rq = "d";
}
else if (comboBox1.SelectedIndex == 1)
{
str_rq = "y";
}
else if (comboBox1.SelectedIndex == 2)
{
str_rq = "D";
}
else if (comboBox1.SelectedIndex == 3)
{
str_rq = "f";
}
else if (comboBox1.SelectedIndex == 4)
{
str_rq = "F";
}
else if (comboBox1.SelectedIndex == 5)
{
str_rq = "yyyy年MM月dd日 HH时mm分ss秒";
}
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = DateTime.Now.ToString(str_rq);
}
private void button2_Click(object sender, EventArgs e)
{
texToday.Text = DateTime.Now.ToString("D");
texYesterday.Text = DateTime.Now.AddDays(-1).ToString("D");
texTomorrow.Text = DateTime.Now.AddDays(1).ToString("D");
}
}
}
2025年06月07日
ObservableProperty是CommunityToolkit.Mvvm提供的一个强大属性生成器,它能够:
2025年06月07日
本章介绍如何与本机(非托管)动态链接库 (DLL) 和组件对象模型 (COM) 组件集成。除非另有说明,否则本章中提到的类型存在于 System 或 System.Runtime.InteropServices 命名空间中。
2025年06月07日
前面,我们学习了模型绑定,这一节,我们继续跟着官网来学习一下模型验证,一般情况下,我们需要对传入的参数进行校验,常规操作一般是通过if来对每一个需要校验的参数进行判断,在使用模型之后,我们便可以借助
2025年06月07日
概述
本文采用winform制作上位机画面,通过西门子S7通信(S7.net)访问西门子PLC S7-200SMART的IO信号,实现简单的读写操作。
1 配置
1.1硬件要求
PC 操作电脑
CPU ST30 (6ES7288-1ST30-0AA1)
1.2软件要求
2025年06月07日
在 C# 开发中,INotifyPropertyChanged 接口在实现 MVVM(Model-View-ViewModel)模式时至关重要。它允许视图(UI)在后台数据发生变化时自动更新,从而实现数据绑定和界面同步。本文将详细介绍如何实现 INotifyPropertyChanged 接口,并利用 CommunityToolkit.Mvvm 库简化开发过程。