| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2063 人关注过本帖
标题:求记事本程序
只看楼主 加入收藏
nyzfl
Rank: 1
等 级:新手上路
帖 子:278
专家分:0
注 册:2005-3-21
收藏
得分:0 
收到的记事本程序不怎么样?可以说是垃圾

My-Blog地址:http://fenglin.
2005-05-10 11:13
yushengou
Rank: 1
等 级:新手上路
帖 子:401
专家分:0
注 册:2005-3-30
收藏
得分:0 
晕。
我等会做一个看看

我是初学者,希望大家能多多帮助我 /bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://bbs./bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-05-10 11:59
幻风幻云
Rank: 1
等 级:新手上路
帖 子:762
专家分:0
注 册:2005-1-14
收藏
得分:0 
以下是引用nyzfl在2005-5-10 11:13:28的发言: 收到的记事本程序不怎么样?可以说是垃圾
你想要什么样的啊?

2005-05-10 15:56
nyzfl
Rank: 1
等 级:新手上路
帖 子:278
专家分:0
注 册:2005-3-21
收藏
得分:0 
我想要的记事本和微软的一样

My-Blog地址:http://fenglin.
2005-05-16 12:12
nyzfl
Rank: 1
等 级:新手上路
帖 子:278
专家分:0
注 册:2005-3-21
收藏
得分:0 

My-Blog地址:http://fenglin.
2005-05-17 15:07
jidegang
Rank: 1
等 级:新手上路
帖 子:91
专家分:0
注 册:2005-5-14
收藏
得分:0 
我也要,我想看看撤消那个功能是怎么实现的,如果有实现撤消功能的代码也发我一份,谢了
jidegang_xy@
2005-05-21 02:29
houyunqing
Rank: 1
等 级:新手上路
帖 子:476
专家分:0
注 册:2005-4-1
收藏
得分:0 

随手做了一个比较简单的(文件部分还没弄好,错啦~~,另外,还没做查找替换功能的,这个很简单啦,在反白显示中设置RichTextBox对象的Select方法就可以了,第一个参数是起始位置,第二个是长度) using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO;

