随笔分类 - C#.Net & MVC
摘要:using System; using System.Collections.Generic; using System.Text; using System.IO.Ports; using System.Windows.Forms; namespace TestSerialPort { /// /// 串口开发辅助类 /// public class Ser...
阅读全文
摘要:using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts...
阅读全文
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Runt...
阅读全文
摘要:private void button2_Click(object sender, EventArgs e) { Bitmap image = new Bitmap(200, 200); Graphics g = Graphics.FromImage(image); //使绘图质量最高,即消除锯...
阅读全文
摘要:namespace SerialPort { public partial class Form3 : Form { delegate void UpdateTextEventHandler(string text); //委托,此为重点 public static readonly string connStr = AppHelper.Get...
阅读全文
摘要:CREATE PROCEDURE [dbo].[GetNameById] @studentid varchar(8), @studentname nvarchar(50) OUTPUT AS BEGIN SELECT @studentname=studentname FROM student WHERE studentid=@studentid if @@Error0 RETU...
阅读全文
摘要:<?xml version="1.0"?> <!--先引用URLRewriter.dll,放置于Bin目录--> <configuration> <configSections> <!--配置重写规则节点--> <section name="RewriterConfig" type="URLRewr
阅读全文
摘要:/// /// 判断手机用户UserAgent /// /// private bool IsMobile() { HttpContext context = HttpContext.Current; if (context != null) { HttpRequest request = context.Request; i...
阅读全文
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.
阅读全文
摘要:void Application_Error(object sender, EventArgs e) { // 在出现未处理的错误时运行的代码 Exception objErr = Server.GetLastError().GetBaseException(); //获取错误 string err
阅读全文
摘要:using System; using System.Text; using System.Runtime.InteropServices; using System.Reflection; using System.Windows.Forms; namespace MouseKeyboardLibrary { /// /// Abstract base class for ...
阅读全文
摘要:通常,在C#中实现串口通信,我们有四种方法: 第一:通过MSCOMM控件这是最简单的,最方便的方法。可功能上很难做到控制自如,同时这个控件并不是系统本身所带,所以还得注册,不在本文讨论范围。可以访问http://www.devhood.com/tutorials/tutorial_details.a
阅读全文
摘要:我们经常会遇到在Winform或是WPF中点击链接或按钮打开某个指定的网址, 或者是需要打开电脑中某个指定的硬盘分区及文件夹, 甚至是"控制面板"相关的东西, 那么如何做呢? 答案是使用System.Diagnostics.Process.Start()。它的作用是调用外部的命令。 先来看看它的调用
阅读全文
摘要://Image转换Bitmap //1. Bitmap img = new Bitmap(imgSelect.Image); //2. Bitmap bmp = (Bitmap)pictureBox1.Image; /// <summary> /// 将图片Image转换成Byte[] /// </
阅读全文
摘要:#region 接口返回的Xml转换成DataSet /// <summary> /// 返回的Xml转换成DataSet /// </summary> /// <param name="text">Xml字符</param> /// <returns></returns> private Data
阅读全文
摘要:using System; using System.Collections.Generic; using System.Data; using System.Drawing; namespace Code { class BarCode { public class Code128 { priva
阅读全文
摘要:(1)自定义纸张设置 控制面板->打印机和传真->右键->服务器属性->创建新的格式 (2)自定义纸张使用 this.printDocument1.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("NewPrint", iWidth, iHeight); NewPrint:制...
阅读全文
摘要://write txt StringBuilder builder = new StringBuilder(); FileStream fs = new FileStream(saveFileName, FileMode.Create); StreamWriter sw = new StreamWr
阅读全文
摘要://C# 的串口通信,是采用serialPort控件,下面是对serialPort控件(也是串口通信必备信息)的配置如下代码: serialPort1.PortName = commcomboBox1.Text; serialPort1.BaudRate = int.Parse(baudcomboBox2.Text); serialPort1.Parity = (Parity)Enum.Par...
阅读全文
摘要:using System; using System.Collections.Generic; using System.Text; namespace MacPrinter { public class ZPL_Command { /// (^EF)<summary> /// 清除设定 (已包含起
阅读全文

浙公网安备 33010602011771号