delphi 7编写的代码查看编辑器对注释的着色
来源:互联网 发布:up to date数据库介绍 编辑:程序博客网 时间:2024/04/30 09:21
procedure TForm1.RichEdit1Change(Sender: TObject);var point: TPoint; x, x1, y, i, i1, i2, i3, i4, p: Integer; s1: string; pa: array[1..10] of char;begin (********鼠标位置和焦点位置保存*********) x := point.X; y := point.Y; x1 := RichEdit1.SelStart; (*对注释进行删除时,对注释删除后的前半部分恢复常规并且字体加黑设置,如:'(*'删除'*'后'('部分要恢复常规并且字体加黑*) i := 0; p := Length(RichEdit1.Text); RichEdit1.SelStart := i; RichEdit1.SelLength := p; RichEdit1.SelAttributes.Style := []; RichEdit1.SelAttributes.Color := clBlack;//变量赋初值 i := 0; i1 := 0; p := 0; ////////////////////////////////////////////////////////////////////////////// (*******注释"{"和"}"的渲染*************************) while p >= 0 do begin i := 0; p := 0; i := PosEx('{', RichEdit1.Text, i1) - 1; p := PosEx('}', RichEdit1.Text, i1); if i > 0 then begin if (p = 0) or (p < i) then begin p := Length(RichEdit1.Text); end; end; if p <> 0 then begin i1 := p + 1; s1 := (copy(RichEdit1.Text, i, 1)); pa[1] := s1[1]; if (not (pa[1] in [''''])) and (not (pa[1] in ['"'])) or (i < p) then begin RichEdit1.SelStart := i; RichEdit1.SelLength := p - i; Richedit1.SelAttributes.Color := clGreen; RichEdit1.SelAttributes.Style := [fsItalic]; end; end else Break; end; ////////////////////////////////////////////////////////////////////////////// //变量赋初值 i := 0; i1 := 0; p := 0; (*******注释"(*"和'*)"的渲染 ********************************************) while p >= 0 do begin i := 0; p := 0; i := PosEx('(*', RichEdit1.Text, i1) - 1; p := PosEx('*)', RichEdit1.Text, i1); if i > 0 then begin if (p = 0) or (p < i) then begin p := Length(RichEdit1.Text); end; end; if p <> 0 then begin i1 := p + 2; s1 := (copy(RichEdit1.Text, i, 1)); pa[1] := s1[1]; if (not (pa[1] in [''''])) and (not (pa[1] in ['"'])) or (i < p) then begin RichEdit1.SelStart := i; RichEdit1.SelLength := p - i + 1; Richedit1.SelAttributes.Color := clGreen; RichEdit1.SelAttributes.Style := [fsItalic]; end; end else Break; end;////////////////////////////////////////////////////////////////////////////////(********************(注释'//"的渲染)*****************************************) i := 0; i1 := 0; i2 := 0; i3 := 0; i4 := 0; p := 0; i := PosEx('//', RichEdit1.Text, i1); if i > 0 then begin while i > 0 do begin i3 := 0; i := PosEx('//', RichEdit1.Text, i1); i1 := i + 3; begin RichEdit1.SelStart := i - 1; i4 := SendMessage(Richedit1.handle, EM_LINEFROMCHAR, Richedit1.selstart, 0); if i4 >= 0 then begin for i2 := 0 to i4 do begin i3 := i3 + Length(RichEdit1.Lines[i2]) + 2; //DBRichEdit显示时用i3 := i3 + Length(RichEdit1.Lines[i2]); end; RichEdit1.SelLength := i3 - i; Richedit1.SelAttributes.Color := clGreen; RichEdit1.SelAttributes.Style := [fsItalic]; end; end; end; end; (********鼠标位置和焦点位置重新植入*******************************************) point.X := x; point.Y := y; RichEdit1.SelStart := x1; RichEdit1.SetFocus;end;
0 0
- delphi 7编写的代码查看编辑器对注释的着色
- delphi 7编写的代码查看编辑器对保留字的着色
- Delphi编辑器的“代码完成”功能
- 使用SyntaxHighlighter插件对网页上的代码着色
- Delphi当中的注释
- Android win7系统,Eclipse编写代码时,在sourceInsight中查看出现对不齐的问题
- 如何在 "万一的 Delphi 博客" 回复自动格式化的着色代码?
- Flash Builder的代码着色
- 代码着色,几乎可以定义任何语言的代码着色
- 代码编写中关于文件/函数注释的统一格式
- 编写可读代码的艺术读书笔记--审美与注释
- UltraEdit 的“查看方式”着色类项型
- 每天学习的重要性-对代码的注释看法
- 码农的自我修养-对代码注释的理解
- 孤帆代码着色器1.1.0.0(增加了对rtf格式的支持)
- 对着色器代码与纹理图优化的一些体会
- 对x264_param_t 的注释
- 对参数的注释
- 黑马程序员_基础知识(4)
- how to make PKG_CONFIG_PATH variable to refer an installed library?
- [经典]Linux内核中ioremap映射的透彻理解
- 黑马程序员_异常
- jsoup 学习笔记
- delphi 7编写的代码查看编辑器对注释的着色
- Opencv鼠标绘图程序
- 点双连通模版 求割点,点双缩点
- Rtmp协议简单分析(二)——协议交互过程
- 在VirtualBox中安装QTP10破解报CRC ERROR!
- CareerCup Eliminate all ‘b’ and ‘ac’ in an array of characters
- IOCP完成端口资料整理——"高大上",够全,够详细
- JavaMailSendTest
- Opencv轮廓检测