C#编写记事本(高仿)

近一周写的关于记事本的代码,高仿记事本。本人C#入门不久,其中存在代码冗余,但懒得修改了。

经测试运行正常。

一、主窗体设计及代码

  1 namespace BestEditor
  2 {
  3     public partial class Main : Form
  4     {
  5         private bool isTextChanged;
  6         private string path;//记录文件路径(刚新建的文件路径为"",打开的文件路径为原路径)
  7
  8         public Main()
  9         {
 10             InitializeComponent();
 11             this.Text = "无标题 - 记事本";
 12             path = "";
 13         }
 14
 15         /// <summary>
 16         /// 初始化窗体时调用
 17         /// </summary>
 18         /// <param name="sender"></param>
 19         /// <param name="e"></param>
 20         private void Main_Load(object sender, EventArgs e)
 21         {
 22             //初始化,撤销、剪切、复制、删除 不可用
 23             撤消UToolStripMenuItem.Enabled = false;
 24             剪切TToolStripMenuItem.Enabled = false;
 25             复制CToolStripMenuItem.Enabled = false;
 26             删除LToolStripMenuItem.Enabled = false;
 27
 28             if (richTextBoxBoard.Equals(""))
 29             {
 30                 查找FToolStripMenuItem.Enabled = false;
 31                 查找下一个NToolStripMenuItem.Enabled = false;
 32             }
 33             else
 34             {
 35                 查找FToolStripMenuItem.Enabled = true;
 36                 查找下一个NToolStripMenuItem.Enabled = true;
 37             }
 38
 39             if (Clipboard.ContainsText())
 40                 粘贴PToolStripMenuItem.Enabled = true;
 41             else
 42                 粘贴PToolStripMenuItem.Enabled = false;
 43
 44             toolStripStatusLabel2.Text = "第 1 行,第 1 列";
 45         }
 46
 47         private void 新建NToolStripMenuItem_Click(object sender, EventArgs e)
 48         {
 49             //如果输入框文字发生变动
 50             if (isTextChanged)
 51             {
 52                 saveFileDialog1.FileName = "*.txt";
 53                 DialogResult dr = MessageBox.Show("是否将更改保存到 " + this.Text + "?", "记事本",
 54                     MessageBoxButtons.YesNoCancel);
 55                 if (dr == DialogResult.Yes)
 56                 {
 57                     //获取或设置指定要在 SaveFileDialog 中显示的文件类型和说明的筛选器字符串
 58                     saveFileDialog1.Filter = @"文本文档(*.txt)|*.txt|所有格式|*.txt;*.doc;*.cs;*.rtf;*.sln";
 59                     if (saveFileDialog1.ShowDialog() == DialogResult.OK)
 60                     {
 61                         richTextBoxBoard.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
 62                         richTextBoxBoard.Text = "";
 63                         path = "";
 64                     }
 65                 }
 66                 else if(dr == DialogResult.No)
 67                 {
 68                     richTextBoxBoard.Text = "";
 69                     path = "";
 70                 }
 71             }
 72             else
 73             {
 74                 richTextBoxBoard.Text = "";
 75                 this.Text = "无标题 - 记事本";
 76                 path = "";
 77             }
 78         }
 79
 80         /// <summary>
 81         /// 输入框发生变化时触发
 82         /// </summary>
 83         /// <param name="sender"></param>
 84         /// <param name="e"></param>
 85         private void richTextBoxBoard_TextChanged(object sender, EventArgs e)
 86         {
 87             isTextChanged = true;
 88         }
 89
 90         private void 打开OToolStripMenuItem_Click(object sender, EventArgs e)
 91         {
 92             if (isTextChanged)
 93             {
 94                 saveFileDialog1.FileName = "*.txt";
 95                 DialogResult dr = MessageBox.Show("是否将更改保存到 " + this.Text + "?", "记事本",
 96                     MessageBoxButtons.YesNoCancel);
 97                 if (dr == DialogResult.Yes)
 98                 {
 99                     //获取或设置指定要在 SaveFileDialog 中显示的文件类型和说明的筛选器字符串
100                     saveFileDialog1.Filter = @"文本文档(*.txt)|*.txt|所有格式|*.txt;*.doc;*.cs;*.rtf;*.sln";
101                     if (saveFileDialog1.ShowDialog() == DialogResult.OK)
102                     {
103                         richTextBoxBoard.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
104                         Text = saveFileDialog1.FileName.Substring(saveFileDialog1.FileName.LastIndexOf("\\")+1)+
105                             " - 记事本";
106                     }
107                 }
108             }
109
110             openFileDialog1.FileName = "";
111
112             if (openFileDialog1.ShowDialog() == DialogResult.OK)
113             {
114                 path = openFileDialog1.FileName;
115                 Text = path.Substring(path.LastIndexOf("\\") + 1) + " - 记事本";
116                 Console.WriteLine("path={0}",path);
117                 richTextBoxBoard.LoadFile(path, RichTextBoxStreamType.PlainText);
118                 isTextChanged = false;
119             }
120         }
121
122         private void 保存SToolStripMenuItem_Click(object sender, EventArgs e)
123         {
124             if (!("".Equals(path)))
125             {
126                 richTextBoxBoard.SaveFile(path, RichTextBoxStreamType.PlainText);
127                 isTextChanged = false;
128             }
129             else
130             {
131                 saveFileDialog1.Filter = @"文本文档(*.txt)|*.txt|所有格式|*.txt;*.doc;*.cs;*.rtf;*.sln";
132                 if (saveFileDialog1.ShowDialog() == DialogResult.OK)
133                 {
134                     richTextBoxBoard.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
135                     path = saveFileDialog1.FileName;
136                     this.Text = path.Substring(path.LastIndexOf("\\") + 1) + " - 记事本";
137                     isTextChanged = false;
138                 }
139             }
140         }
141
142         private void 另存为AToolStripMenuItem_Click(object sender, EventArgs e)
143         {
144             saveFileDialog1.Filter = @"文本文档(*.txt)|*.txt|所有格式|*.txt;*.doc;*.cs;*.rtf;*.sln";
145             if (saveFileDialog1.ShowDialog() == DialogResult.OK)
146             {
147                 richTextBoxBoard.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
148                 path = saveFileDialog1.FileName;
149                 this.Text = path.Substring(path.LastIndexOf("\\") + 1) + " - 记事本";
150                 isTextChanged = false;
151             }
152         }
153
154         private void 页面设置UToolStripMenuItem_Click(object sender, EventArgs e)
155         {
156             pageSetupDialog1.Document = printDocument1;
157             pageSetupDialog1.ShowDialog();
158         }
159
160         private void 打印PToolStripMenuItem_Click(object sender, EventArgs e)
161         {
162             printDialog1.Document = printDocument1;
163             printDialog1.ShowDialog();
164         }
165
166         private void 退出XToolStripMenuItem_Click(object sender, EventArgs e)
167         {
168             this.Close();
169         }
170
171         private void 撤消UToolStripMenuItem_Click(object sender, EventArgs e)
172         {
173             richTextBoxBoard.Undo();
174         }
175
176         private void 编辑EToolStripMenuItem_Click(object sender, EventArgs e)
177         {
178             if (richTextBoxBoard.CanUndo)
179                 撤消UToolStripMenuItem.Enabled = true;
180
181             if (richTextBoxBoard.SelectionLength > 0)
182             {
183                 剪切TToolStripMenuItem.Enabled = true;
184                 复制CToolStripMenuItem.Enabled = true;
185                 删除LToolStripMenuItem.Enabled = true;
186             }
187             else
188             {
189                 剪切TToolStripMenuItem.Enabled = false;
190                 复制CToolStripMenuItem.Enabled = false;
191                 删除LToolStripMenuItem.Enabled = false;
192             }
193
194             if (richTextBoxBoard.Equals(""))
195             {
196                 查找FToolStripMenuItem.Enabled = false;
197                 查找下一个NToolStripMenuItem.Enabled = false;
198             }
199             else
200             {
201                 查找FToolStripMenuItem.Enabled = true;
202                 查找下一个NToolStripMenuItem.Enabled = true;
203             }
204
205             if (Clipboard.ContainsText())
206                 粘贴PToolStripMenuItem.Enabled = true;
207             else
208                 粘贴PToolStripMenuItem.Enabled = false;
209         }
210
211         private void 剪切TToolStripMenuItem_Click(object sender, EventArgs e)
212         {
213             richTextBoxBoard.Cut();
214         }
215
216         private void 复制CToolStripMenuItem_Click(object sender, EventArgs e)
217         {
218             richTextBoxBoard.Copy();
219         }
220
221         private void 粘贴PToolStripMenuItem_Click(object sender, EventArgs e)
222         {
223             richTextBoxBoard.Paste();
224         }
225
226         private void 删除LToolStripMenuItem_Click(object sender, EventArgs e)
227         {
228             richTextBoxBoard.SelectedText = "";
229         }
230
231         /// <summary>
232         /// 不同窗体之间通讯
233         /// </summary>
234         /// <param name="sender"></param>
235         /// <param name="e"></param>
236         private void 查找FToolStripMenuItem_Click(object sender, EventArgs e)
237         {
238             Search search = new Search();
239             search.Owner = this;
240             search.Show();
241         }
242
243         private void 查找下一个NToolStripMenuItem_Click(object sender, EventArgs e)
244         {
245             Search search = new Search();
246             search.Owner = this;
247             search.Show();
248         }
249
250         private void 替换RToolStripMenuItem_Click(object sender, EventArgs e)
251         {
252             Change change = new Change();
253             change.Owner = this;
254             change.Show();
255         }
256
257         private void 转到GToolStripMenuItem_Click(object sender, EventArgs e)
258         {
259             Goto gt = new Goto();
260             gt.Owner = this;
261             gt.Show();
262         }
263
264         private void 全选AToolStripMenuItem_Click(object sender, EventArgs e)
265         {
266             richTextBoxBoard.SelectAll();
267         }
268
269         private void 时间日期DToolStripMenuItem_Click(object sender, EventArgs e)
270         {
271             string front = richTextBoxBoard.Text.Substring(0, richTextBoxBoard.SelectionStart);
272             string back = richTextBoxBoard.Text.Substring(richTextBoxBoard.SelectionStart,
273                 richTextBoxBoard.Text.Length - richTextBoxBoard.SelectionStart);
274             richTextBoxBoard.Text = front + DateTime.Now.ToString() + back;
275         }
276
277         private void 自动换行WToolStripMenuItem_Click(object sender, EventArgs e)
278         {
279             if (richTextBoxBoard.WordWrap)
280             {
281                 自动换行WToolStripMenuItem.Checked = false;
282                 richTextBoxBoard.WordWrap = false;
283             }
284             else
285             {
286                 自动换行WToolStripMenuItem.Checked = true;
287                 richTextBoxBoard.WordWrap = true;
288             }
289         }
290
291         private void 字体FToolStripMenuItem_Click(object sender, EventArgs e)
292         {
293             fontDialog1.ShowDialog();
294             richTextBoxBoard.SelectionFont = fontDialog1.Font;
295         }
296
297         /// <summary>
298         /// 控制底部状态栏显示与否
299         /// </summary>
300         /// <param name="sender"></param>
301         /// <param name="e"></param>
302         private void 状态栏SToolStripMenuItem_Click(object sender, EventArgs e)
303         {
304             if (状态栏SToolStripMenuItem.Checked)
305             {
306                 状态栏SToolStripMenuItem.Checked = false;
307                 statusStrip1.Visible = false;
308             }
309             else
310             {
311                 状态栏SToolStripMenuItem.Checked = true;
312                 statusStrip1.Visible = true;
313             }
314         }
315
316         /// <summary>
317         /// 输入框光标位置变化时触发
318         /// </summary>
319         /// <param name="sender"></param>
320         /// <param name="e"></param>
321         private void richTextBoxBoard_SelectionChanged(object sender, EventArgs e)
322         {
323             string[] str = richTextBoxBoard.Text.Split(‘\r‘, ‘\n‘);
324             int row = 1, column = 1, pos = richTextBoxBoard.SelectionStart;
325
326             foreach(string s in str)
327                 Console.WriteLine(s);
328             Console.WriteLine("pos={0}",pos);
329
330             for (int i = 0; pos - str[i].Length > 0; i++)
331             {
332                 pos = pos - str[i].Length - 1;
333                 row = i + 2;
334             }
335             column = pos + 1;
336             toolStripStatusLabel2.Text = "第 " + row + " 行,第 " + column + " 列";
337         }
338
339         private void 关于记事本AToolStripMenuItem_Click(object sender, EventArgs e)
340         {
341             AboutBox ab = new AboutBox();
342             ab.Show();
343         }
344
345         private void 查看帮助HToolStripMenuItem_Click(object sender, EventArgs e)
346         {
347             //调用系统内部的notepad.chm文件
348         }
349
350         /// <summary>
351         /// 点击窗体右上角关闭按钮触发
352         /// </summary>
353         /// <param name="sender"></param>
354         /// <param name="e"></param>
355         private void Main_FormClosing(object sender, FormClosingEventArgs e)
356         {
357             if (isTextChanged)
358             {
359                 if (!("".Equals(path)))
360                 {
361                     DialogResult dr = MessageBox.Show("是否将更改保存到"+path+"?","记事本",
362                         MessageBoxButtons.YesNoCancel);
363                     if (dr == DialogResult.Yes)
364                         richTextBoxBoard.SaveFile(path, RichTextBoxStreamType.PlainText);
365                     else if (dr == DialogResult.No)
366                         e.Cancel = false;
367                     else
368                         e.Cancel = true;//不关闭
369                 }
370                 else
371                 {
372                     DialogResult dr = MessageBox.Show("是否将更改保存到 无标题?", "记事本",
373                         MessageBoxButtons.YesNoCancel);
374                     if (dr == DialogResult.Yes)
375                     {
376                         saveFileDialog1.Filter = @"文本文档(*.txt)|*.txt|所有格式|*.txt;*.doc;*.cs;*.rtf;*.sln";
377                         if (saveFileDialog1.ShowDialog() == DialogResult.OK)
378                             richTextBoxBoard.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
379                         else
380                             e.Cancel = true;
381                     }
382                     else if (dr == DialogResult.No)
383                         e.Cancel = false;
384                     else
385                         e.Cancel = true;
386                 }
387             }
388         }
389     }
390 }

