C#
文章平均质量分 73
美好晨光
专业:计算机软件
展开
-
锁定 Windows 系统
using System;using System.Runtime.InteropServices;using System.Windows.Forms;namespace LockWindows{ public partial class FormLock : Form { public FormLock() { Initiali原创 2009-07-19 14:13:00 · 387 阅读 · 0 评论 -
在局域网里获取已安装 SQL Server 的用户列表
currentService = new ServiceController();currentService.MachineName = Environment.MachineName;cmbServiceName.BeginUpdate();foreach (ServiceController service in ServiceController.GetServices()){ if原创 2009-07-19 14:13:00 · 478 阅读 · 0 评论 -
启动 SQL Server 服务
using System;using System.Diagnostics;using (Process psi = new Process()){ psi.StartInfo.FileName = "cmd.exe"; string value = "start"; switch (ComboBox.Text) { case "启动":原创 2009-07-19 14:14:00 · 393 阅读 · 0 评论 -
ClipImage
using System;using System.Threading;using System.Windows.Forms;namespace ClipImage{ static class Program { [STAThread] static void Main() { #region Mutex原创 2009-11-27 22:06:00 · 562 阅读 · 0 评论 -
ExtensionMethod
using System;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Linq;using System.Text.RegularExpressions;using System.Windows.Forms;using Excel = Microsoft.Office.Intero原创 2009-11-27 22:18:00 · 446 阅读 · 0 评论 -
ChineseLunisolarCalendar
using System;using System.Drawing;using System.Globalization;using System.Runtime.InteropServices;using System.Windows.Forms;namespace LunisolarCalendar{ public partial class FormCalendar : Form原创 2009-11-27 22:22:00 · 832 阅读 · 0 评论 -
PrintDocument
using System;using System.Drawing;using System.Drawing.Printing;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1{ public partial class Form1 : Form { #reg原创 2009-11-27 22:48:00 · 596 阅读 · 0 评论 -
ServiceController
using System;using System.Linq;using System.ServiceProcess;private ServiceController currentService = new ServiceController();currentService.MachineName = Environment.MachineName;cmbServiceName.B原创 2009-11-27 22:49:00 · 409 阅读 · 0 评论 -
Services
using System;using System.Diagnostics;using System.Drawing;using System.Linq;using System.Runtime.InteropServices;using System.ServiceProcess;using System.Windows.Forms;namespace DIYService{ publ原创 2009-11-27 22:49:00 · 343 阅读 · 0 评论 -
SetItemCheckState
using System.Windows.Forms;// 全部选中foreach (int index in System.Linq.Enumerable.Range(0, CheckedListBox.Items.Count)){ CheckedListBox.SetItemCheckState(index, CheckState.Checked);}// 全部取消foreach原创 2009-11-27 22:50:00 · 744 阅读 · 0 评论 -
System.Threading.Mutex
using System;using System.Runtime.InteropServices;using System.Threading;using System.Windows.Forms;namespace DIYShutdown{ static class Program { #region DllImportAttribute [Dll原创 2009-11-27 22:52:00 · 3070 阅读 · 0 评论 -
窗口只能全屏或还原
using System.Windows.Forms;public static void ShowModal(this Form frame, Form owner){ frame.MaximizeBox = false; // 隐藏“最大化”按钮。 frame.MinimizeBox = false; // 隐藏“最小化”按钮。 frame.ShowInTa原创 2009-11-27 22:53:00 · 559 阅读 · 0 评论 -
Main
using System;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace ProductManager{ public partial class FormMain : Form { #region 自定义对象 pr原创 2009-11-27 23:02:00 · 394 阅读 · 0 评论 -
FormImageAccess.cs
using System;using System.IO;using System.Runtime.InteropServices;using System.Threading;using System.Windows.Forms;using Microsoft.Win32;using Access = Microsoft.Office.Interop.Access;namespace Ima原创 2010-01-24 12:49:00 · 351 阅读 · 0 评论 -
FormImageSQL.cs
use mastergoif DB_ID(UserImage) is not null drop database UserImagecreate database UserImagegouse UserImagegocreate table Images( Image_Name nvarchar(255) primary key, Image_Data Image not null)go原创 2010-01-24 12:51:00 · 289 阅读 · 0 评论 -
Shutdown
using System;using System.Runtime.InteropServices;using System.Threading;using System.Windows.Forms;using Microsoft.Win32;namespace ShutDown{ static class Program { #region DllImportAtt原创 2009-11-27 22:10:00 · 484 阅读 · 0 评论 -
AnimateWindow
using System;using System.Runtime.InteropServices;using System.Windows.Forms;namespace WinFormTitle{ public partial class FormTitle : Form { [DllImport("user32.dll", EntryPoint = "Anima原创 2009-11-27 22:22:00 · 463 阅读 · 0 评论 -
CultureInfo
using System.Globalization;using System.Linq;#region Application.CurrentCultureprivate void cultureComboBox_SelectedIndexChanged(object sender, EventArgs e){ CultureInfo culture = cultureComboBo原创 2009-11-27 22:24:00 · 377 阅读 · 0 评论 -
DataGridTableStyle
using System;using System.Collections.Generic;using System.Drawing.Printing;using System.Windows.Forms;namespace WindowsFormsApplication1{ public partial class Form1 : Form { private D原创 2009-11-27 22:25:00 · 458 阅读 · 0 评论 -
DialogResult
public FormDialog(){ this.ShowInTaskbar = false; // 禁止在 Windows 任务栏中显示窗体。 this.btnOK.DialogResult = DialogResult.OK; // 自定义有模式对话框确定按钮 this.btnCancel.DialogResult = DialogResult.Cancel; // 自定原创 2009-11-27 22:26:00 · 608 阅读 · 0 评论 -
Flags Enum
Flags Enum:Intersect (&):(SelectionFont.Style & FontStyle.Bold)Union, Except (^):(SelectionFont.Style ^ FontStyle.Bold)Union (|):(SelectionFont.Style | FontStyle.Bold)Except (& ~):(SelectionFo原创 2009-11-27 22:32:00 · 351 阅读 · 0 评论 -
Image
using System.Data.SqlTypes;using System.Drawing;using System.IO;using System.Windows.Forms;WinForm Image:PictureBox.SizeMode = PictureBoxSizeMode.StretchImage;PictureBox.ImageLocation = FileName;原创 2009-11-27 22:38:00 · 465 阅读 · 0 评论 -
KeyChar as Keys
using System.Windows.Forms;public bool IsMoney(char keyChar){ return (char.IsNumber(keyChar) || keyChar == . || (Keys)keyChar == Keys.Back);}public bool IsPassword(char keyChar){ return (c原创 2009-11-27 22:39:00 · 675 阅读 · 0 评论 -
软件试用次数
using System.Windows.Forms;using Microsoft.Win32;RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software/UserSubKey/Times");int time = Convert.ToInt32(subKey.GetValue("UseTime", 30));if (t原创 2009-11-27 22:53:00 · 427 阅读 · 0 评论 -
Login
using System;using System.Windows.Forms;using ProductManager.Model;using Microsoft.Win32;namespace ProductManager{ public partial class FormLogin : Form { #region 自定义对象 private U原创 2009-11-27 23:01:00 · 426 阅读 · 0 评论 -
DragDropFile
using System;using System.Windows.Forms;using Microsoft.Win32;#region FormLoadprotected override void OnLoad(EventArgs e){ base.OnLoad(e); try { using (RegistryKey userKey = Applica原创 2009-11-27 22:26:00 · 540 阅读 · 0 评论 -
ListView 导航栏
using System.Drawing;using System.Windows.Forms;Splitter splitterNavigate = new Splitter();splitterNavigate.BackColor = SystemColors.Window;splitterNavigate.BorderStyle = BorderStyle.Fixed3D;splitte原创 2009-11-27 22:45:00 · 498 阅读 · 0 评论 -
TreeView 导航栏
using System.Drawing;using System.Windows.Forms;Splitter splitterNavigate = new Splitter();splitterNavigate.BackColor = SystemColors.Window;splitterNavigate.BorderStyle = BorderStyle.Fixed3D;splitte原创 2009-11-27 22:46:00 · 543 阅读 · 0 评论 -
起泡法
int[] values = System.Linq.Enumerable.Range(1, 10).Reverse().ToArray();int length = values.Length;for (int i = 0; i { for (int j = 1; j { if (values[i] > values[i + j]) {原创 2009-11-27 22:54:00 · 492 阅读 · 0 评论 -
DataGridViewCellStyle
using System;namespace ProductManager{ class DataMember { private decimal price; private DateTime date; public decimal Price { get { return price; }原创 2009-11-27 22:25:00 · 2088 阅读 · 0 评论 -
DesktopLocation
using System.Drawing.Drawing2D;using System.Windows.Forms;this.TopMost = true; // 将窗体显示为最顶层窗体。this.DoubleBuffered = true; // 双缓冲绘制图形。this.ShowInTaskbar = false; // 在 Windows 任务栏中隐藏窗体。this原创 2009-11-27 22:25:00 · 514 阅读 · 0 评论 -
DrawComboBox
using System;using System.Drawing;using System.Linq;using System.Windows.Forms;using Microsoft.Win32;#region FormNotepad_Loadprivate void FormNotepad_Load(object sender, EventArgs e){ try {原创 2009-11-27 22:27:00 · 373 阅读 · 0 评论 -
Form.Title
using System;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1{ public partial class Form1 : Form { private Timer timer1; private string title = "窗口原创 2009-11-27 22:33:00 · 481 阅读 · 0 评论 -
InputLanguage
using System.Linq;using System.Windows.Forms;#region Application.CurrentInputLanguageprivate void languageComboBox_SelectedIndexChanged(object sender, EventArgs e){ Application.CurrentInputLangu原创 2009-11-27 22:39:00 · 669 阅读 · 0 评论 -
MaskedTextBox
MaskedTextBox控件Mask属性:0 数字,必选。此元素将接受 0 到 9 之间的任何一个数字。9 数字或空间,可选。 # 数字或空间,可选。如果掩码中该位置为空白,在 Text 属性中将把它呈现为一个空格。允许使用加号 (+) 和减号 (-)。 L 字母,必选。将输入限定为 ASCII 字母 a-z 和 A-Z。此掩码元素等效于正则表达式中的 [a-zA-Z]。 ? 字母,可原创 2009-11-27 22:46:00 · 686 阅读 · 0 评论 -
NotifyIcon
using System;using System.Runtime.InteropServices;using System.Windows.Forms;namespace WinFormNotify{ public partial class FormNotify : Form { #region AnimateWindow [DllImport("u原创 2009-11-27 22:47:00 · 333 阅读 · 0 评论 -
ResetText
C#:using System.Linq;using System.Windows.Forms;public static void ClearText(this GroupBox gb){ foreach (ListControl list in gb.Controls.OfType()) { list.ResetText(); list.Select原创 2009-11-27 22:48:00 · 814 阅读 · 0 评论 -
String.Format
String.Format()复合格式设置:格式项语法: { 索引[,对齐][:格式字符串]}索引组件强制“索引”组件(也叫参数说明符)是一个从 0 开始的数字,可标识对象列表中对应的项。 也就是说,参数说明符为 0 的格式项列表中的第一个对象,参数说明符为 1 的格式项列表中的第二个对象,依次类推。通过指定相同的参数说明符,多个格式项可以引用对象列表中的同一个元素。例如,通过指定类似原创 2009-11-27 22:52:00 · 372 阅读 · 0 评论 -
数字格式字符串
自定义数字格式字符串:"," 字符可作为千位分隔符说明符和数字比例换算说明符。千位分隔符说明符:如果在两个设置数字的整数位格式的数字占位符(0 或 #)之间指定一个或多个“,”,则在输出的整数部分中的每个数字组之间插入一个组分隔符。当前 NumberFormatInfo 对象的 NumberGroupSeparator 和 NumberGroupSizes 属性将确定用作数字组分隔符的字符原创 2009-11-27 22:54:00 · 521 阅读 · 0 评论 -
正则表达式
只能输入数字:"^[0-9]*$"。只能输入n位的数字:"^/d{n}$"。只能输入至少n位的数字:"^/d{n,}$"。只能输入m~n位的数字:。"^/d{m,n}$"只能输入零和非零开头的数字:"^(0|[1-9][0-9]*)$"。只能输入有两位小数的正实数:"^[0-9]+(.[0-9]{2})?$"。只能输入有1~3位小数的正实数:"^[0-9]+(.[0-9]{原创 2009-11-27 22:55:00 · 287 阅读 · 0 评论