随笔分类 -  C#中winform学习资料

DataGrid传值定位选中行
摘要:string InputStr = strVipID; foreach (DataGridViewRow dvr in dbgVip.Rows) { if (dvr.Cells[0].Value.ToString().StartsWith(InputStr)) { dbgVip.ClearSelection(); dvr.Selected = true; break; } } 阅读全文

posted @ 2009-07-20 18:02 欣路历程 阅读(529) 评论(0) 推荐(0) 编辑

decimal四舍五入的方法
摘要:public static decimal MyDecimalRound(decimal d, int decimals){d = d + 0.000000000000001m;return Decimal.Round(d, decimals);} 阅读全文

posted @ 2009-07-10 16:12 欣路历程 阅读(1185) 评论(0) 推荐(0) 编辑

DataGridView定位行
摘要:dbgComRukuList.Rows[dbgComRukuList.Rows.Count-1].Selected = true;dbgComRukuList.FirstDisplayedScrollingRowIndex = dbgComRukuList.Rows.Count - 1; 阅读全文

posted @ 2009-06-27 11:26 欣路历程 阅读(617) 评论(0) 推荐(0) 编辑

winform打印
摘要:private void printForm(){ img = new Bitmap(panel1.Width, panel1.Height); Size s = new Size(); s.Width = panel1.Width; s.Height = panel1.Height; Graphics g = Graphics.FromImage(img); g.CopyFromScreen(t... 阅读全文

posted @ 2009-06-24 16:05 欣路历程 阅读(600) 评论(0) 推荐(0) 编辑

DataGridView添加最后一行总计
摘要:DataTable dt = ds.Tables[0];DataRow dr = dt.NewRow();dr[0] = "总计";dt.Rows.Add(dr); 阅读全文

posted @ 2009-06-23 11:47 欣路历程 阅读(777) 评论(0) 推荐(0) 编辑

sql语句中总计相加
摘要:select a.班别编号, a.人数上限,a.人数上限-b.total from table1 aleft join (select 班别,count(班别) total from table2 ) b on b.班别=a.班别编号 阅读全文

posted @ 2009-06-19 16:57 欣路历程 阅读(630) 评论(0) 推荐(0) 编辑

DataGridView最后总计行
摘要:private double sum = 0;//取指定列的数据和,你要根据具体情况对待可能你要处理的是int protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex >= 0) { sum += Convert.ToDouble(e.Row.Cell... 阅读全文

posted @ 2009-06-19 16:55 欣路历程 阅读(561) 评论(0) 推荐(0) 编辑

CellFormatting事件绑定判断
摘要:private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e){ if (e.ColumnIndex == 1 /*status列的Index*/) { if (object.Equals(e.Value, 0)) { e.Value = "未完成"; e.CellSty... 阅读全文

posted @ 2009-06-19 16:54 欣路历程 阅读(2600) 评论(2) 推荐(0) 编辑

c# 打印和报表
摘要:使用打印方法时,要先引用命名空间: Using System.Drawing.PringingPrintDocument类的重要属性和方法:属性:DocumentName 设置打印文档时要显示的文档名(在打印任务队列中显示)DefaultPageSettings 打印页面设置PrinterSettings 打印机设置方法:print() 进行打印事件:PrintPage 打印时触发的事件,在此... 阅读全文

posted @ 2009-06-18 16:57 欣路历程 阅读(10011) 评论(2) 推荐(0) 编辑

DataGridView控件的定位行问题
摘要:dbgTodayYY.FirstDisplayedScrollingRowIndex = dbgTodayYY.Rows.Count - 1; 阅读全文

posted @ 2009-06-17 11:46 欣路历程 阅读(295) 评论(0) 推荐(0) 编辑

sql中日期函数的用法(带例子)
摘要:1.DateAdd ( I , N , D ) 将一个日期加上一段期间后的日期。 I :设定一个日期( Date )所加上的一段期间的单位。譬如 interval="d" 表示 N的单位为日。 I的设定值如下: yyyy Year 年 q Quarter 季 m Month 月 d Day 日 w Weekday 星期 h Hour 时 n Minute 分 s Second 秒 N :数值表达式... 阅读全文

posted @ 2009-06-14 13:43 欣路历程 阅读(645) 评论(0) 推荐(0) 编辑

WinForm中TabControl的一些事件写法(C#)
摘要:在TabControl控件中并没提供单个选项卡的Click事件,今天下午翻了翻MSDN 结果还是没找到相关的文档:( 看来只有自个儿折腾了...还好有个SelectedIndexChanged事件为我所用:) 以下是代码片段:privatevoidtabControl1_SelectedIndexChanged(objectsender,System.EventArgse) { switch(th... 阅读全文

posted @ 2009-06-10 11:36 欣路历程 阅读(1907) 评论(0) 推荐(0) 编辑

C# GridView 操作汇总
摘要:GridView 操作汇总1、自定义列 Customize Cells and Columns in the Windows Forms DataGridView Control by Extending Their Behavior and Appearance Host Controls in Windows Forms DataGridView Cells 继承 DataGridVi... 阅读全文

posted @ 2009-06-09 10:56 欣路历程 阅读(2266) 评论(0) 推荐(0) 编辑

导航