二、查找子窗体设计及代码

 1 namespace BestEditor
 2 {
 3     public partial class Search : Form
 4     {
 5         private RichTextBox rtb = new RichTextBox();
 6
 7         public Search()
 8         {
 9             InitializeComponent();
10         }
11
12         /// <summary>
13         /// 初始化时得到主窗口的通讯数据
14         /// </summary>
15         /// <param name="sender"></param>
16         /// <param name="e"></param>
17         private void Search_Load(object sender, EventArgs e)
18         {
19             Main main = (Main)this.Owner;
20             this.rtb = main.richTextBoxBoard;
21         }
22
23         /// <summary>
24         /// 取消
25         /// </summary>
26         /// <param name="sender"></param>
27         /// <param name="e"></param>
28         private void button2_Click(object sender, EventArgs e)
29         {
30             this.Close();
31         }
32
33         private void button1_Click(object sender, EventArgs e)
34         {
35             string str = rtb.Text;//文件内容
36             string subSearch = textBox1.Text;//查找内容
37             string initString = subSearch;
38             int pos = rtb.SelectionStart;//光标位置
39
40             if (!checkBox1.Checked)
41             {
42                 str = str.ToLower();
43                 subSearch = subSearch.ToLower();
44             }
45
46             if (radioButton1.Checked)//向上查找
47             {
48                 if (rtb.SelectionLength > 0)
49                     pos = pos + rtb.SelectionLength - 1;
50
51                 str = str.Substring(0, pos);
52                 if (subSearch != "" && (pos = str.LastIndexOf(subSearch, pos)) != -1)
53                 {
54                     //输入框得到焦点并选中查找的内容
55                     rtb.Focus();
56                     rtb.SelectionStart = pos;
57                     rtb.SelectionLength = subSearch.Length;
58                 }
59                 else
60                     MessageBox.Show("找不到\"" + initString + "\"", "记事本",
61                         MessageBoxButtons.OK, MessageBoxIcon.Information);
62             }
63             else
64             {
65                 if (rtb.SelectionLength > 0)
66                     pos = pos + 1;
67                 if (subSearch != "" && (pos = str.IndexOf(subSearch, pos)) != -1)
68                 {
69                     rtb.Focus();
70                     rtb.SelectionStart = pos;
71                     rtb.SelectionLength = subSearch.Length;
72                 }
73                 else
74                     MessageBox.Show("找不到\"" + subSearch + "\"", "记事本",
75                         MessageBoxButtons.OK, MessageBoxIcon.Information);
76             }
77         }
78     }
79 }

