下载频道  >  raokaichuan的资源
  • C#制作PDF文件全攻略

    C#制作PDF文件全攻略C#制作PDF文件全攻略C#制作PDF文件全攻略C#制作PDF文件全攻略C#制作PDF文件全攻略C#制作PDF文件全攻略C#制作PDF文件全攻略C#制作PDF文件全攻略C#制作PDF文件全攻略C#制作PDF文件全攻略C#制作PDF文件全攻略

    C#

    2008-12-29
    10
  • jad反编译工具针对 javaclass字节码

    一款很好的字节码编译工具 是学习不可缺少的工具 呵呵 黄奕

    jad

    2008-12-29
    10
  • Ecma-262.pdf

    Ecma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdfEcma-262.pdf

    2008-12-29
    2
  • datagridview 分页

    ///

    /// 获取总页数 /// /// 总记录数 /// /// public static int GetPageCount(int recordcount, int page_size) { int pagecount = 0; if (recordcount % page_size == 0) pagecount = recordcount / page_size; else pagecount = (recordcount / page_size) + 1; return pagecount; } /**//// /// 获取分页数据 /// /// DATASET /// 每页记录数 /// 页索引 /// 总页数 /// public static DataView GetPagerForView(DataTable dt, int page_size, int pageindex,out string msg) { DataView dv = new DataView(); if (dt != null) { int recordCount = dt.Rows.Count; //总记录数 int page_sum = GetPageCount(recordCount, page_size); if (page_size < dt.Rows.Count)//kl2 :SQL查询函数返回的DATASET { if (page_size == 0)//text_intpase :判断用户设置的分页是否合法 page_size = 10; //recordCount = kl2.Tables[0].Rows.Count;//假设每页只显示1条数据,则共可以显示的页数:pagemark页 if (page_size < 1) { msg = "请将分页项设置在[1-" + dt.Rows.Count.ToString() + "]之间"; } msg = "共" + page_sum.ToString() + "页," + dt.Rows.Count.ToString() + "条";//page_num :lable DataTable page_table = new DataTable();//记录当前正在操作的是哪个表,全局变量,值由查询函数获取 for (int k = 0; k < dt.Columns.Count; k++) { page_table.Columns.Add(dt.Columns[k].ColumnName); } if (dt.Rows.Count != 0 && page_size < dt.Rows.Count) { page_table.Clear(); try //普通页面显示 { page_table.Clear(); for (int i = 0; i < page_size; i++) { page_table.Rows.Add(dt.Rows[i + (pageindex * page_size)].ItemArray); } } catch //最后不足一个页面的显示 { page_table.Clear(); try { for (int s = 0; s < recordCount - (pageindex * page_size); s++) { page_table.Rows.Add(dt.Rows[s + (pageindex * page_size)].ItemArray); } } catch { } } msg += " 当前第" + (pageindex + 1).ToString() + "页"; } dv = page_table.DefaultView; } else { dv = dt.DefaultView; msg = "共1页," + dt.Rows.Count.ToString() + "条"; msg += " 当前第" + (pageindex + 1).ToString() + "页"; } return dv; } else { msg = "没有数据!"; return null; } } Form中调用: Code private DataTable GetDicData()//获取所有据 { BLLB_CommunitDIC bcdicBll = new BLLB_CommunitDIC(); if (trvDic.SelectedNode != null) { if (trvDic.SelectedNode.Parent == null) { return null; } else { int areaid = Convert.ToInt32(trvDic.SelectedNode.Tag); return FCT.Common.PublicMethods.ConvertToDataSet(bcdicBll.GetAll(areaid)).Tables[0]; } } else return null; } //根据页索此获取数据 private void InitData(int pageindex) { DataTable dt = GetDicData(); string msg; if (dt != null && dt.Rows.Count > 0) { dgrvDic.AutoGenerateColumns = false; dgrvDic.DataSource = Public.CustomerPager.GetPagerForView(dt, 10, pageindex, out msg); toolStripLabel18.Text = msg; } } Code 分页事件#region 分页事件 private void toolStrip7_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Tag != null) { this.Cursor = Cursors.WaitCursor; int _currentPageIndex = 1; DataTable dt = GetDicData(); int pagecount = 0; if (dt != null) pagecount = Public.CustomerPager.GetPageCount(dt.Rows.Count, 10); if (toolStripTextBox6.Text != "") { try { _currentPageIndex = Convert.ToInt32(toolStripTextBox6.Text); } catch { _currentPageIndex = 1; } } switch (e.ClickedItem.Tag.ToString()) { case "First": _currentPageIndex = 1; break; case "Prev": _currentPageIndex = _currentPageIndex - 1; break; case "Next": _currentPageIndex = _currentPageIndex + 1; break; case "Last": _currentPageIndex = pagecount; break; default: this.Cursor = Cursors.Default; break; } InitData(_currentPageIndex - 1); if (_currentPageIndex == 1) { toolStripTextBox6.Text = "1"; this.toolStripButton25.Enabled = false; this.toolStripButton26.Enabled = false; this.toolStripButton27.Enabled = true; this.toolStripButton28.Enabled = true; } else { if (_currentPageIndex < pagecount && _currentPageIndex >= 1) { toolStripTextBox6.Text = _currentPageIndex.ToString(); this.toolStripButton25.Enabled = true; this.toolStripButton26.Enabled = true; this.toolStripButton27.Enabled = true; this.toolStripButton28.Enabled = true; } else if (_currentPageIndex == pagecount) { toolStripTextBox6.Text = pagecount.ToString(); this.toolStripButton25.Enabled = true; this.toolStripButton26.Enabled = true; this.toolStripButton27.Enabled = false; this.toolStripButton28.Enabled = false; } else { this.toolStripButton25.Enabled = false; this.toolStripButton26.Enabled = false; this.toolStripButton27.Enabled = false; this.toolStripButton28.Enabled = false; } } this.Cursor = Cursors.Default; } 84 #endregion

    2008-12-20
    3
  • DataGridView导出execl

    SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Execl files (*.xls)|*.xls"; saveFileDialog.FilterIndex = 0; saveFileDialog.RestoreDirectory = true; saveFileDialog.CreatePrompt = true; saveFileDialog.Title = "导出Excel文件到 "; saveFileDialog.ShowDialog(); if (saveFileDialog.FileName != " ") { Stream myStream; myStream = saveFileDialog.OpenFile(); StreamWriter sw = new StreamWriter(myStream, System.Text.Encoding.GetEncoding("gb2312")); string str = " "; try { //写标题 for (int i = 0; i < this.dataGridView1.ColumnCount; i++) { if (i > 0) { str += "\t"; } str += dataGridView1.Columns[i].HeaderText; } sw.WriteLine(str); //写内容 for (int j = 0; j < dataGridView1.Rows.Count; j++) { string tempStr = " "; for (int k = 0; k < dataGridView1.Columns.Count; k++) { if (k > 0) { tempStr += "\t"; } tempStr += dataGridView1.Rows[j].Cells[k].FormattedValue.ToString(); } sw.WriteLine(tempStr); } sw.Close(); myStream.Close(); } catch { MessageBox.Show(e.ToString()); } finally { sw.Close(); myStream.Close(); } }

    2008-12-20
    10
  • DataGridView在winform

    这几天在做一个winform的小软件,用到了datagridview这个庞大而让人头疼的控件,这么一个号称先进的东东,居然没办法分页。为了软件如期完工,先用以下方法完成分页。感谢原作者的同时,发现这种方法绝对不是一个有效率的好方法,他是伪分页。因为每次分页都填充了整个DataSet,只是视觉上给人一种分页的感觉。只让用户看到当页的,其他页隐藏起来。先用用吧,有好办法再来总结。另注,此写法有问题,我又在软件中修正

    2008-12-20
    10
  • extjs2.2已整合内存补丁

    extjs2.2已整合内存补丁 很好 很强大

    ext

    2008-12-19
    3
  • 软件工程思想 开启软件子论

    软件工程思想 是对国内的软件发展做出的一些实质型的看法与见解 同时作者也是多年开发经验的程序员 对软件工程有自己的思想 期望与大家一起分享

    2008-12-19
    3
  • 纯CSS清爽新闻列表布局——给新手看.rar

    纯CSS清爽新闻列表布局——给新手看的 对网页设计是一个良好的开始

    css

    2008-12-19
    3
  • Java猜数字游戏 真的很好

    对面向对象的集中使用 以及一些基本类的使用与简介

    2008-12-19
    3
img

关注 私信


用户积分:893