测试语法高亮的 C# 代码的 html fragment 生成
测试语法高亮的 C# 代码的 html fragment 生成:
用csdn blog API 发布.
下面是:
public class HtmlWriter
{
static Dictionary _colors;
static int _colorNum;
static StringBuilder _colorString;
///
///
///
///
///
public static string GenerateRtf(TextArea textArea)
{
_colors = new Dictionary();
_colorNum = 0;
_colorString = new StringBuilder();
StringBuilder htmlBuilder = new StringBuilder();
htmlBuilder.AppendLine("");
string fileContent = BuildFileContent(textArea);
//htmlBuilder.Append(@"\viewkind4\uc1\pard");
htmlBuilder.Append(fileContent);
htmlBuilder.AppendLine("");
return htmlBuilder.ToString();
}
static string BuildFileContent(TextArea textArea)
{
StringBuilder htmlBuilder = new StringBuilder();
foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) {
int selectionOffset = textArea.Document.PositionToOffset(selection.StartPosition);
int selectionEndOffset = textArea.Document.PositionToOffset(selection.EndPosition);
相关文档:
一直没有找到一种好的方法来引用有返回值的存储过程的方法,使我在添加数据中走了不少的弯路,最近,在查阅了大量的资料之后,终于在微软的一个实例中找到了一种良好的方法。
首先编写好一有返回值的存储过程
create procedure proc_name
@para1 nchar(20), --输入参数
@ ......
这些天因为工作需要,要将一些html文件转换为chm文件,当然是需要和程序结合在一起。
后来找到NDoc,里头有一段代码是相关的,于是开始分析代码,写完之后,总结:主要是利用微软的hhc.exe来编译html文件,程序需要将具体的数据写入hhp和hhc文件。
主要代码如下:
复制C#代码保存代码public void CompileProject()
{ ......
在网上搜寻到2中解决方案:
1.其实只要在表格控制中添加一句
<td style="word-break:break-all">就搞定了。
其中可能对英文换行可能会分开一个单词问题:解决如下:
语法:
word-break : normal | break-all | keep-all
参数:
normal : 依照亚洲语言和非亚洲语言的文本规则,允许在字内换行
break-all ......
=======<html:messages>============
Action 中 :
ActionMessages message = new ActionMessages();
message.add(" 消息句柄 ",new ActionMessage(" 资源文件中 Key 值 ",String 类型描述信息 ));
this.addMessages(request,message);
......
一般事件:
onClick HTML: 鼠标点击事件,多用在某个对象控制的范围内的鼠标点击
onDblClick HTML: 鼠标双击事件
onMouseDown HTML: 鼠标上的按钮被按下了
onMouseUp HTML: 鼠标按下后,松开时激发的事件
onMouseOver HTML: 当鼠标移动到某对象范围的上方时触发的事件
onMouseMove HTML: 鼠标移动时触发的事件
onMous ......