資源簡介
讀取文件夾下的note文本文件,編輯、保存
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.IO;
using?System.Runtime.InteropServices;
namespace?note
{
????public?partial?class?Form1?:?Form
????{
????????////////////設置窗口置頂///////////////
????????[DllImport(“user32.dll“?CharSet?=?CharSet.Auto)]
????????private?static?extern?int?SetWindowPos(IntPtr?hWnd?int?hWndInsertAfter?int?x?int?y?int?Width?int?Height?int?flags);
????????////////////////////////////////////////
????????int?width0?height0;
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????this.BackColor?=?Color.FromArgb(200?233?200);
????????????label1.BackColor?=?Color.FromArgb(200?233?200);
????????????width0?=?this.Width;
????????????height0?=?this.Height;
????????????this.StartPosition?=?FormStartPosition.Manual;??//位置設為手動
????????????this.Location?=?new?Point(800?10);??//窗口起始位置??(point)new?Size(xy);
????????????SetWindowPos(this.Handle?-1?0?0?0?0?1?|?2);?//設置窗口置頂,需要設置環境
????????????//Clipboard.SetDataobject(“【bbb】“);置內容到剪切板
????????}
????????private?void?textBox1_KeyUp(object?sender?KeyEventArgs?e)
????????{
????????????//if?(e.Modifiers?==?Keys.Control?&&?e.KeyCode?==?Keys.A)
????????????//if?(e.KeyData?==?(Keys.Control?|?Keys.A))
????????????//{?((TextBox)sender).SelectAll();?label1.Text?=?“你按下的是Ctrl+A“;?}??//按下Ctrl+A,選擇全部textbox的內容
????????????if?(e.Modifiers?==?Keys.Control?&&?e.KeyCode?==?Keys.S)
????????????{
????????????????//button1_Click(null?null);有問題???????//button1_Click(null?new?EventArgs());有問題
????????????????//button1.PerformClick();
????????????????//button1_Click(button1?e);??//按下Ctrl+S,調用保存按鈕功能
????????????}
????????????if?(e.Control?&&?e.Alt?&&?e.KeyCode?==?Keys.X)
????????????{?label1.Text?=?“組合鍵:CTRL?+?ALT?+?X?“;?}??//不好用
????????????if?(e.KeyCode?==?Keys.Up)
????????????{?label1.Text?=?“即向上箭頭!“;?}
????????????if?(e.Modifiers?==?(Keys.Control?|?Keys.Alt?|?Keys.Shift))
????????????{?label1.Text?=?“組合鍵Ctrl?+?Alt?+?Shift“;?}
????????????switch?(e.KeyData)
????????????{
????????????????case?(Keys.Control?|?Keys.A?):?
????????????????????((TextBox)sender).SelectAll();????label1.Text?=?“你按下的是Ctrl?+?A“;??????break;
????????????????case?(Keys.Control?|?Keys.Alt?|?Keys.D):
????????????????????label1.Text?=?“你按下的是組合鍵Ctrl?+?ALT?+?D“;???break;
????????????}
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)?//保存
????????{
????????????StreamReader?streamReader?=?null;
????????????StreamWriter?streamWrite?=?null;
????????????string?txtname?=?@“.\note.txt“?txtname2?=?@“.\note2.txt“;
????????????try
????????????{
????????????????if?(((Button)sender).Text?==?“保存“)
????????????????{
????????????????????//if?(!File.Exists(txtname))
??????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????160357??2017-12-09?16:27??note?-?副本\note\03.ico
?????文件?????333312??2017-12-09?16:29??note?-?副本\note\bin\Debug\note?-?副本.exe
?????文件?????335360??2017-12-16?14:54??note?-?副本\note\bin\Debug\note.exe
?????文件??????28160??2017-12-16?14:54??note?-?副本\note\bin\Debug\note.pdb
?????文件????????286??2021-01-04?19:38??note?-?副本\note\bin\Debug\note.txt
?????文件??????11600??2017-12-16?14:54??note?-?副本\note\bin\Debug\note.vshost.exe
?????文件????????490??2016-07-16?19:44??note?-?副本\note\bin\Debug\note.vshost.exe.manifest
?????文件??????????1??2017-12-08?09:14??note?-?副本\note\ClassDiagram1.cd
?????文件???????9110??2017-12-16?14:54??note?-?副本\note\Form1.cs
?????文件???????7477??2017-12-16?14:54??note?-?副本\note\Form1.Designer.cs
?????文件?????246655??2017-12-16?14:54??note?-?副本\note\Form1.resx
?????文件???????3859??2017-12-09?16:28??note?-?副本\note\note.csproj
?????文件???????5420??2017-12-13?17:16??note?-?副本\note\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6387??2017-12-16?14:54??note?-?副本\note\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????1072??2017-12-16?14:54??note?-?副本\note\obj\x86\Debug\note.csproj.FileListAbsolute.txt
?????文件????????975??2017-12-16?14:54??note?-?副本\note\obj\x86\Debug\note.csproj.GenerateResource.Cache
?????文件???????9174??2017-12-13?17:27??note?-?副本\note\obj\x86\Debug\note.csprojResolveAssemblyReference.cache
?????文件?????335360??2017-12-16?14:54??note?-?副本\note\obj\x86\Debug\note.exe
?????文件?????160923??2017-12-16?14:54??note?-?副本\note\obj\x86\Debug\note.Form1.resources
?????文件??????28160??2017-12-16?14:54??note?-?副本\note\obj\x86\Debug\note.pdb
?????文件????????180??2017-12-09?16:28??note?-?副本\note\obj\x86\Debug\note.Properties.Resources.resources
?????文件????????485??2017-12-08?09:12??note?-?副本\note\Program.cs
?????文件???????1340??2017-12-08?09:12??note?-?副本\note\Properties\AssemblyInfo.cs
?????文件???????2860??2017-12-08?09:12??note?-?副本\note\Properties\Resources.Designer.cs
?????文件???????5612??2017-12-08?09:12??note?-?副本\note\Properties\Resources.resx
?????文件???????1091??2017-12-08?09:12??note?-?副本\note\Properties\Settings.Designer.cs
?????文件????????249??2017-12-08?09:12??note?-?副本\note\Properties\Settings.settings
?????文件????????854??2017-12-08?09:12??note?-?副本\note.sln
????..A..H.?????19968??2017-12-16?14:54??note?-?副本\note.suo
?????目錄??????????0??2017-12-08?09:12??note?-?副本\note\obj\x86\Debug\TempPE
............此處省略11個文件信息
評論
共有 條評論