11 2013 档案
摘要:在VS2008中做的附件:http://ys-e.ys168.com/2.0/276581430/j4G4J63367LMMJUJjsgW/CSHARP_WinCtrl21t_2014%E5%B9%B45%E6%9C%8831%E6%97%A592228.rar描述:文件以RTF格式保存在本地可以用...
阅读全文
摘要:用try catch来实现 try { int i = Convert.ToInt32((textBox1.Text)); BtnOK.Enabled = true; } catch (System.Exception ex) ...
阅读全文
摘要:使用private void button1_Click(object sender, EventArgs e){ RichTextBoxCtrl.richTextBoxFontClass r = new RichTextBoxCtrl.richTextBoxFontClass(); r.richTextBox = richTextBox1; r.ToggleBold();}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows...
阅读全文
摘要:执行一次设置选中的字体样式 再执行一次恢复正常 //粗体 public void ToggleBold(){ if (richTextBox1.SelectionFont == null) richTextBox1.SelectionFont = richTextBox1.Font; FontStyle style = richTextBox1...
阅读全文
摘要:http://blog.csdn.net/thirdapple/article/details/2755684 附件 http://files.cnblogs.com/xe2011/CSharpWinForm_WM_NCACTIVATE.rar 这个效果就像 你单击Combobox 下拉按钮或者菜单 主窗体不会失去焦点一样 Form1 using System;...
阅读全文
摘要:设置和获取选中的样式为 1. 2. 3. #region 数字序列 1. 2. 3. 4. 5. ... private bool bOrder = false; public bool SelectionOrderList { get { return ( (GetSelectionParaformat2wNumbering() == Paraformat2Numbering.ArabicNumbers) && ...
阅读全文
摘要:附件http://files.cnblogs.com/xe2011/CSharpWinForm_richTextBoxPrintClass.rar在窗体上一个Richtextbox 控件 和3个按钮调用页面设置 private void btnPageSetup_Click(object sender, EventArgs e) { richTextBoxPrintClass r = new richTextBoxPrintClass(); r.richTextBox = richTextBox1; r.Show...
阅读全文
摘要:附件http://files.cnblogs.com/xe2011/CSHARP_RichtextBox_PRINT.rar打印详情http://support.microsoft.com/kb/812425/zh-cn
阅读全文
摘要:private void Form1_Load(object sender, EventArgs e) { richTextBox1.AllowDrop = true; richTextBox1.EnableAutoDragDrop = true; }
阅读全文
摘要:附件http://files.cnblogs.com/xe2011/ReadAndSaveTreeViewState.rar保存和读取TreeView展开的状态 节点{ImageIndex,IsExpland,Position,Tag,Text } //加载 private void buttonLoad_Click(object sender, EventArgs e) { treeView1.Focus(); string xmlFileName = "TreeView.xml"; if (System.IO...
阅读全文
摘要:http://files.cnblogs.com/xe2011/CustomRichTextBox_HideCaret.rarrichTextBox能高亮选择,光标仍在,没有光标闪烁把重RichTextBox类去除闪烁光标 http://msdn.microsoft.com/en-us/library/windows/desktop/ms648403%28v=vs.85%29.aspxusing System;using System.Windows.Forms;using System.Runtime.InteropServices;namespace WindowsFormsApplica
阅读全文
摘要:编辑一下程序然后 手动打开EXE 能实现 自己关闭自己接着打开自己 private void button1_Click(object sender, EventArgs e){ Close(); string s = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; S...
阅读全文
摘要:FolderBrowserDialogfolderBrowserDialog1=newFolderBrowserDialog();folderBrowserDialog1.Description="请选择一个文件夹";if(folderBrowserDialog1.ShowDialog()==DialogResult.OK)MessageBox.Show(folderBrowserDialog1....
阅读全文
摘要:通过这个提示可以以快速找到问题
阅读全文
摘要:privatevoidbutton1_Click(objectsender,EventArgse){strings="是否要删除以下文件?\n";for(inti=0;i15){//产生1...10for(inti=1;i<11;i++){s2+=String.Format("{0,3}.{1}\n",i,str);}s2+="\n";s2+="...\n";s2+="\n";s2+=s1;...
阅读全文
摘要:当ListView多选时返回第一次选中的项索引正确定义一个变量=-1 表示第一次没选任何一项privateintFirstSelectedIndex=-1;更新FirstSelectedIndex的值一定要放在Mouse_Click放在 listView1_SelectedIndexChanged或listView1_ItemSelectionChanged无效privatevoidlistView1_MouseClick(objectsender,MouseEventArgse){intcount=listView1.SelectedItems.Count;if(count>0){in
阅读全文
摘要:处理了以下问题 System.IO.Directory.Delete 目录不是空的。 对路径“License.rtf”的访问被拒绝 这个文件为只读属性 当这个文件夹的子文件夹处于打开时删除失败
阅读全文
摘要:附件1:http://files.cnblogs.com/xe2011/CSharp_WindowsForms_delegate03.rar一个RTF文件管理器描述 Form2,Form3,Form4都是独立存在的,同时完成独立的功能,相互不依赖。最后把Form2,Form3,Form4集合放在FORM1上,实际上需要这3个的窗体Form2,Form3,Form4间相互得到改变后的变量值。FORM2 文件夹列表 在FORM1中设置一初始文件夹路径 要实现的功能:当单击本窗体中的TreeView.node时,要求Form3.ListView的文件列表同时更新。FORM3 文件列表 需要...
阅读全文
摘要:附件:http://files.cnblogs.com/xe2011/CSharp_WindowsForms_delegate02.rar窗体2 和窗体3 都是动态创建出来的现在 FORM3.TEXT要即时 = FORM2.TEXTFORM1窗体代码 Form2 f2 = new Form2(); Form3 f3 = new Form3(); private void Form1_Load(object sender, EventArgs e) { f2.XYZ += new Form2.CallBack(GetF...
阅读全文
摘要:附件 http://files.cnblogs.com/xe2011/CSharp_WindowsForms_delegate01.rar需要每个窗体是独立存在,禁止相与引用窗体这样干净并且可以反复重用Form1的代码 private void button1_Click(object sender, EventArgs e) { Form2 f2 = new Form2(); f2.XYZ += new Form2.CallBack(GetForm2TextBox1Text); f2.Show(); ...
阅读全文
摘要:附件:http://files.cnblogs.com/xe2011/XML_Writer_And_Read.rar 下面这段代码实现了以下功能 数据保存 textBox1的文本,textBox2的文本,窗体的LEFT TOP WIDTH HEIGHT 读取数据 textBox1的文本,textBo
阅读全文
摘要:using System.Runtime.InteropServices; private const int WS_HSCROLL = 0x100000;private const int WS_VSCROLL = 0x200000;private const int GWL_STYLE = (-16); [DllImport("user32.dll")] priv...
阅读全文
摘要:这个和WINDOWS创建RTF文件一样public void CreateRtfFile(string RtfFileName) { RichTextBox richTextBox1 = new RichTextBox(); richTextBox1.SaveFile(RtfFileName); }private void button1_Click(object sender, EventArgs e) { string Dir = @"C:\Users\Admin\Desktop\"; st...
阅读全文
摘要:saveFileDialog1.ShowDialog saveFileDialog.FileName 设置的时候是一个字符串。 如: 新建 RTF 文档.rtf 获得的时候 则为一个完整的路径。 如:C:\Users\Admin\Desktop\新建 RTF 文档.rtf saveFileDialo
阅读全文
摘要:一般处理可以使用 Replace("\r\n", ""); 来替换 如果文件路径带换行符的会错误(路径中有非法字符或者系统找不到文件) 替换\r 替换 \n
阅读全文
摘要:在运行中,输入 Explorer /select,C:\Windows\System32\cmd.exe 达到打开文件夹并选择文件夹内的一个文件的目的 http://hi.baidu.com/liyi93/item/2508abfc821a654f922af242打开文件所在位置并且选中这个文件 publicvoidExplorerFile(stringpath){System.Diagnostics.Process.Start("explorer.exe",@"/select,"+path);}打开文件夹 publicvoidExplorerDirec
阅读全文
摘要:附件:http://files.cnblogs.com/xe2011/TreeView_Drag_Directory%E6%93%8D%E4%BD%9C.rarTREEVIEW拖拽对应修改目录usingSystem.IO; privatestaticstringRootPath=@"D:\Administrator\Documents\TestData";//返回D:\Administrator\DocumentsprivatestringmyPath=GetDirectoryParentPath(RootPath);privatevoidForm1_Load(object
阅读全文
摘要:原目录 D:\ProgramFiles\Tencent 想要的目录 D:\ProgramFilesusingSystem.IO; //目录D:\Administrator\Documents\TestData//返回D:\Administrator\DocumentsprivatestringGetDirectoryParentPath(stringpath){DirectoryInfod=newDirectoryInfo(path);returnd.Parent.FullName;}privatevoidbutton1_Click(objectsender,EventAr...
阅读全文
摘要:uses Vcl.Imaging.GIFImg;procedure TForm1.Button2Click(Sender: TObject);begin Image1.Picture.LoadFromFile('1.gif'); Image1.Transparent:=True; TGIFImage(Image1.Picture.Graphic).AnimationSpeed :...
阅读全文
摘要:uses ADODB_TLB, CDO_TLB, ComObj,MSHTML;{$R *.dfm}{能把网页如 WWW.QQ.COM保存为一个单文件 .MHT但不能把一个 A.HTM保存为一个单文件 .MHT}procedure WB_SaveAs_MHT(WB: TWebBrowser; FileName: TFileName);var Msg: IMessage; Conf: IConfigu...
阅读全文
摘要:注册全局热键(实例热键显示和隐藏窗体) ctrl+alt+aunit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type TForm1 = class(TForm) procedure FormCreate(Sender: ...
阅读全文
摘要:使用多线程实现打字效果
unit Unit1;interfaceusesWinapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;ty...
阅读全文
摘要:Delphi 调用外部程序并等待其运行结束function CreateSingleObject(FileName: string):Boolean;var s: TStartupinfo; p: TProcessInformation;begin Result:=False; FillChar(s, Sizeof(TStartupinfo), 0); s.cb := Sizeof(...
阅读全文
摘要:http://files.cnblogs.com/xe2011/ScreenLight_pas.rar窗体文件object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 220 ClientWidth = 447 Color = clBtnFace TransparentColor = True TransparentColorValue = clPurple Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Heig...
阅读全文
摘要://光标在控件不同位置时的样式 //改变控件的大小 使用
阅读全文
摘要:下面这2种方法都能实现对控件和窗体的拖拽 方法1
阅读全文
摘要:http://files.cnblogs.com/xe2011/StringToColor.rarunit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Butt...
阅读全文
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Data;using System.Text;using System.Windows.Forms;/*使用说明:WindowsFormsApplication1- 添加- 现有项- ColorComboBox.cs先编译一下 然后工具栏中就有这个组件了选中这个组件有个 Extented属性 设置 为TRUE 就为完整了调用 private void colorComboBo...
阅读全文
摘要:OfficePickershttp://www.codeproject.com/Articles/12327/Office-2003-Color-Picker来自为知笔记(Wiz)附件列表
阅读全文
摘要:附件 http://download.csdn.net/detail/teststudio/6575241主窗体UNITunit MainForm;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, ComCtrls;type TFormMain = class(TForm) Button2: TButton; Button1: TButton; Panel1: TPanel; p...
阅读全文
摘要:以前用VB编程常用InputBox,现在学了C#,竟然找不到它了……后来到网上查到了,现在贡献给大家:1。首先要添加引用Microsoft.VisualBasic2。命名空间 Using Microsoft.VisualBasic;3。以后就可以直接使用VB中的好多类库 例如:Text=Microsoft.VisualBasic.Interaction.InputBox("行号","转到行","...
阅读全文
摘要:ID 类 控件 备注(+窗体 共64个控件) 公共控件 1 Form 属性方法事件 2 ...
阅读全文
摘要:http://files.cnblogs.com/xe2011/TreeView_Drag_and_Drop.rar假设把A节点往B节点上拖拽那么A 为Node1,B为Node2 privatevoidForm1_Load(objectsender,EventArgse){treeView1.AllowDrop=true; treeView1.HideSelection = false;} privateTreeNodenode1=null;//node1当前选中的那个节点privatevoidtreeView1_ItemDrag(objectsender,ItemDragEventA...
阅读全文
摘要:privatevoidrichTextBox1_SelectionChanged(objectsender, EventArgse) { pos = richTextBox1.SelectionStart; } privateintpos =...
阅读全文
摘要:privatevoidbutton2_Click(objectsender,EventArgse){Win32CommonDialog.frm_GOTOfrm=newWin32CommonDialog.frm_GOTO();frm.label1.Text="等号(1-"+richTextBox1.Lines.Length.ToString()+")(&L)";intL=richTextBox1.GetLineFromCharIndex(richTextBox1.SelectionStart);frm.textBox1.Text=L.ToStrin
阅读全文
摘要:.在RichTextBox控件中插入图片关键点.实现过程.publicvoidShowInsertImageDlg(){OpenFileDialogOpenFileDialog1=newOpenFileDialog();OpenFileDialog1.Title="SelectImage";OpenFileDialog1.Filter="BMPFile|*.BMP|JPEGFile|*.JPG|GIFFile|*.GIF|PNGFile|*.PNG|ICOFile|*.ICO|ImageFile|*.BMP;*.DIB;*.RLE;*.JPG;*.JPEG;*.J
阅读全文