社区
C#
帖子详情
chestnuts同志!我来做好事,你公布源码吧!
csharpsharper
2003-02-10 11:22:09
见上
...全文
24
2
打赏
收藏
chestnuts同志!我来做好事,你公布源码吧!
见上
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
xxj
2003-03-17
打赏
举报
回复
做的已经很好!
但是:
1、不区分关键词是否在字符串内的,每一种开发语言认为字符串都不一样
2、若关键词包含两个单词时:如:SQL 中的关键词 order by,
我输入ORDER BY (中间含有多个空格或者换行,就有问题)
chestnuts
2003-02-10
打赏
举报
回复
好!
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication10
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private int bootIndex=0;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Panel panel2;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// richTextBox1
//
this.richTextBox1.AutoSize = true;
this.richTextBox1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.RightMargin = 100;
this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedHorizontal;
this.richTextBox1.Size = new System.Drawing.Size(448, 308);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "well well";
this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged);
//
// button1
//
this.button1.Location = new System.Drawing.Point(112, 16);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(16, 16);
this.button2.Name = "button2";
this.button2.TabIndex = 2;
this.button2.Text = "button2";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// panel1
//
this.panel1.Location = new System.Drawing.Point(400, 248);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(16, 16);
this.panel1.TabIndex = 4;
this.panel1.Visible = false;
//
// label2
//
this.label2.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(0)));
this.label2.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label2.Location = new System.Drawing.Point(80, 240);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(296, 16);
this.label2.TabIndex = 5;
this.label2.Text = "the Key:\"me\",\"you\",\"and\",\"Lucy\",\"hehui\",\"heli\"";
//
// panel2
//
this.panel2.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.panel2.AutoScroll = true;
this.panel2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.richTextBox1});
this.panel2.Location = new System.Drawing.Point(0, 48);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(448, 308);
this.panel2.TabIndex = 6;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(448, 358);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.panel2,
this.label2,
this.panel1,
this.button2,
this.button1});
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
this.richTextBox1.SaveFile("e:/12.rtf");
}
private void button2_Click(object sender, System.EventArgs e)
{
this.richTextBox1.SelectionColor=Color.Red;
}
private void richTextBox1_TextChanged(object sender, System.EventArgs e)
{
this.panel1.Select();
this.richTextBox1.HideSelection=true;
AllLines();
this.richTextBox1.Focus();
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private void AllLines()
{
String[] key={"me","you","and","Lucy","hehui","heli"};
bootIndex=this.richTextBox1.SelectionStart;
this.richTextBox1.SelectAll();
this.richTextBox1.SelectionColor=Color.Black;
this.richTextBox1.Select(bootIndex,0);
int length=this.richTextBox1.TextLength;
foreach(string keyword in key)
{
int start=this.richTextBox1.Find(keyword,RichTextBoxFinds.WholeWord|RichTextBoxFinds.NoHighlight);
while(start!=-1)
{
this.richTextBox1.Select(start,keyword.Length);
this.richTextBox1.SelectionColor=Color.Red;
this.richTextBox1.Select(start+keyword.Length,1);
this.richTextBox1.SelectionColor=Color.Black;
start=this.richTextBox1.Find(keyword,start+keyword.Length,RichTextBoxFinds.WholeWord|RichTextBoxFinds.NoHighlight);
if(start+keyword.Length>=length)//如果是最后打的的解决办法
{
this.richTextBox1.Select(start,keyword.Length);
this.richTextBox1.SelectionColor=Color.Red;
this.richTextBox1.Select(start+keyword.Length,0);
this.richTextBox1.SelectionColor=Color.Black;
break;
}
}
}
this.richTextBox1.Select(bootIndex,0);
}
}
}
Recognition of Mouldy
Chestnuts
Based on Canny Operator
基于Canny算子的霉变板栗识别,汪成龙,李小昱,由于霉变板栗严重影响了板栗的品质,亟待研究出一种快速准确的无损板栗分选方法。本文探讨了近红外光谱技术在板栗分级中的应用,
leetcode被墙-
chestnuts
:面试谜题
leetcode被墙栗子 对于有时在技术面试中提出的栗子问题,一些普通到中等的解决方案。 没有试图变得聪明。 这基本上就像我在面试时所做的那样。 - 返回前 N 个斐波那契数 - 经典的“嘶嘶声”问题 - 级联逻辑测试正确性 - 找出一个数字是否是另一个数字的幂 - 是否存在通过图形的路径 - 报告 N 个整数中的每一个是否为素数 - 冒泡排序算法的实现 - 使用正则表达式过滤数据行 - 硬币 C 可以给出多少种改变 N 的方法 每个问题都在一个旨在接受命令行输入的 C++ 文件中解决 - 因为这就是这些技术面试问题的框架。 字符串函数 有一个包含一些基本字符串和实用程序功能的目录。 我确实对基本字符串解析的多种实现感到有些恼火(这在一些在线编码挑战中包含的框架代码中做得非常糟糕),因此为了清楚起见,将我自己的这些版本放入一个单独的包含目录中。 在一次采访中,我会把它放在代码之上。 单元测试 一些示例有点复杂,单独检查并不能很好地指导正确性。 出于这个原因,我在大多数示例中都包含了单元测试,即使我在面试环境中从来没有时间这样做。 测试使用它作为头文件简单地包含在此处。 如果测试通过,结
关于历史的成语故事.docx
关于历史的成语故事.docx
精编星火30篇文章贯通考研词汇资料.pdf
精编星火30篇文章贯通考研词汇资料.pdf
2015年高中英语基础知识短语的讲解与训练
2015年高中英语基础知识短语的讲解与训练
C#
111,111
社区成员
642,556
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章