随笔分类 -  开发技巧

摘要:Graphics 有两个多个方法 这里面介绍3个: 1.Graphics.drawString();绘制.画字符串........... e.Graphics.DrawString("新乡市三月软件公司入库单", new Font(new FontFamily("黑体"), 11), System. 阅读全文
posted @ 2018-04-12 14:05 WhiteSpace 阅读(1130) 评论(0) 推荐(0)
摘要:首先引用zxing.dll 到项目中引用using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.Linq; using System.Text; using System.Threading.Tasks; using ZXing... 阅读全文
posted @ 2018-04-12 10:46 WhiteSpace 阅读(1695) 评论(0) 推荐(0)
摘要:随机数的定义为:产生的所有数字毫无关系. 在实际应用中很多地方会用到随机数,比如需要生成唯一的订单号. 在C#中获取随机数有三种方法: 一.Random 类 Random类默认的无参构造函数可以根据当前系统时钟为种子,进行一系列算法得出要求范围内的伪随机数. 1 2 Random rd = new  阅读全文
posted @ 2018-04-09 14:54 WhiteSpace 阅读(179892) 评论(0) 推荐(5)
摘要:托管的DLL组件可以在VS 直接添加引用,在使用using dll的文件命名空间就可以使用 非托管的DLL组件,只能通过using system.Runtime.InteropServices;引入 函数写在类的里面方法的外面如: pubulic Class Myclass { [DllImport 阅读全文
posted @ 2018-04-09 13:48 WhiteSpace 阅读(586) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Though... 阅读全文
posted @ 2018-04-02 15:12 WhiteSpace 阅读(739) 评论(2) 推荐(0)
摘要:首先要因为一个动态库文件ThoughtWorks.QRCode.Codec; 可以去网上下载一个ThoughtWorks.QRCode.dll。之后添加现有项目引用就可以 using ThoughtWorks.QRCode.Codec; using ThoughtWorks.QRCode.Codec 阅读全文
posted @ 2018-04-02 14:01 WhiteSpace 阅读(848) 评论(0) 推荐(0)
摘要:/// /// 字符串加密解密类 /// public sealed class StringSecurity { private StringSecurity() { } #region DES 加密/解密 private static byte[] key = ASCIIEncoding.ASCI... 阅读全文
posted @ 2018-03-28 15:22 WhiteSpace 阅读(506) 评论(0) 推荐(0)
摘要:/// /// 通用验证类 /// class DataValidate { /// /// 验证正整数 /// /// /// public static bool IsInteger(string txt) { ... 阅读全文
posted @ 2018-03-28 15:21 WhiteSpace 阅读(153) 评论(0) 推荐(0)
摘要:比如:我在窗体A中有个查询的结果集 根据结果集中的序号来点击修改,就显示数据库中相对应的内容; 首先呢,我们要写个方法返回一个对象,public 对象 get(string 序号) 我们要显示的对象已经出来了,接下来要把对象中的数据现在是另一个窗体中,需要在另一个窗体中写一个带参数的构造方法!完了把 阅读全文
posted @ 2018-03-28 15:19 WhiteSpace 阅读(301) 评论(0) 推荐(0)
摘要:将如偏序列化方法 using System; using System.Collections.Generic; using System.Linq; using System.Text; //引入三个命名空间 using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; u... 阅读全文
posted @ 2018-03-28 15:18 WhiteSpace 阅读(2738) 评论(0) 推荐(0)
摘要:foreach (Control item in groupBox1.Controls) { if (item is TextBox) //判断控件是不是TextBox { item.Text = ""; //如果是text就为空 } else if (item is ComboBox) //判断控 阅读全文
posted @ 2018-03-28 15:16 WhiteSpace 阅读(426) 评论(0) 推荐(0)
摘要://删除窗体方法 private void CloseFrm() { foreach (Control item in panel1.Controls) { if (item is Form) //判断此控件是否是窗体 { ... 阅读全文
posted @ 2018-03-28 15:15 WhiteSpace 阅读(321) 评论(0) 推荐(0)
摘要:首先主Windows程序要添加一个【应用程序配置文件】会在项目中生成一个App.config文件。 在项目中也引用System.Configuration这个引用 当前文档中没有源。 在后台数据类库中也要添加引用System.Configrueation 同样也要Using System.Confi 阅读全文
posted @ 2018-03-28 15:14 WhiteSpace 阅读(179) 评论(0) 推荐(0)
摘要:panel1.BackgroundImage = Image.FromFile(""); 添加图片的方法 args就写上图片的名称就行 // 背景图片=图片.文件路径(“图片的名称”) 图片一定要放在主程序运行的目录下 //如果在图片存放在主目录中Image的文佳夹中,参数要(“Image\图片名” 阅读全文
posted @ 2018-03-28 15:14 WhiteSpace 阅读(1016) 评论(0) 推荐(0)