会员
周边
新闻
博问
闪存
赞助商
YouClaw
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
奇迹之耀
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
9
10
11
12
13
14
15
16
17
下一页
2021年10月13日
WPF,计算绘制一段文字需要多少宽度
摘要: private double GetTextWidth(string text) { var textBlock = new System.Windows.Controls.TextBlock { Text = text, TextWrapping = TextWrapping.NoWrap, Fo
阅读全文
posted @ 2021-10-13 09:56 奇迹之耀
阅读(183)
评论(0)
推荐(0)
2021年9月17日
WPF全局禁用tab键选中控件
摘要: 在主窗体添加键盘点击事件 private void Window_PreviewKeyDown(object sender, KeyEventArgs e) { Key key = (e.Key == Key.System ? e.SystemKey : e.Key); if (key == Key
阅读全文
posted @ 2021-09-17 14:26 奇迹之耀
阅读(231)
评论(0)
推荐(0)
2021年9月14日
C# 以颜色的代码的形式实例化SolidColorBrush
摘要: SolidColorBrush solidColorBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#2D5073"));
阅读全文
posted @ 2021-09-14 08:45 奇迹之耀
阅读(267)
评论(0)
推荐(0)
2021年9月2日
WPF 修改ListBoxItem失去焦点后的样式
摘要: 修改以下这部分改变可以改变边框和背景色 以下是样式模板代码 <Style x:Key="FocusVisual"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <Rectangle Margin="0"
阅读全文
posted @ 2021-09-02 19:09 奇迹之耀
阅读(291)
评论(0)
推荐(0)
2021年9月1日
WPF border圆角CornerRadius的绑定
摘要: 错误写法: public Thickness Radius { get { return (Thickness)GetValue(RadiusProperty); } set { SetValue(RadiusProperty, value); } } public static readonly
阅读全文
posted @ 2021-09-01 08:47 奇迹之耀
阅读(388)
评论(0)
推荐(0)
2021年8月27日
使用vue进行表单数据验证
摘要: 使用vue完成手机号码的验证,效果如下 html代码 <div id="app"> <h2 style="margin-top: 80px;">手机号验证</h2> <input v-model="input" type="text"/> <!-- 当正则验证不通过时就显示span标签 --> <s
阅读全文
posted @ 2021-08-27 22:58 奇迹之耀
阅读(449)
评论(0)
推荐(0)
WPF TextBox双向绑定
摘要: 想实现当前台文本框的值改变时,后台的值也同时改变,然后我设置的Mode=TwoWay,但是不起作用 最后发现需要设置UpdateSourceTrigger=PropertyChanged 更新:不设置UpdateSourceTrigger=PropertyChanged也可以,但是只有当文本框失去焦
阅读全文
posted @ 2021-08-27 09:41 奇迹之耀
阅读(1480)
评论(1)
推荐(1)
2021年8月25日
C# bitmap转换bitmapSource引发的内存泄漏
摘要: 原代码: private BitmapSource BitmapToBitmapSource(System.Drawing.Bitmap src) { IntPtr ip = src.GetHbitmap();//从GDI+ Bitmap创建GDI位图对象 BitmapSource bitmapSo
阅读全文
posted @ 2021-08-25 14:16 奇迹之耀
阅读(682)
评论(0)
推荐(0)
WPF 解决Image控件读取高分辨率图片并缩放占用内存过大
摘要: 需求:读取高分辨率图片显示到宽度为200的Image控件上 核心代码: private BitmapImage ReadImageFiletToBinary(string fileName) { using (var stream = new FileStream(fileName, FileMod
阅读全文
posted @ 2021-08-25 10:31 奇迹之耀
阅读(1007)
评论(0)
推荐(0)
2021年8月24日
C#记一次由于Remove会释放对象引发的bug
摘要: 使用伪代码进行测试,期望test2中的值不被清空,结果输出值为0,对象被释放了 测试后发现,Remove和Clear的效果一样,都会将对象释放,输出了期望之外的结果 换一种写法,这次在清空了test1的基础上,test2中的对象并没有被释放,输出值为1 结论:使用Clear或者Remove时,释放了
阅读全文
posted @ 2021-08-24 16:32 奇迹之耀
阅读(119)
评论(0)
推荐(0)
上一页
1
···
9
10
11
12
13
14
15
16
17
下一页
公告