三、替换子窗体设计及其代码

  1 namespace BestEditor
  2 {
  3     public partial class Change : Form
  4     {
  5         private RichTextBox rtb = new RichTextBox();
  6
  7         public Change()
  8         {
  9             InitializeComponent();
 10         }
 11
 12         private void Change_Load(object sender, EventArgs e)
 13         {
 14             Main main = (Main)this.Owner;
 15             this.rtb = main.richTextBoxBoard;
 16             button1.Enabled = false;
 17             button2.Enabled = false;
 18             button3.Enabled = false;
 19         }
 20
 21         /// <summary>
 22         /// 查找下一个
 23         /// </summary>
 24         /// <param name="sender"></param>
 25         /// <param name="e"></param>
 26         private void button1_Click(object sender, EventArgs e)
 27         {
 28             string str = rtb.Text;
 29             string subSearch = textBox1.Text;
 30             string initString = subSearch;
 31             int pos = rtb.SelectionStart;
 32
 33             if (!checkBox1.Checked)
 34             {
 35                 str = str.ToLower();
 36                 subSearch = subSearch.ToLower();
 37             }
 38
 39             if (rtb.SelectionLength > 0)
 40                 pos = pos + 1;
 41             if ((pos = str.IndexOf(subSearch, pos)) != -1)
 42             {
 43                 rtb.Focus();
 44                 rtb.SelectionStart = pos;
 45                 rtb.SelectionLength = subSearch.Length;
 46             }
 47             else
 48                 MessageBox.Show("找不到\"" + initString + "\"", "记事本",
 49                     MessageBoxButtons.OK, MessageBoxIcon.Information);
 50         }
 51
 52         private void textBox1_TextChanged(object sender, EventArgs e)
 53         {
 54             bool flag = textBox1.Text != "";
 55             button1.Enabled = flag;
 56             button2.Enabled = flag;
 57             button3.Enabled = flag;
 58         }
 59
 60         /// <summary>
 61         /// 取消
 62         /// </summary>
 63         /// <param name="sender"></param>
 64         /// <param name="e"></param>
 65         private void button4_Click(object sender, EventArgs e)
 66         {
 67             this.Close();
 68         }
 69
 70         /// <summary>
 71         /// 替换
 72         /// </summary>
 73         /// <param name="sender"></param>
 74         /// <param name="e"></param>
 75         private void button2_Click(object sender, EventArgs e)
 76         {
 77             string str = rtb.Text;
 78             string subSearch = textBox1.Text;
 79             string initString = subSearch;
 80             string changeTo = textBox2.Text;
 81             string front;
 82             string dest;
 83             string back;
 84             int pos = rtb.SelectionStart;
 85
 86             if (!checkBox1.Checked)
 87             {
 88                 str = str.ToLower();
 89                 subSearch = subSearch.ToLower();
 90             }
 91
 92             if (rtb.SelectionLength > 0)
 93             {
 94                 if (rtb.SelectedText.Equals(subSearch))
 95                 {
 96                     //将文本框字符串分段,替换后再组合
 97                     front = rtb.Text.Substring(0,pos);
 98                     dest = changeTo;
 99                     back = rtb.Text.Substring(pos + subSearch.Length, rtb.Text.Length - pos - subSearch.Length);
100                     rtb.Text = front + dest + back;
101                 }
102                 pos = pos + 1;
103             }
104
105             if ((pos = str.IndexOf(subSearch, pos)) != -1)
106             {
107                 rtb.Focus();
108                 rtb.SelectionStart = pos;
109                 rtb.SelectionLength = subSearch.Length;
110             }
111             else
112                 MessageBox.Show("找不到\"" + initString + "\"", "记事本",
113                     MessageBoxButtons.OK, MessageBoxIcon.Information);
114         }
115
116         /// <summary>
117         /// 全部替换
118         /// </summary>
119         /// <param name="sender"></param>
120         /// <param name="e"></param>
121         private void button3_Click(object sender, EventArgs e)
122         {
123             string str = rtb.Text;
124             string subSearch = textBox1.Text;
125             string changeTo = textBox2.Text;
126             string front;
127             string dest;
128             string back;
129             int pos = 0;
130
131             if (!checkBox1.Checked)
132             {
133                 str = str.ToLower();
134                 subSearch = subSearch.ToLower();
135             }
136
137             while ((pos=str.IndexOf(subSearch,pos))!=-1)
138             {
139                 front = rtb.Text.Substring(0, pos);
140                 dest = changeTo;
141                 back = rtb.Text.Substring(pos + subSearch.Length, rtb.Text.Length - pos - subSearch.Length);
142                 rtb.Text = front + dest + back;
143                 if (!checkBox1.Checked)
144                     str = rtb.Text.ToLower();
145             }
146         }
147     }
148 }

