文章分类 -  C# WinForm

摘要:0(最基本的技巧). 获取某列中的某行(某单元格)中的内容 this.currentposition = this.dataGridView1.BindingContext [this.dataGridView1.DataSource, this.dataGridView1.DataMember].Position; bookContent = this.database.dataSet.Tables[0].Rows [this.currentposition][21].ToString().Trim(); MessageBox.Show(bookContent);1、自定义列 //定义列宽 阅读全文
posted @ 2013-07-09 18:00 chenaran 阅读(119) 评论(0) 推荐(0)
摘要:int a = 12345678;//格式为sring输出Label1.Text = string.Format("asdfadsf{0}adsfasdf",a);Label2.Text = "asdfadsf"+a.ToString()+"adsfasdf";Label1.Text = string.Format("asdfadsf{0:C}adsfasdf",a);//asdfadsf¥1,234.00adsfasdfLabel2.Text = "asdfadsf"+a.ToString(& 阅读全文
posted @ 2013-07-09 17:59 chenaran 阅读(239) 评论(0) 推荐(0)
摘要:------------------------------------------------------------------- 十进制值 标识符 IBM兼容键盘 ------------------------------------------------------------------- 1 VK_LBUTTON 鼠标左键 2 VK_RBUTTON 鼠标右键 3 VK_CANCEL Ctrl+Break(通常不需要处理) 4 VK_MBUTTON 鼠标中键 8 VK_BACK Backspace 9 V... 阅读全文
posted @ 2013-07-09 17:56 chenaran 阅读(182) 评论(0) 推荐(0)
摘要://调用系统DLL[DllImport("user32.dll")]public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);[DllImport("user32.dll", CharSet = CharSet.Auto)]public static extern IntPtr PostMessage(IntPtr hwnd, int msg, int wparam, int lparam);//中英转换**private void 阅读全文
posted @ 2013-07-09 17:54 chenaran 阅读(123) 评论(0) 推荐(0)
摘要:方法一: 窗体或者控件的拖动 private Point m_MousePoint; private Point m_LastPoint; protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); this.m_LastPoint = this.Location; this.m_MousePoint = this.PointToScreen(e.Location); } protected override void OnMouseMove(MouseEventArgs e) { base.OnMo 阅读全文
posted @ 2013-07-09 17:52 chenaran 阅读(67) 评论(0) 推荐(0)
摘要:using System; using System.Threading; using System.Runtime.InteropServices; using System.Windows.Forms; namespace MouseControl { class MouseControl { ////// 鼠标控制参数 ///constint MOUSEEVENTF_LEFTDOWN =0x2; constint MOUSEEVENTF_LEFTUP =0x4; constint MOUSEEVENTF_MIDDLEDOWN =0x20; constint MOUSEEVENTF_MID 阅读全文
posted @ 2013-07-09 17:47 chenaran 阅读(198) 评论(0) 推荐(0)
摘要:using System.Runtime.InteropServices;using System.Drawing.Imaging;using System.Net;using System.Net.Sockets;using System.Threading;namespace mycamera{ public partial class Form1 : Form { //定义常量 private const int WM_USER = 0x400; private const int WS_CHILD = 0x40000000; private const int WS_VISIBLE = 阅读全文
posted @ 2013-07-09 14:02 chenaran 阅读(675) 评论(0) 推荐(0)