摘要:二个方法:以运行系统记事本为例方法一:这种方法会阻塞当前进程,直到运行的外部程序退出System.Diagnostics.Process exep = System.Diagnostics.Process.Start(@"C:\Windows\Notepad.exe");exep.WaitForEx...
阅读全文
摘要:SizeF sizeF = g.MeasureString(listBox1.Items[e.Index].ToString(), e.Font, listBox1.Width);
阅读全文
摘要:string FilePath = HttpRuntime.BinDirectory.ToString(); string FileName = FilePath + "日志" + "\\" + System.DateTime.Now.ToString("yyyyMMdd") + ".txt"; //判断有无当天txt文档,没有则创建 if (!File.Exists(FileName)) { //...
阅读全文
摘要:1.新建项目名称AdRotator2.右键项目名称添加一个xml文件命名为AdRotator.xml images/1.jpg http://www.Microsoft.com 图像不用时显示的文本 可用于筛选特定的广告的广告类别 1000 200 1000 images/2.jpg http://www.asp.net 图像不用时显示的文本 可用于筛选特定的广告的广告类别 300 200 1000 3.新建一个Images文件夹,添加三张图片4.在页面中拖一个AdRotator控件,并设置他的属...
阅读全文
摘要:1.控制面板-防火墙-高级设置-入站规则-右侧的BranchCache内容检索,右键启用规则。
阅读全文
摘要:1.Flat button用这个方法,前提是要把button的type设置为Flatbutton1.TabStop = false;button1.FlatAppearance.BorderSize = 0;button1.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255); //设置边框的颜色Transparentbutton1.FlatAppearance.MouseOverBackColor = Color.FromArgb(0, 255, 255, 255); //设置鼠标经过时候的背景颜色Transparentb
阅读全文
摘要:http://msdn.microsoft.com/zh-cn/library/system.drawing.graphics.drawimage.aspx
阅读全文
摘要:在多线程C#开发中,遇到错误 执行 CreateHandle() 时无法调用值 Dispose()。,这个错误是在关闭窗体的时候出来的。 原因是因为窗体还存在CreateHandle()事件,所以还不能回收垃圾。 当前窗体的句柄Handle还没有创建完成所以不能直接进行关闭操作。解决方法:1.protected override void OnVisibleChanged(EventArgs e){ base.OnVisibleChanged(e); if ( !IsHandleCreated) { this.Close(); }}2.IsB...
阅读全文
摘要:Have you been in need of converting mp3 audios to wav audios? If so, the skill in this article provides you a chance to manage the mp3-to-wav conversion by yourself.The wave audio files are useful because they retain the first-generation archived file with high quality and simple file structures. Bu
阅读全文
摘要: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 System.Runtime.InteropServices;namespace testWinForm{ public partial class Form2 : Form { public Form2() ...
阅读全文
摘要:一、IP地址操作类1、IPAddress类a、在该类中有一个Parse()方法,可以把点分的十进制IP表示转化成IPAddress类,方法如下: IPAddressaddress=IPAddress.Parse(“192.168.0.1”);b、IPAddress提供4个只读字段Any用于代表本地系统可用的任何IP地址Broadcase用于代表本地网络的IP广播地址Loopback用于代表系统的回送地址 None用于代表系统上没有网络接口其中IPAddress.Any最常用可以用来表示本机上所有的IP地址,这对于socket服务进行侦听时,最方便使用,不用对每个IP进行侦听了。而IPAddre
阅读全文
摘要:1.Serverusing System;using System.Collections.Generic;using System.Text;//添加Socket类using System.Net;using System.Net.Sockets;namespace ScoketServer{ class Program { static void Main(string[] args) { int port = 8080; string host = "17.1.1.78"; //创建...
阅读全文
摘要:1.首先,窗体的FormBorderStyle设置成None,不要控制边框。2.然后,TransparencyKey和BackColor颜色设置成相同的,这样,窗体就透明了。3.最后,窗体的拖动private void pictureBox1_MouseMove(object sender, MouseEventArgs e){ if (e.Button == MouseButtons.Left) { this.Left += e.Location.X - this.oldX; //新的鼠标位置 t...
阅读全文
摘要:SqlDataAdapter类主要在MSSQL与DataSet之间执行数据传输工具,本节将介绍如何使用SqlDataAdapter类来填充DataSet和MSSQL执行新增、修改。、删除等操作。功能说明 SqlDataAdapter类构建在SqlCommand类之上,并提供了许多配合DataSet使用的功能。使用Fill方法可以把从MSSQL得到的查询结果填充到DataSet中。当DataSet中的数据发生了改变时,使用Update方法可以把更改后的数据更新到MSSQL。语法定义 下面演示如何创建一个SqlDataAdapter类的实例: //无参数 SqlDataAdapter adapt.
阅读全文
摘要:使用SqlCommand类来执行Transact-SQL语句或存储过程时,有时需要用参数传值或作为返回值,SqlParameter类正是为了此需要而设计的类。下面介绍如何使用该类为SqlCommand对象设置参数。功能说明 SqlParameter类用来作为SqlCommand类的参数。通过指定参数的ParameterName属性可以设置参数的名称,在使用SqlParameter对象之前必须设置此属性。DbType属性可以指定参数的类型。SqlParameter对象还可以作为存储过程的参数返回结果。语法定义 SqlParameter类的语法定义如下 public sealed class S.
阅读全文
摘要:private void comBoxBinding() { SqlConnection connection = this.getConnection(); connection.Open(); SqlCommand command = new System.Data.SqlClient.SqlCommand(); command = new SqlCommand("select State_Name_English,State_Name,StandSys,StandSys_English,...
阅读全文
摘要:Form2public partial class Form2 : Form{ public string str; public Form2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { str = textBox1.Text; Form3 f3 = new Form3(); f3.ShowDialog(this); }}Form3public partial class...
阅读全文
摘要:public Form1(){ InitializeComponent(); //连接数据库 string str = "Data Source=IP;Initial Catalog=数据库名称;Persist Security Info=True;User ID=**; Password="; ConnectDatebase(str); }void ConnectDatebase(string sql){ SqlConnection connection = new SqlConnection(); connection.ConnectionString = sql;..
阅读全文