四、转到子窗体设计及其代码

 1 namespace BestEditor
 2 {
 3     public partial class Goto : Form
 4     {
 5         private RichTextBox rtb = new RichTextBox();
 6
 7         public Goto()
 8         {
 9             InitializeComponent();
10         }
11
12         private void Goto_Load(object sender, EventArgs e)
13         {
14             Main main = (Main)this.Owner;
15             this.rtb = main.richTextBoxBoard;
16         }
17
18         private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
19         {
20             if ((e.KeyChar < 48 || e.KeyChar > 57) && e.KeyChar != 8 && e.KeyChar != 13)
21             {
22                 e.Handled = true;
23                 MessageBox.Show("只能接收数字","记事本",MessageBoxButtons.OK,MessageBoxIcon.Error);
24             }
25         }
26
27         private void button2_Click(object sender, EventArgs e)
28         {
29             this.Close();
30         }
31
32         /// <summary>
33         /// 确定
34         /// </summary>
35         /// <param name="sender"></param>
36         /// <param name="e"></param>
37         private void button1_Click(object sender, EventArgs e)
38         {
39             int row = int.Parse(textBox1.Text);
40             int pos = 0;
41             string[] str = rtb.Text.Split(‘\r‘, ‘\n‘);
42
43             if (row < 1|| row > str.Length)
44                 MessageBox.Show("行数超出范围", "记事本 - 跳行", MessageBoxButtons.OK);
45             else
46             {
47                 for (int i = 1; i < row; i++)
48                     pos = pos + str[i-1].Length + 1;
49                 this.Close();
50                 rtb.Focus();
51                 rtb.SelectionStart = pos;
52             }
53         }
54     }
55 }

