⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtfbox.vb

📁 专业的办公oa代码下载 c#语言编写 三层结构
💻 VB
📖 第 1 页 / 共 5 页
字号:
            mStr += "			table1.style.display = 'none';" & vbCrLf
            mStr += "			table2.style.display = 'none';	" & vbCrLf
            mStr += "			RTFEdit_" & Me.UniqueID & ".document.body.innerText = mTemp;	 " & vbCrLf
            mStr += "		}" & vbCrLf
            mStr += "		break;			" & vbCrLf

            mStr += "	case 'imgFontColor' :" & vbCrLf
            mStr += "		var oldcolor = GetEditBoxColor('forecolor');    		" & vbCrLf
            mStr += "		mCommand = 'forecolor';" & vbCrLf
            mStr += "		uInterface = false;" & vbCrLf
            mStr += "		vValue = GetColorFromUser(oldcolor);" & vbCrLf
            mStr += "		break;" & vbCrLf

            mStr += "	case 'imgHighLight' : " & vbCrLf
            mStr += "		var oldcolor = GetEditBoxColor('backcolor');    		" & vbCrLf
            mStr += "		mCommand = 'backcolor';" & vbCrLf
            mStr += "		uInterface = false;" & vbCrLf
            mStr += "		vValue = GetColorFromUser(oldcolor);		" & vbCrLf
            mStr += "		break;" & vbCrLf

            'TODO Insert Special Characters
            mStr += "	case 'imgSpecialChar' :" & vbCrLf
            mStr += "		alert ('Special Characters will be provided soon.');" & vbCrLf
            mStr += "		return;    		" & vbCrLf
            mStr += "		break;" & vbCrLf

            mStr += "	case 'imgSmile' :" & vbCrLf
            mStr += "		var posX    = event.screenX;" & vbCrLf
            mStr += "		var posY    = event.screenY + 20;" & vbCrLf
            mStr += "		var screenW = screen.width;                                 // screen size" & vbCrLf
            mStr += "		var screenH = screen.height - 20;                           // take taskbar into account" & vbCrLf
            mStr += "		//if (posX + 232 > screenW) { posX = posX - 232 - 40; }       // if mouse too far right" & vbCrLf
            mStr += "		//if (posY + 164 > screenH) { posY = posY - 164 - 80; }       // if mouse too far down" & vbCrLf
            mStr += "		var wPosition   = 'dialogLeft:' +posX+ '; dialogTop:' +posY;" & vbCrLf
            mStr += "		var newimage = showModalDialog('" & Me.mSmilesFilePath & "', ''," & vbCrLf
            mStr += "	            'dialogWidth:" & Me.EmotionsDialogueWidth & "px; dialogHeight: " & Me.EmotionsDialogueHeight & "px; '" & vbCrLf
            mStr += "			+ 'resizable: no; help: no; status: no; scroll: no; '" & vbCrLf
            mStr += "			+ wPosition);		" & vbCrLf

            'mStr += "		var firstpart = location.href ;" & vbCrLf
            'mStr += "		var firstpart = firstpart.substr(0, firstpart.lastIndexOf('/'))" & vbCrLf
            mStr += "       if (newimage == null) return;"
            mStr += "		newimage = '" & Me.mSmilesPath & "' + '/' + newimage;" & vbCrLf
            mStr += "		mCommand = 'insertimage';" & vbCrLf
            mStr += "		vValue = newimage;" & vbCrLf
            mStr += "		uInterface = false;						" & vbCrLf
            mStr += "		break;" & vbCrLf

            mStr += "		break ;" & vbCrLf
            'TODO Insert About Dialogue
            mStr += "	case 'imgAbout' :" & vbCrLf
            mStr += "		alert ('HTML Area. Created by Sameers (theAngrycodeR)');" & vbCrLf
            mStr += "		break;" & vbCrLf

            mStr += "}" & vbCrLf
            mStr += "	RTFEdit_" & Me.UniqueID & ".focus ();" & vbCrLf
            mStr += "	RTFEdit_" & Me.UniqueID & ".document.execCommand (mCommand, uInterface, vValue);" & vbCrLf
            mStr += "	RTFEdit_" & Me.UniqueID & ".focus ();" & vbCrLf
            mStr += "} " & vbCrLf

            mStr += "function GetColorFromUser(oldcolor)" & vbCrLf
            mStr += "{" & vbCrLf
            mStr += "	var posX    = event.screenX;" & vbCrLf
            mStr += "	var posY    = event.screenY + 20;" & vbCrLf
            mStr += "	var screenW = screen.width;                                 // screen size" & vbCrLf
            mStr += "	var screenH = screen.height - 20;                           // take taskbar into account" & vbCrLf
            mStr += "	if (posX + 232 > screenW) { posX = posX - 232 - 40; }       // if mouse too far right" & vbCrLf
            mStr += "	if (posY + 164 > screenH) { posY = posY - 164 - 80; }       // if mouse too far down" & vbCrLf
            mStr += "	var wPosition   = 'dialogLeft:' +posX+ '; dialogTop:' +posY;" & vbCrLf

            mStr += "	var newcolor = showModalDialog('" & Me.mColorFilePath & "', oldcolor," & vbCrLf
            mStr += "	        'dialogWidth:238px; dialogHeight: 187px; '" & vbCrLf
            mStr += "	+ 'resizable: no; help: no; status: no; scroll: no; '" & vbCrLf
            mStr += "	+ wPosition);" & vbCrLf

            mStr += "	        return newcolor" & vbCrLf
            mStr += "}" & vbCrLf
            mStr += "function GetEditBoxColor(colorCommand)" & vbCrLf
            mStr += "{" & vbCrLf
            mStr += "	return DecimalToRGB(RTFEdit_" & Me.UniqueID & ".document.queryCommandValue(colorCommand));" & vbCrLf
            mStr += "}" & vbCrLf

            mStr += "function DecimalToRGB(value) {" & vbCrLf
            mStr += "	var hex_string = '';" & vbCrLf
            mStr += "	for (var hexpair = 0; hexpair < 3; hexpair++) {" & vbCrLf
            mStr += "   	var byte = value & 0xFF;            // get low byte" & vbCrLf
            mStr += "	    value >>= 8;                        // drop low byte" & vbCrLf
            mStr += "	    var nybble2 = byte & 0x0F;          // get low nybble (4 bits)" & vbCrLf
            mStr += "	    var nybble1 = (byte >> 4) & 0x0F;   // get high nybble" & vbCrLf
            mStr += "	    hex_string += nybble1.toString(16); // convert nybble to hex" & vbCrLf
            mStr += "	    hex_string += nybble2.toString(16); // convert nybble to hex" & vbCrLf
            mStr += "   }" & vbCrLf
            mStr += "	return hex_string.toUpperCase();" & vbCrLf
            mStr += "}" & vbCrLf

            mStr += "</Script>" & vbCrLf
            Return (mStr & vbCrLf)
        End Function
        Private Function GenerateHTMLAreaBody() As String
            Dim mStr As String
            'Start of Main Table which will have three tables
            mStr = "<TABLE align=""center"" class=""tblTable"" cellpadding=0 cellspacing=0>" & vbCrLf
            mStr += "<TR>" & vbCrLf
            mStr += "<TD class=""tdClass"">" & vbCrLf

            'Start Making Frist Table (ie First Row of Toolbar) & vbCrLf
            mStr += "			<TABLE id=""table1"" class=""tblTable"">" & vbCrLf
            mStr += "				<TR>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgSave"" alt=""Save"" name=""imgSave"" class=""butClass"" src=""" & mIconsPath & "/save_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgUndo"" alt=""Undo"" name=""imgUndo"" class=""butClass"" src=""" & mIconsPath & "/undo_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgRedo"" alt=""Redo"" name=""imgRedo"" class=""butClass"" src=""" & mIconsPath & "/redo_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgSubScript"" alt=""Subscript"" name=""imgSubScript"" class=""butClass"" src=""" & mIconsPath & "/subscript_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgSuperScript"" alt=""SuperScript"" name=""imgSuperScript"" class=""butClass"" src=""" & mIconsPath & "/superscript_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgOrderList"" alt=""Ordered List"" name=""imgOrderList"" class=""butClass"" src=""" & mIconsPath & "/orderedlist_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgUnOrderList"" alt=""Unordered List"" name=""imgUnOrderList"" class=""butClass"" src=""" & mIconsPath & "/unorderedlist_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img alt=""Outdent"" ID=""imgOutdent"" name=""imgOutdent"" class=""butClass"" src=""" & mIconsPath & "/outdent_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img alt=""Indent"" ID=""imgIndent"" name=""imgIndent"" class=""butClass"" src=""" & mIconsPath & "/indent_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""> <!-- Insert the Style List -->" & vbCrLf
            mStr += "						<select id=""lstStyle"" width=30px onChange=""doCommand(this);"">" & vbCrLf
            mStr += "							<option value=""paragraph"">Paragraph</option>" & vbCrLf
            mStr += "							<option value=""Heading 1"">H1</option>" & vbCrLf
            mStr += "							<option value=""Heading 2"">H2</option>" & vbCrLf
            mStr += "							<option value=""Heading 3"">H3</option>" & vbCrLf
            mStr += "							<option value=""Heading 4"">H4</option>" & vbCrLf
            mStr += "							<option value=""Heading 5"">H5</option>" & vbCrLf
            mStr += "							<option value=""Heading 6"">H6</option>" & vbCrLf
            mStr += "							<option value=""Heading 7"">H7</option>" & vbCrLf
            mStr += "						</select>" & vbCrLf
            mStr += "					</td>" & vbCrLf
            mStr += "					<td class=""tdClass"">" & vbCrLf
            mStr += "						<Select id=""lstFont"" name=""lstFont"" width=30px onChange=""doCommand(this);"">" & vbCrLf
            mStr += "							<option value=""Arial"">Arial</option>" & vbCrLf
            mStr += "							<option value=""Courier"">Courier</option>" & vbCrLf
            mStr += "							<option value=""Sans Serif"">Sans Serif</option>" & vbCrLf
            mStr += "							<option value=""Tahoma"">Tahoma</option>" & vbCrLf
            mStr += "							<option value=""Verdana"">Verdana</option>" & vbCrLf
            mStr += "							<option value=""Wingdings"">Wingdings</option>" & vbCrLf
            mStr += "						</Select>" & vbCrLf
            mStr += "					</td>" & vbCrLf
            mStr += "					<td class=""tdClass"">" & vbCrLf
            mStr += "						<select id=""lstFontSize"" onChange=""doCommand(this);"" width=30px>" & vbCrLf
            mStr += "							<option value=1>Very Small</option>" & vbCrLf
            mStr += "							<option value=2>Small</option>" & vbCrLf
            mStr += "							<option value=3>Medium</option>" & vbCrLf
            mStr += "							<option value=4>Large</option>" & vbCrLf
            mStr += "							<option value=5>Larger</option>" & vbCrLf
            mStr += "							<option value=6>Very Large</option>" & vbCrLf
            mStr += "							<option value=7>Extra Large</option>" & vbCrLf
            mStr += "						</select>" & vbCrLf
            mStr += "					</td>" & vbCrLf
            mStr += "				</TR>" & vbCrLf
            mStr += "			</TABLE>" & vbCrLf


            'End of First Table
            mStr += "</TD>" & vbCrLf
            mStr += "</TR>" & vbCrLf

            'Create Second Table Now

            mStr += "	<TR>" & vbCrLf
            mStr += "		<TD class=""tdClass"">" & vbCrLf
            mStr += "			<TABLE id=""table2"" class=""tblTable"">" & vbCrLf
            mStr += "				<TR>" & vbCrLf
            mStr += "					<TD class=""tdClass"">" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgBold"" alt=""Bold"" name=""imgBold"" class=""butClass"" src=""" & mIconsPath & "/bold_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgItalic"" alt=""Italic"" name=""imgItalic"" class=""butClass"" src=""" & mIconsPath & "/italic_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgUnderLine"" alt=""Underline"" name=""imgUnderLine"" class=""butClass"" src=""" & mIconsPath & "/underline_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgBoldItalic"" alt=""Bold Italic UnderLine"" name=""imgBoldItalic"" class=""butClass"" src=""" & mIconsPath & "/bolditalicunderline_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgStrikeThrough"" alt=""Strike Trhough"" name=""imgStrikeThrough"" class=""butClass"" src=""" & mIconsPath & "/strikethrough_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img src=""" & mIconsPath & "/separator.gif""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgAlignLeft"" alt=""Left Align"" name=""imgAlignLeft"" class=""butClass"" src=""" & mIconsPath & "/alignleft_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgAlignCenter"" alt=""Center Align"" name=""imgAlignCenter"" class=""butClass"" src=""" & mIconsPath & "/aligncenter_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgAlignRight"" alt=""Right Align"" name=""imgAlignRight"" class=""butClass"" src=""" & mIconsPath & "/alignright_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgAlignJustify"" alt=""Justify"" name=""imgAlignJustify"" class=""butClass"" src=""" & mIconsPath & "/alignjustify_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img src=""" & mIconsPath & "/separator.gif""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgCut"" alt=""Cut"" name=""imgCut"" class=""butClass"" src=""" & mIconsPath & "/cut_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgCopy"" alt=""Copy"" name=""imgCopy"" class=""butClass"" src=""" & mIconsPath & "/copy_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgPaste"" alt=""Paste"" name=""imgPaste"" class=""butClass"" src=""" & mIconsPath & "/paste_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgSpecialChar"" alt=""Special Character"" name=""imgSpecialChar"" class=""butClass"" src=""" & mIconsPath & "/specialchars_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img src=""" & mIconsPath & "/separator.gif""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgImage"" alt=""Insert Image"" name=""imgImage"" class=""butClass"" src=""" & mIconsPath & "/image_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgLink"" alt=""Hyper Link"" name=""imgLink"" class=""butClass"" src=""" & mIconsPath & "/link_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgLine"" alt=""Insert Line"" name=""imgLine"" class=""butClass"" src=""" & mIconsPath & "/line_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgFontColor"" alt=""Text Color"" name=""imgFontColor"" class=""butClass"" src=""" & mIconsPath & "/fontcolor_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgHighLight"" alt=""Highlight Color"" name=""imgHighLight"" class=""butClass"" src=""" & mIconsPath & "/highlight_off.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "					<td class=""tdClass""><img ID=""imgSmile"" alt=""Insert Smiles"" name=""imgSmile"" class=""butClass"" src=""" & mIconsPath & "/1.gif"" onMouseOver=""selOn(this)"" onMouseOut=""selOff(this)"" onMouseDown=""selDown(this)"" onMouseUp=""selUp(this)"" onClick=""doCommand(this)""></td>" & vbCrLf
            mStr += "				</TR>" & vbCrLf
            mStr += "			</TABLE>" & vbCrLf
            'End of Second Table

            mStr += "		</TD>" & vbCrLf
            mStr += "</TR>" & vbCrLf

            'Create Third Table Now

            mStr += "	<TR>" & vbCrLf
            mStr += "		<TD class=""tdClass"">" & vbCrLf
            mStr += "			<TABLE id=""table3"" class=""tblTable"">" & vbCrLf
            mStr += "				<TR>" & vbCrLf
            mStr += "					<TD class=""tdClass"">" & vbCrLf
            'mStr += "						<Form Id=""frmEdit"" name=""frmEdit"">" & vbCrLf
            mStr += "							<IFrame name=RTFEdit_" & Me.UniqueID & " ID=RTFEdit_" & Me.UniqueID & " class=""EditControl"" ></IFrame>" & vbCrLf

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -