- 博客(30)
- 收藏
- 关注
转载 C# RichTextBox显示不同格式的字体
//定义四个文本部分,便于分别应用不同的文本格式 string firstString = "大山的骄傲\r\n "; string secondString = "——eheartcool其人\r\n\r "; string thirdString = "\t七十年代末的一个夜晚,没有星星,也没有月亮," + "中国湖北恩施...
2019-02-21 15:16:30 1053
原创 pictureBox异步加载图片
maxImg.LoadCompleted += new AsyncCompletedEventHandler(maxImg_LoadCompleted); //图片加载时,显示等待光标 maxImg.UseWaitCursor = true; //采用异步加载方式 maxImg.WaitOnLoad = false; /...
2018-12-26 17:27:03 511
转载 C# WinForm捕获全局异常
static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { try { ...
2018-12-25 15:32:03 257
原创 winform异常处理
//订阅ThreadException事件,处理UI线程异常,处理方法为 Application_ThreadException,关于事件的相关知识就不在这叙述了 Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadExc...
2018-12-25 15:17:44 521
原创 winform中PictureBox 图片放大 旋转
public partial class Img : Form { public Img(string file) { InitializeComponent(); maxImg.ImageLocation = file; this.MouseWheel += Img_Mous...
2018-12-25 10:22:53 1520
原创 c#图片压缩
//将图片按百分比压缩,flag取值1到100,越小压缩比越大 public static bool YaSuo(Image iSource, string outPath, int flag) { ImageFormat tFormat = iSource.RawFormat; EncoderParamete...
2018-11-01 17:31:11 216
原创 c# base64加密解密
/// <summary> /// BASE64解码 /// </summary> /// <param name="s"></param> /// <returns></returns> public static string Bas
2018-10-22 17:42:52 1208
原创 sql查询数据库每张表存储
;with cte as (SELECTt.name as chexian,SUM (s.used_page_count) as used_pages_count,SUM (CASE WHEN (i.index_id < 2) THEN (in_row_data_page_count + lob_used_page_count + row_overflow_u...
2018-10-16 11:21:09 353
原创 js加密转c#加密|数字加密|Encrypt加密
今天爬数据看到个密文研究半天 明文 17628044345 加密后082094080087086083091080086087092 下面是同过js转化的加密方法/// <summary> /// 电话号码加密方法 /// </summary> /// <returns></ret...
2018-09-26 16:16:14 807
原创 C#上传文件各种格式
public string SavePicture(string base64Str, string type) { string strbase64 = base64Str.Replace(' ', '+'); string strurl = string.Format("{0}//CheXianPdf//{1}/...
2018-09-06 10:31:51 780 1
原创 c#文件不存在则创建
if (!System.IO.Directory.Exists(@"C:\GyyhFtp\Upload")) { System.IO.Directory.CreateDirectory(@"C:\GyyhFtp\Upload");//不存在就创建目录 }...
2018-09-06 10:28:53 2228
原创 c# ftp上传与下载
public class FtpUpload { public static string serverIP = "127.0.0.1:2121"; public static string userName = "xxx"; public static string password = "xxx"; publ...
2018-09-06 10:25:18 133
原创 C#利用time控件轮训
/// <summary> /// 方法入口 /// </summary> public void StartPollingThread() { System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); ...
2018-09-06 10:23:37 584
原创 c#md5加密
public string GetMD5(string sDataIn) { MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); byte[] bytValue, bytHash; bytValue = System.Text.Encoding.
2018-01-19 10:19:41 156
原创 winform不让他初始选择一行
dataGridView1.Rows[0].Selected = false; listView1.Items[0].Selected = false;
2018-01-19 10:19:29 186
原创 存储过程大数据通用高效分页(不带条件和排序)
create PROCEDURE [dbo].[GetPageDataOut](@tn nvarchar(30),--表名称@idn nvarchar(20),--表主键名称@pi int = 1,--当前页数 @ps int = 7,--每页大小@rc int output,--总行数(传出参数)@pc int output--总页数(传出参数))ASDECLARE @sql NVARCHAR
2018-01-19 10:19:20 613
原创 c#单例模式
1.私有化构造函数,在外部不能new了private Fstudent(){InitializeComponent();}2.创建一个静态的私有的窗体类的变量public static Fstudent single;3.创建一个静态的,公共的方法返回窗体类对象public static Fstudetn GetSingle(){ if(single==null||single.IsDisp
2018-01-19 10:19:05 93
原创 c#发送邮件
MailMessage mailMsg = new MailMessage();//两个类,请引入 System.Net.Mail下的 mailMsg.From = new MailAddress("yzk@rupeng.com", "招商银行客服中心");//源邮件地址 (放送人的) mailMsg.To.Add(new MailAddress("te
2018-01-19 10:18:50 440
原创 js中时间格式问题
function renderTime(date) { var da = new Date(parseInt(date.replace("/Date(", "").replace(")/", "").split("+")[0])); return da.getFullYear() + "-" + (da.getMonth() + 1) + "-" + d
2018-01-19 10:18:39 277
原创 c#请求带参url
static string GetHTML(string url, string param) { // 创建 WebRequest 对象,WebRequest 是抽象类,定义了请求的规定, // 可以用于各种请求,例如:Http, Ftp 等等。 // HttpWebRequest 是 WebRequest 的派生类
2018-01-19 10:18:19 904
原创 Lambda模糊查询
数据源.Where(s => s.Name.IndexOf("张")>=0 --------意义等同於 like '%张%' s.Name.StartsWith("张") -------- 等同於like '张%' s.Name.EndWith("张") -------- 等同於like '%张');p => p.CardMumber.IndexOf(CardMumbe
2018-01-18 16:17:51 3809
原创 js中只能输入数字
var txtvalve = this.value;var reg = new RegExp(/^\d+$/);if(!reg.test(txtvalve)){ alert("必须输入数字")}
2018-01-18 16:15:47 3885
原创 DbHelperSQL
using System;using System.Collections.Generic;using System.Text;using System.Data;using System.Data.SqlClient;using System.Reflection;//反射命名空间namespace AJAX联系{ /// /// 数据层 - 数据库 操作类 ///
2018-01-18 16:15:16 354
原创 C#中Dictionary的用法
要使用Dictionary集合,需要导入C#泛型命名空间 System.Collections.Generic(程序集:mscorlib) Dictionary的描述1、从一组键(Key)到一组值(Value)的映射,每一个添加项都是由一个值及其相关连的键组成2、任何键都必须是唯一的3、键不能为空引用null(VB中的Nothing),若值为引用类型,则可以为空值4、Key和Value可以是任何类
2018-01-18 16:14:27 192
原创 c#发送请求
/// /// Get请求模式 /// /// 请求的URL /// public static string Get(string urlString) { //定义局部变量 HttpWebRequest httpWebRequest = null
2018-01-18 16:07:56 127
原创 base64加解密两次
#region base64编码 /// /// base64编码 /// /// /// public static string Base64Encoding(string str) { byte[] bytes = Encoding.
2018-01-18 15:59:31 3927
原创 身份证验证
#region 验证身份证 public static bool CheckIDCard(string Id) { if (Id.Length == 18) { bool check = CheckIDCard18(Id); retur
2018-01-18 15:58:41 106
原创 json实体类之间转换
(类)Newtonsoft.Json.JsonConvert.DeserializeObject(类, typeof(类)); Newtonsoft.Json.JsonConvert.SerializeObject(类);
2018-01-18 15:57:34 339
原创 AEC加解密
//密钥字符串 private static readonly string KEY = ""; //初始化向量字符串 private static readonly string IV = ""; /// /// AES解密 /// /// 密文字符串
2018-01-18 15:53:10 1433
原创 相同类循环替换值
/// /// 反射两个类替换 (当要修改的类中有null值是用历史类里面的值) /// /// /// 要修改的类 /// 历史类 public static void FieldReplacement(T sobj, T gobj) { foreach (var pro
2018-01-18 15:50:36 169
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人