五、“关于”对话框

直接插入“关于”对话框即可

Ps:

编写过程中有参考到以下代码:http://blog.csdn.net/mathewsking/article/details/3645753,在此谢谢博主的思路启发!

时间: 2024-11-07 14:49:59

C#编写记事本(高仿)的相关文章

浅谈android中仅仅使用一个TextView实现高仿京东,淘宝各种倒计时

今天给大家带来的是仅仅使用一个TextView实现一个高仿京东.淘宝.唯品会等各种电商APP的活动倒计时.最近公司一直加班也没来得及时间去整理,今天难得休息想把这个分享给大家,只求共同学习,以及自己后续的复习.为什么会想到使用一个TextView来实现呢?因为最近公司在做一些优化的工作,其中就有一个倒计时样式,原来开发的这个控件的同事使用了多个TextView拼接在一起的,实现的代码冗余比较大,故此项目经理就说:小宏这个就交给你来优化了,并且还要保证有一定的扩展性,当时就懵逼了.不知道从何处开始

浅谈android中只使用一个TextView实现高仿京东,淘宝各种倒计时

今天给大家带来的是只使用一个TextView实现一个高仿京东.淘宝.唯品会等各种电商APP的活动倒计时.近期公司一直加班也没来得及时间去整理,今天难得歇息想把这个分享给大家.只求共同学习,以及自己兴许的复习. 为什么会想到使用一个TextView来实现呢?由于近期公司在做一些优化的工作,当中就有一个倒计时样式,原来开发的这个控件的同事使用了多个TextView拼接在一起的.实现的代码冗余比較大.故此项目经理就说:小宏这个就交给你来优化了.而且还要保证有一定的扩展性,当时就懵逼了.不知道从何处開始