namespace Out { /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { bool press = false; bool press2 = false; int x=0,y=0,x2=0,y2=0; private System.Windows.Forms.ContextMenu contextMenu1; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem menuItem3; private System.Windows.Forms.MenuItem menuItem4; private System.Windows.Forms.NotifyIcon notifyIcon1; private System.Windows.Forms.MenuItem menuItem5; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Panel panel4; private System.Windows.Forms.RichTextBox TBox; private System.Windows.Forms.MenuItem menuItem6; private System.Windows.Forms.MenuItem menuItem7; private System.Windows.Forms.MenuItem menuItem8; private System.Windows.Forms.MenuItem menuItem9; private System.Windows.Forms.MenuItem menuItem10; private System.Windows.Forms.MenuItem menuItem11; private System.Windows.Forms.Splitter splitter1; private System.ComponentModel.IContainer components;

public Form1() { // // Required for Windows Form Designer support // InitializeComponent();

// // TOD Add any constructor code after InitializeComponent call // }

/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); }

#region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.contextMenu1 = new System.Windows.Forms.ContextMenu(); this.menuItem5 = new System.Windows.Forms.MenuItem(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.menuItem9 = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.menuItem3 = new System.Windows.Forms.MenuItem(); this.menuItem4 = new System.Windows.Forms.MenuItem(); this.menuItem6 = new System.Windows.Forms.MenuItem(); this.menuItem7 = new System.Windows.Forms.MenuItem(); this.menuItem11 = new System.Windows.Forms.MenuItem(); this.menuItem8 = new System.Windows.Forms.MenuItem(); this.menuItem10 = new System.Windows.Forms.MenuItem(); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.panel1 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); this.splitter1 = new System.Windows.Forms.Splitter(); this.panel3 = new System.Windows.Forms.Panel(); this.panel4 = new System.Windows.Forms.Panel(); this.TBox = new System.Windows.Forms.RichTextBox(); this.panel2.SuspendLayout(); this.SuspendLayout(); // // contextMenu1 // this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem5, this.menuItem1, this.menuItem9, this.menuItem2, this.menuItem3, this.menuItem4, this.menuItem6, this.menuItem7, this.menuItem11, this.menuItem8, this.menuItem10}); // // menuItem5 // this.menuItem5.Checked = true; this.menuItem5.Index = 0; this.menuItem5.Text = "只读"; this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click); // // menuItem1 // this.menuItem1.Index = 1; this.menuItem1.Text = "最大化"; this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click); // // menuItem9 // this.menuItem9.Index = 2; this.menuItem9.Text = "还原"; this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click); // // menuItem2 // this.menuItem2.Index = 3; this.menuItem2.Text = "最小化"; this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click); // // menuItem3 // this.menuItem3.Index = 4; this.menuItem3.MergeOrder = 1; this.menuItem3.Text = "通知图标"; this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click); // // menuItem4 // this.menuItem4.Index = 5; this.menuItem4.Text = "全选"; this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click); // // menuItem6 // this.menuItem6.Index = 6; this.menuItem6.Text = "设置选中字体"; this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click); // // menuItem7 // this.menuItem7.Index = 7; this.menuItem7.Text = "设置全部字体"; this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click); // // menuItem11 // this.menuItem11.Index = 8; this.menuItem11.Text = "设置默认字体"; this.menuItem11.Click += new System.EventHandler(this.menuItem11_Click); // // menuItem8 // this.menuItem8.Index = 9; this.menuItem8.Text = "关闭"; this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click); // // menuItem10 // this.menuItem10.Index = 10; this.menuItem10.Text = "打开文件"; this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click); // // notifyIcon1 // this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon"))); this.notifyIcon1.Text = "Reader"; this.notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click); // // panel1 // this.panel1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(243)), ((System.Byte)(247))); this.panel1.Dock = System.Windows.Forms.DockStyle.Left; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(6, 454); this.panel1.TabIndex = 0; // // panel2 // this.panel2.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(243)), ((System.Byte)(247))); this.panel2.Controls.Add(this.splitter1); this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.panel2.Location = new System.Drawing.Point(6, 448); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(602, 6); this.panel2.TabIndex = 1; // // splitter1 // this.splitter1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(243)), ((System.Byte)(247))); this.splitter1.Cursor = System.Windows.Forms.Cursors.SizeNWSE; this.splitter1.Dock = System.Windows.Forms.DockStyle.Right; this.splitter1.Location = new System.Drawing.Point(596, 0); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(6, 6); this.splitter1.TabIndex = 5; this.splitter1.TabStop = false; this.splitter1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.splitter1_MouseUp); this.splitter1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.splitter1_MouseMove); this.splitter1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.splitter1_MouseDown); // // panel3 // this.panel3.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(243)), ((System.Byte)(247))); this.panel3.Dock = System.Windows.Forms.DockStyle.Right; this.panel3.Location = new System.Drawing.Point(602, 0); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(6, 448); this.panel3.TabIndex = 2; // // panel4 // this.panel4.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(243)), ((System.Byte)(247))); this.panel4.Dock = System.Windows.Forms.DockStyle.Top; this.panel4.Location = new System.Drawing.Point(6, 0); this.panel4.Name = "panel4"; this.panel4.Size = new System.Drawing.Size(596, 6); this.panel4.TabIndex = 3; this.panel4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel4_MouseUp); this.panel4.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel4_MouseMove); this.panel4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel4_MouseDown); // // TBox // this.TBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.TBox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.TBox.ContextMenu = this.contextMenu1; this.TBox.Location = new System.Drawing.Point(6, 8); this.TBox.Name = "TBox"; this.TBox.ReadOnly = true; this.TBox.Size = new System.Drawing.Size(596, 442); this.TBox.TabIndex = 4; this.TBox.Text = ""; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.BackColor = System.Drawing.SystemColors.ControlLightLight; this.ClientSize = new System.Drawing.Size(608, 454); this.Controls.Add(this.TBox); this.Controls.Add(this.panel4); this.Controls.Add(this.panel3); this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "Form1"; this.Text = "Reader"; this.panel2.ResumeLayout(false); this.ResumeLayout(false);

} #endregion

/// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); }

private void menuItem1_Click(object sender, System.EventArgs e) { this.WindowState=FormWindowState.Maximized; }

private void menuItem2_Click(object sender, System.EventArgs e) { this.WindowState=FormWindowState.Minimized; }

private void menuItem3_Click(object sender, System.EventArgs e) { this.WindowState=FormWindowState.Minimized; this.Hide(); notifyIcon1.Visible=true; }

private void menuItem5_Click(object sender, System.EventArgs e) { if(menuItem5.Checked) { menuItem5.Checked=false; } else { menuItem5.Checked=true; } TBox.ReadOnly=menuItem5.Checked; }

