08 2021 档案
摘要:使用vue完成手机号码的验证,效果如下 html代码 <div id="app"> <h2 style="margin-top: 80px;">手机号验证</h2> <input v-model="input" type="text"/> <!-- 当正则验证不通过时就显示span标签 --> <s
阅读全文
摘要:想实现当前台文本框的值改变时,后台的值也同时改变,然后我设置的Mode=TwoWay,但是不起作用 最后发现需要设置UpdateSourceTrigger=PropertyChanged 更新:不设置UpdateSourceTrigger=PropertyChanged也可以,但是只有当文本框失去焦
阅读全文
摘要:原代码: private BitmapSource BitmapToBitmapSource(System.Drawing.Bitmap src) { IntPtr ip = src.GetHbitmap();//从GDI+ Bitmap创建GDI位图对象 BitmapSource bitmapSo
阅读全文
摘要:需求:读取高分辨率图片显示到宽度为200的Image控件上 核心代码: private BitmapImage ReadImageFiletToBinary(string fileName) { using (var stream = new FileStream(fileName, FileMod
阅读全文
摘要:使用伪代码进行测试,期望test2中的值不被清空,结果输出值为0,对象被释放了 测试后发现,Remove和Clear的效果一样,都会将对象释放,输出了期望之外的结果 换一种写法,这次在清空了test1的基础上,test2中的对象并没有被释放,输出值为1 结论:使用Clear或者Remove时,释放了
阅读全文
摘要:错误写法: MySqlConnection conn = new MySqlConnection(connString); string sql="select * from user where FullName like '%@fullname%' "; using (MySqlCommand
阅读全文
摘要:TextBlock默认文本是居上的,像是这样子 但是TextBlock空间没有VerticalContentAlignment属性,无法设置文本垂直居中, 所以改用Label控件,效果实现 <Label VerticalContentAlignment="Center" Padding="0" He
阅读全文