利用JQ实现的,高仿 彩虹岛官网导航栏(学习HTML过程中的小记录)

利用JQ实现的,高仿 彩虹岛官网导航栏(学习HTML过程中的小记录)   作者:王可利(Star·星星) 总结: 今天学习的jQ类库的使用,代码重复的比较多需要完善.严格区分大小写,在 $("").css()   这里css是小写的,用 HBuilder 编写补全是大写的..这里要注意 主要使用的方法:jQuery 隐藏 / 显示    jQuery 淡出淡入 需要注意的知识点: 效果的样式: 代码如下:(亲们 自己展开拉~) 1 <!DOCTYPE html> 2 <

Android ActionBar应用实战,高仿微信主界面的设计

转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/26365683 经过前面两篇文章的学习,我想大家对ActionBar都已经有一个相对较为深刻的理解了.唯一欠缺的是,前面我们都只是学习了理论知识而已,虽然知识点已经掌握了,但是真正投入到项目实战当中时会不会掉链子还很难说.那么不用担心,本篇文章我就将带领大家一起进入ActionBar的应用实战,将理论和实践完美结合到一起. 如果你还没有看过我的前两篇文章,建议先去阅读一下 Andr

Android DrawerLayout 高仿QQ5.2双向侧滑菜单

1.概述 之前写了一个Android 高仿 QQ5.0 侧滑菜单效果 自定义控件来袭 ,恰逢QQ5.2又加了一个右侧菜单,刚好看了下DrawerLayout,一方面官方的东西,我都比较感兴趣:另一方面,这玩意用起来的确方便,于是简单写了个demo,高仿QQ5.2双向侧滑,分享给大家. 首先看看效果图: DrawerLayout用起来真的很方便,下面一起看看用法~ 2.DrawerLayout的使用 直接将DrawerLayout作为根布局,然后其内部第一个View为内容区域,第二个View为左侧

