文章分类 - 控件
1
摘要:using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Drawing;using System.Threading;namespace comboBoxApp...{ /*...
阅读全文
摘要:(转)C# ComboBox下拉表单显示ToolTip(非API函数) 原文:http://blog.5d.cn/user2/skyline-moon/200901/511240.html近 日由于自已一个小程序的需要,要求在ComboBox下拉项目(每个item)上显示ToolTip,用Google搜了几圈,在Codeproject 上浏览的几遍,发现相关的介绍比较少,介绍的方法也主要是基于ap...
阅读全文
摘要:ActiveReport系列共写了十一篇,也已经有很久没有新东西了,现在整理一下,方便以后查阅,如果有写新的,会同时更新。使用ActiveReport for .net 进行报表开发(一)--开始使用ActiveReport for .net 进行报表开发(二)--绑定数据源使用ActiveReport for .net 进行报表开发(三)--显示对象集合中的数据使用ActiveReport fo...
阅读全文
摘要:以前写过一个web上的查找的例子,这次写了一个winform下的,当然还是要用正则表达式。一个窗口,上面有一个richTextBox,一个输入框,三个button:查找,前一个,后一个。主要代码:MatchCollection matches;int index = 0;private void button1_Click(object sender, EventArgs e){ this.ind...
阅读全文
摘要:在WebForm上,有的处理需要比较长的时间,为了防止重复提交,就要使用防连击javaScript代码:functiondoubleCheck(){if(window.document.readyState!=null&&window.document.readyState!='complete'){alert("正在处理,请等待!");returnfalse;}else{retu...
阅读全文
摘要:Winform中的ListView排序是一种常用的功能,下面是例子代码,放上来留个备份usingSystem;usingSystem.Windows.Forms;usingSystem.Drawing;usingSystem.Collections;namespaceListViewSortFormNamespace{publicclassListViewSortForm:Form{private...
阅读全文
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;names...
阅读全文
摘要:GridView中的RadioButton列与CheckBox列GridView拥有大量的内置功能,可以使用不同的默认filed来放置显示诸如TextBox、Buttos等等控件,支持模板是GridView的最大的功能,可以添加额外的、GridView没有的功能,例如RadioButton列。RadioButton可以让用户只选中一列,而CheckBox可以选中多列。可能首先想到的GridView...
阅读全文
摘要:WinForm 下我们可以调用MessageBox.Show 来显示一个消息对话框,提示用户确认等操作。在有些应用中我们需要通过程序来自动关闭这个消息对话框而不是由用户点击确认按钮来关闭。然而.Net framework 没有为我们提供自动关闭MessageBox 的方法,要实现这个功能,我们需要使用Window API 来完成。 首先我们需要找到这个消息对话框的窗口句柄,一个比较简单的方法就是用...
阅读全文
摘要:在很多地方, 我们都会用到DateTimePicker日历控件, 而这个控件的下拉只能通过点击下拉按钮触发. 这就使得我们在需要全键盘操作的时候很尴尬. DateTimePicker的下拉不像ComboBox一样, 可以设置DropDown属性来控制. 因此我们只能通过发送系统消息来控制. [System.Runtime.InteropServices.DllImport("user32.dll"...
阅读全文
摘要:代码如下: private void MoveCurorLast(){//让文本框获取焦点this.richTextBox1.Focus();//设置光标的位置到文本尾this.richTextBox1.Select(this.richTextBox1.TextLength, 0);//滚动到控件光标处this.richTextBox1.ScrollToCaret();}
阅读全文
摘要:在 Visual C# .NET 中提供的进度条控件只支持 Standard 视图。 本文的代码样例揭示了如何建立一个有如下属性的控件: Minimum。该属性表示了进度条的最小值。默认情况下是 0 ;您不能将该属性设为负值。 Maximum。该属性表示了进度条的最大值。默认情况下是 100 。 Value。该属性表示了进度条的当前值。该值必须介于 Minimum 和 Ma...
阅读全文
摘要:实现代码如下:public void disply(string strInput){richTextBox1.ForeColor = Color.Chartreuse;richTextBox1.AppendText(strInput + "\r\n");richTextBox1.Refresh();}public void disply(string strInput, Color fontCo...
阅读全文
摘要:通过API [DllImport("user32.dll")] public static extern System.Int32 CreateCaret(System.IntPtr hwnd, System.IntPtr hbm,System.Int32 cx, System.Int32 cy); [DllImport("user32.dll")] public st...
阅读全文
摘要:1、如何在多行TextBox中写入文本时实现换行? 由于Windows系统中,回车符需两上字符。因此方法是使用\r\n标记,如Label="Calculation "+":.......SUM\r\n"; textBox.AppendText(Label); 另外还有一个办法是用Environment.Newline的方法,可以兼容Windows和Linux系统。2、如何在多行TextBox中...
阅读全文
摘要:在Windows应用程序中使用水晶报表的方法 举例说明:(1)创建一个Windows应用程序,选择[解决方案资源管理器]à[添加新项]à[crystal report],输入报表名Reportl.rpt,点击[打开]。 (2)直接使用报表专家,点击[确定]。 (3)选择[OLE DB (ADO)],点击“+”号,选择“Microsoft OL...
阅读全文
摘要:在 我们打开文件夹时,在打开文件的文件对话框中显示帮助按钮的实现方法:private void button1_Click(object sender, EventArgs e) {//在文件对话框中显示帮助按钮 OpenFileDialog MyHelpDlg = new OpenFileDialog(); MyHelpDlg.ShowHelp = true; MyHelpDlg.HelpReq...
阅读全文
摘要://缺省设置(&D) private void optDefault_CheckedChanged(object sender, System.EventArgs e) { if(optDefault.Checked) { //插入点在起始处 txtDisplay.SelectionStart = 0; //将焦点设置到文本框,就可以看到我们设置的结果 txtDisplay.Focus()...
阅读全文
摘要:#region Using Directivesusing System;using System.IO ;using System.Xml ;using System.Collections ;using System.Reflection ;using System.Text ;using System.Data ;using System.ComponentModel;using Syste...
阅读全文
摘要:做了一个控件,这样就可以告别图片按钮了:)程序源代码:using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Data;using System.Windows.Forms;using System.Drawing.Drawing2D;using Syst...
阅读全文
1

浙公网安备 33010602011771号