随笔分类 -  winform

摘要://方法一 if (e.KeyChar == 0x20) e.KeyChar = (char)0; //禁止空格键 if ((e.KeyChar == 0x2D) && (((TextBox)sender).Text.Length =... 阅读全文
posted @ 2014-12-31 15:44 JasonGu0 阅读(193) 评论(0) 推荐(0)
摘要:请参考:http://www.cnblogs.com/inforasc/archive/2009/10/12/1582110.html 阅读全文
posted @ 2014-12-23 15:18 JasonGu0 阅读(165) 评论(0) 推荐(0)
摘要:using System.Runtime.InteropServices; [DllImport("user32")]private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags); //下面是可用的常量,按照不合的动画结果声明本身须要的private const int AW_HOR_POSITIVE = 0 x0001;//自左向右显示窗口,该标记可以在迁移转变动画和滑动动画中应用。应用AW_CENTER标记时忽视该标记private const int AW_HOR_NEGA 阅读全文
posted @ 2014-02-05 15:28 JasonGu0 阅读(902) 评论(0) 推荐(0)
摘要:首先定义一个Form的全局变量(不用赋值)Form f1 ;然后在一个点击事件里面,写入如下代码: if(f==null||f.IsDisposed) //if语句里面 必须先判断null,再判断IsDisposed,不能先判断IsDisposed { f=new Form2(); f.Show(); } else { f.Show(); } 阅读全文
posted @ 2014-01-04 11:21 JasonGu0 阅读(229) 评论(0) 推荐(0)
摘要:窗体A :代码如下:public delegate void BrushPermission();//定义一个委托 /// /// 刷新主界面的权限(功能按钮) /// public event BrushPermission brushpermission;//定义个事件在窗体A 刷新 窗体B时 就将事件委托 brushpermission委托出去,代码如下: brushpermission();//执行自定义的事件窗体B需要接受该事件委托,代码如下: { Fd_Permission.Fm_... 阅读全文
posted @ 2013-12-05 10:34 JasonGu0 阅读(1120) 评论(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 System.Runtime.InteropServices;using System.Diagnostics;using System.IO;using System.Data.SqlClient;namespace temp{ .. 阅读全文
posted @ 2013-11-28 15:51 JasonGu0 阅读(1175) 评论(0) 推荐(0)
摘要:这里,我是自定义了一个类OverrideTxt继承了System.Windows.Forms.TextBoxusing System;using System.Collections.Generic;using System.Linq;using System.Text;namespace WindowsFormsApplication1{ public class OverrideTxt : System.Windows.Forms.TextBox { protected override void OnTextChanged(EventArgs e) ... 阅读全文
posted @ 2013-11-26 13:54 JasonGu0 阅读(2069) 评论(0) 推荐(0)
摘要:void textBox2_TextChanged(object sender, EventArgs e) { this.textBox2.SelectionStart = this.textBox2.TextLength; this.textBox2.SelectionLength = 0; this.textBox2.ScrollToCaret(); } 阅读全文
posted @ 2013-11-19 13:33 JasonGu0 阅读(339) 评论(0) 推荐(0)
摘要:先自定义一个类 继承DataGridViewTextBoxCellusing System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;using System.Drawing;namespace com.Threes.CustomControl{ public class DataGridViewBooleanCell : DataGridViewTextBoxCell { protected override void Paint(Graphics gr... 阅读全文
posted @ 2013-11-19 11:12 JasonGu0 阅读(1100) 评论(0) 推荐(0)
摘要:private delegate void FlushClient();//代理 private void ThreadFunction() { if (this.textBox1.InvokeRequired) { FlushClient fc = new FlushClient(ThreadFunction); this.Invoke(fc); } else { ... 阅读全文
posted @ 2013-11-18 09:58 JasonGu0 阅读(428) 评论(0) 推荐(0)
摘要:定义一个重新启动的类: class Relogin { public void Restart() { Thread thtmp = new Thread(new ParameterizedThreadStart(run)); object appName = Application.ExecutablePath; Thread.Sleep(1000); thtmp.Start(appName); } private void run(Objec... 阅读全文
posted @ 2013-11-04 15:49 JasonGu0 阅读(1090) 评论(0) 推荐(0)
摘要:static ArrayList Sheets(string filepath) { ArrayList al = new ArrayList(); string strconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties=Excel 8.0;"; OleDbConnection conn = new OleDbConnection(strconn); conn.Op... 阅读全文
posted @ 2013-10-29 15:11 JasonGu0 阅读(519) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Runtime.InteropServices;using System.Windows.Forms;namespace PrintDatas{ public static class SelectFocusInControls { // DLL调用注册 [DllImport("user32.dll", CharSet = CharSet.Auto, Callin... 阅读全文
posted @ 2013-10-11 11:53 JasonGu0 阅读(448) 评论(0) 推荐(0)
摘要:首先要新建一个 winform窗体然后代码如下 :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 PrintDatas{ public partial class FormMessageBox :... 阅读全文
posted @ 2013-10-07 11:53 JasonGu0 阅读(813) 评论(0) 推荐(0)
摘要:bool bol = false; foreach (Form fm in Application.OpenForms) { if (fm is fmSales) { bol = true;fm... 阅读全文
posted @ 2013-09-17 14:30 JasonGu0 阅读(364) 评论(0) 推荐(0)