社区
C#
帖子详情
chestnuts同志!我来做好事,你公布源码吧!
csharpsharper
2003-02-10 11:22:09
见上
...全文
20
2
打赏
收藏
chestnuts同志!我来做好事,你公布源码吧!
见上
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用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被墙栗子 对于有时在技术面试中提出的栗子问题,一些...出于这个原因,我在大多数示例中都包含了单元测试,即使我在面试环境中从来没有时间这样做。 测试使用它作为头文件简单地包含在此处。 如果测试通过,结
星火30篇文章贯通考研词汇
因生活困苦,我不得不离开家乡去外国打工。我把大部分钱都寄给了妻子和父母。然而不久,政府要求我们必须有工作许可证才能继续打工。后来,我们就遭遇到种种无理待遇…… I think the building must have been used ...
ascii_tree:解析ASCII艺术形式的可用树
ASCII树 解析ASCII艺术形式的可用树。 Ascii树将人类可以理解的东西变成了计算机可以理解的东西...
chestnuts
/ | \ roasting on an / \ \ open fire jack / \ frost nipping / | \ on your nose # Ouch! ' )
黑苹果efi b85-d2v + i7-4790
自己安装的黑苹果,折腾了很久,有一样设备的可以直接用,音频问题通过更改配置ID解决,里面没有boot文件,自己创建一个boot文件夹,然后把clover里面的CLOVERX64.efi改名为BOOTX64.efi放到刚刚创建的boot文件夹即可...
C#
110,536
社区成员
642,578
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章