高仿Entity Framework?Linq to SQL也有春天!

开发这个框架,主要起源于有很多使用ALinq或者Linq to SQL的用户,经常向我抱怨,它们使用起来的确很爽,但是动态查询太让人纠结了.这个框架主要就是想解决客户碰到的动态查询的问题.至今为至,已经断断续续地写了一年多了,写这个框架,充满了挑战与乐趣.当然,现在更觉得,能把文档写好,更是挑战.大多数的程序员,一直对于写文档这码事,不大重视,我也是其中的一员.但是,长期地与客户打交道,让我认识到,文档是非常地重要的,而且,能把文档写好也不是件容易的事情.这次的发布,更多的精力放在了文档的编写上

Android 教你打造炫酷的ViewPagerIndicator 不仅仅是高仿MIUI

1.概述 哈,今天给大家带来一个ViewPagerIndicator的制作,相信大家在做tabIndicator的时候,大多数人都用过 TabPageIndicator,并且很多知名APP都使用过这个开源的指示器.大家有没有想过如何自己去实现这样的一个指示器,并且代码会有多复杂 呢~~~今天,我就带领大家来从无到有的实现这样一个指示器,当然了,不准备一模一样,搞得没有创新似的,再看标题,跟MIUI相关,所以我们准备做一个 特性与TabPageIndicator一致的,但是样子和MIUI的Tab一

iOS新闻应用源码,高仿今日头条源码等

iOS精选源码 城市列表选择 一款非常时尚的照片选择插件 优酷播放按钮动画 BRPickerView是iOS的选择器组件,主要包括:日期选择器.时... 选择位置坐下动画Demo BAButton 图片.文字.倒计时等 git 功能最全的 button 分类 企业级完整iOS项目-<新闻来了> 较为美观的多级展开列表 高仿今日头条6.2.6 Swift 简单画板的swift实现 iOS优质博客 创建一个私有的 Pods 详解 前言骚年,你听说过组件化吗?没有?但你一定玩过乐高玩具,乐高玩具本身

AndroidDrawerLayout高仿QQ52双向侧滑菜单(转载)

AndroidDrawerLayout高仿QQ52双向侧滑菜单 转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/41531475,本文出自:[张鸿洋的博客] 1.概述 之前写了一个Android 高仿 QQ5.0 侧滑菜单效果 自定义控件来袭 ,恰逢QQ5.2又加了一个右侧菜单,刚好看了下DrawerLayout,一方面官方的东西,我都比较感兴趣:另一方面,这玩意用起来的确方便,于是简单写了个demo,高仿QQ5.2双向侧滑,分