随笔分类 - C#
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Drawing;namespace BresenhamLine.Util{ class DrawLine { [System.Runtime.InteropServices.DllImport("gdi32.dll")] internal static extern bool SetPixel(IntPtr h...
阅读全文
摘要:customerBindingSource.DataSource = northwindDataContent.Customers; Type type = customerDataGridView.GetType(); PropertyInfo pi = type.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); pi.SetValue(customerDataGri...
阅读全文
摘要:using System;using System.IO;using System.Collections.Generic;using System.Text;using System.Data;using System.Drawing;using System.Windows.Forms;namespace Config{ class ExportHelper { #region " DataGridViewToXml " public void DataGridViewToXml(DataGridView dataGridView, String f...
阅读全文
摘要:1.朋友的一个需求,让我给他实现,需求是这样的,需要用ASP.net写一个页面负责处理客户端上传的文件,并根据传递的参数把文件保存到相应的目录。客户端是手机应用程序,因为没学过Android,所以我只是写了一个Java的Demo用来上传文件。服务端:public partial class _Default : System.Web.UI.Page{ private string id = ""; private string userName = ""; private string type = ""; private strin
阅读全文
摘要:在TCP协议中,对于断开的一方其本地用来通讯的端口(系统分配的)仍然会被保留一段时间。所以客户端断开后立即再连就是失败。解决的途径就是换一个本地的通讯端口,由于不能手动指定一个新端口那就只能重新创建TcpClient实例。在重新创建TcpClient之前要释放掉原TcpClient所占有的资源。 C#代码: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net.Sockets;using System.Threading;namespace OnL..
阅读全文
摘要:ManagementEventWatcher getEventWatcher = null; WqlEventQuery getEventQuery = null; ManagementOperationObserver getObserver = new ManagementOperationObserver(); ManagementScope getScope = new ManagementScope("root\\CIMV2"); getScope.Options.EnablePrivilege...
阅读全文
摘要:Excel导出XML比较简单,但是在不修改原Excel文件的情况下,自定义XML 元素,将数据导出,1.我拿到的Excel 文件中的数据的第一、二、三行数据是要移除了2.Xml元素要具有灵活性。可以自定义3.默认读取Excel第一张工作簿,Excel工作簿可以重命名,这个问题要考虑到。1.首先自定义XSD,用来定义要导出XML的文档结构。<?xml version="1.0" encoding="utf-8"?><xs:schema id="XMLSchema"targetNamespace="http:/
阅读全文
摘要:选 项语法Projectselect <expression>Filterwhere <expression>, distinctTestany(<expression>), all(<expression>)Join<expression> join <expression> on <expression> equals <expression>Groupgroup by <expression>, into <expression>, <expression>
阅读全文

浙公网安备 33010602011771号