![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C#
hu421160052
水滴石穿
展开
-
C#json解析数组例子
String json="{"Data":[{"username":"410100h","activenum":"299784"},{"username":"69ejfb","activenum":"249741"}]}";JObject jlist = (JObject)JsonConvert.DeserializeObject(a); //获取树形用户json字符串 string userList = jlist["Data"].ToS原创 2020-07-14 12:35:41 · 826 阅读 · 1 评论 -
C#程序退出时线程依然挂起,如何强制全部线程一起退出
在关闭窗体时执行以下代码 System.Environment.Exit(0);原创 2019-08-30 14:09:13 · 2390 阅读 · 0 评论 -
C#跨线程访问控件
最简单粗暴的方法 public Form1() { InitializeComponent(); // 加入这行 Control.CheckForIllegalCrossThreadCalls = false; }原创 2019-08-30 14:04:20 · 384 阅读 · 0 评论 -
C#在其他class中调用或修改Form1中的控件的属性
using System.Windows.Forms;namespace StudyStrong{ //创建一个全局常量 public static Form1 curForm1; public partial class Form1 : Form { private void Form1_Load(object sender, EventArgs e) ...原创 2019-08-16 16:32:07 · 3947 阅读 · 0 评论 -
C#实现鼠标的全局监听
三步:1.建立Win32Api.csusing System;using System.Collections.Generic;using System.Runtime.InteropServices;using System.Text;namespace StudyStrong{ class Win32Api { [StructLayout(La...原创 2019-08-16 16:05:07 · 7661 阅读 · 8 评论 -
试图加载不正确的程序。(异常来自HRESULT:0x8007000B)的处理方式
本人遇到的问题是C#调用C++编写的DLL时出现的此错误解决办法是:C#和C++统一用Releasex86编译原创 2019-07-25 16:57:51 · 2624 阅读 · 1 评论 -
一个简单的C#监听桌面程序(Server & Client)
作为笔记原创 2019-07-23 18:03:19 · 989 阅读 · 0 评论 -
C#窗体圆角设置
private void User_Load_1(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Normal) { SetWindowRegion(); } ...原创 2018-10-25 10:35:15 · 4012 阅读 · 4 评论 -
C#窗体起始位置设置
int x = (System.Windows.Forms.SystemInformation.WorkingArea.Width - this.Size.Width *2) ;int y = this.Size.Height/5 ;this.StartPosition = FormStartPosition.Manual;this.Location = (Point)new Size(...原创 2018-10-25 10:26:43 · 2726 阅读 · 0 评论 -
C#任意控件移动窗体
private static bool IsDrag = false;private int enterX;private int enterY;private void setForm_MouseDown(object sender, MouseEventArgs e){IsDrag = true;enterX = e.Location.X;enterY = e.Location....原创 2018-10-22 14:55:48 · 1056 阅读 · 0 评论 -
C#的StreamWriter写入文件丢失
今天在写程序的时候绕了半天在文件写入丢失的问题上,结果结果是因为StreamWriter在使用后没有close导致的,有图为证:这个是没有close的时候,文件在输出后的形态是这样的:这里是少了一部分信息,找了很久的原因,加上close以后:输出的文件信息:这里是完整的信息,刚开始还以为是string的内存不足导致,结果输出了strCollected(string)发现是完整的,输...原创 2018-10-16 17:40:54 · 4020 阅读 · 0 评论