jues
2020-08-21 10:53:22
VS
1474
需要实现C#点击Button全选并复制TextBox内容,想想就很简单,但实现起来却发现,并没有全选效果:实现代码:private void button1_copy_Click(object sender, EventArgs e)
{
if ( 0 >= this.textBox1.Text.Length)
jues
2020-08-21 10:46:40
VS
207
C#在Winfrom中使用TextBox时,如果在窗口显示前初始化Text的值后,当窗口出现时会默认全选状态:private void XXX_Load(object sender, EventArgs e)
{
this.textBox1.Text = "我不是有意要全选的";
}解决方法:private void XXX_Load
jues
2020-08-20 19:22:20
VS
237
有时候需要完全随机的数据,比如生成密钥等,这种会在极短时间内生成的随机数,如果使用时间作为种子是很不可靠的;
一般在C/C++中可以使用malloc/new来作为种子,但C#如果使用这非托管的方式较为不妥;
根据官方的介绍,我整理为一个函数,方便以后使用:
函数代码:
public static byte[] randomBytes(int count)
{
byte[]
Windows获取系统唯一标识UUID (也叫CSP UUID)
命令行
wmic csproduct get uuid
C/C++
使用CoCreateGuid函数,可以参考官方:https://docs.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-cocreateguid
jues
2020-08-10 23:26:17
VS
318
在学习C#的winform开发时,想在一个ListView控件中添加一些自定义的按钮、输入框、进度条等,发现和Qt开发比想来真的很吃力。
解决方法:
然而自己简单实现了,把它打包为一个nupkg包,可以直接调用;
效果:
使用部分的代码:
using Jues.CustomListItemView;
using System;
源码:
#include <stdio.h>
// put
#define MY_LOG_PUT(F,T,...) \
do{ \
char buff[200]; \
char *str; \
str = buff; \
sprintf(str, "[%s ]%s %s(Line %d): ",T,__FILE__,__FUNCTION__,__L
jues
2018-08-29 11:29:43
VS
1120
参考: 官方API Enumerable.ElementAt Method代码:using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace App1Dictionary001
{
class Program
&