private void menuItem4_Click(object sender, System.EventArgs e) { TBox.SelectAll(); }

private void notifyIcon1_Click(object sender, System.EventArgs e) { this.Show(); this.WindowState=FormWindowState.Normal; notifyIcon1.Visible=false; }

private void menuItem8_Click(object sender, System.EventArgs e) { this.Close(); }

private void menuItem9_Click(object sender, System.EventArgs e) { this.WindowState=FormWindowState.Normal; }

private void menuItem6_Click(object sender, System.EventArgs e) { FontDialog f = new FontDialog(); f.ShowApply=true; f.ShowColor=true; f.ShowEffects=true; f.Apply+=new EventHandler(f_Apply); if(f.ShowDialog()==DialogResult.OK) { TBox.SelectionColor=f.Color; TBox.SelectionFont=f.Font; } }

private void f_Apply(object sender, EventArgs e) { FontDialog f = (FontDialog )sender; TBox.SelectionColor=f.Color; TBox.SelectionFont=f.Font; }

private void menuItem7_Click(object sender, System.EventArgs e) { FontDialog f = new FontDialog(); f.ShowApply=true; f.ShowColor=true; f.ShowEffects=true; f.Apply+=new EventHandler(f_Apply2); if(f.ShowDialog()==DialogResult.OK) { TBox.SelectAll(); TBox.SelectionColor=f.Color; TBox.SelectionFont=f.Font; TBox.SelectionLength=0; } }

private void f_Apply2(object sender, EventArgs e) { FontDialog f = (FontDialog )sender; TBox.SelectAll(); TBox.SelectionColor=f.Color; TBox.SelectionFont=f.Font; TBox.SelectionLength=0; }

private void menuItem10_Click(object sender, System.EventArgs e) { OpenFileDialog f = new OpenFileDialog(); f.Title="请选择要打开的文件"; if(f.ShowDialog()==DialogResult.OK) { Fill(f.FileName); } } private void Fill(string FileName) { try { StreamReader r = new StreamReader(FileName); string T =null; this.Cursor=Cursors.WaitCursor; this.TBox.Cursor=Cursors.WaitCursor; while(r.Peek()!=-1) { T+=r.ReadToEnd(); } TBox.Text=T; this.Cursor=Cursors.Default; this.TBox.Cursor=Cursors.Default; } catch(System.Exception) { MessageBox.Show("此文件不可读","错误",MessageBoxButtons.OK,MessageBoxIcon.Information); } }

private void menuItem11_Click(object sender, System.EventArgs e) { FontDialog f = new FontDialog(); f.ShowApply=false;; f.ShowColor=true; f.ShowEffects=true; if(f.ShowDialog()==DialogResult.OK) { TBox.Font=f.Font; TBox.ForeColor=f.Color; } }

private void panel4_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { press = true;x=e.X;y=e.Y; }

private void panel4_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { press = false; }

private void panel4_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if(!press)return; this.Left+=e.X-x; this.Top+=e.Y-y; }

private void splitter1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { press2=true; x2=e.X;y2=e.Y; }

private void splitter1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { press2=false; }

private void splitter1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if(press2) { this.Width+=e.X-x2; this.Height+=e.Y-y2; } }

} }


寻求挑战,追求完美 Oh,my god!
2005-05-21 23:49
houyunqing
Rank: 1
等 级:新手上路
帖 子:476
专家分:0
注 册:2005-4-1
收藏
得分:0 
做一件非常无耻的事:如果你真的想要一个非常经典的记事本,我可以送你一个,前提是:
你认我为大哥~~哈哈哈哈~别骂我啊~~(我9号才满14岁的,你敢叫吗?)
放心,只要你叫了,我绝对送你个精品,而且绝对比Notepad.exe强很多!

寻求挑战,追求完美 Oh,my god!
2005-05-22 00:01
live41
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:67
帖 子:12442
专家分:0
注 册:2004-7-22
收藏
得分:0 
好,14岁就有傲气,我喜欢!

不过我不会叫你大哥,我比你大7岁。
2005-05-22 00:55
houyunqing
Rank: 1
等 级:新手上路
帖 子:476
专家分:0
注 册:2005-4-1
收藏
得分:0 
我是问求记事本程序的那个人啊~~
呼~又要上课了,如果你叫的话我可能也要一个星期以后才能给你了~

寻求挑战,追求完美 Oh,my god!
2005-05-22 16:52
快速回复:求记事本程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.041960 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved