当前位置: 首页 > article >正文

FreeTextBox使用详解(FTBv3-1-6)

文本编辑框,类似于csdn使用的fckedit。具有广泛的用途。下面介绍其中之一FreeTextBox:

下载FreeTextBox:

http://freetextbox.com/files/6949/download.aspx

下载完解压。

我使用的是Framework-2.0中的FreeTextBox.dll。这个比1.0的要容易上手点,不需要配置太多。

将这个文件夹复制到项目文件的bin目录下。然后添加引用

同时可以复制aspnet_client文件夹及内容进入你的项目文件夹中。我是直接放在根目录下的。这个的用处就是传输图形图像的使用。可以创建,删除文件夹和文件的。没有这个,你使用图像麻烦。

此时你可以参考它自带的英文说明(readme.txt):照做即可。

1 Installation of dll

2 Installing the FreeTextBox support files

上面2步,参考上面的讲解。

3 Using FreeTextBox

将下面的内容加入aspx文件的顶部:

<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>

加入下面的代码在<form runat="server"> 之间:

   <FTB:FreeTextBox id="FreeTextBox1" runat="Server" />

我的使用如下:

<FTB:FreeTextBox id="FreeTextBox1" runat="Server" AllowHtmlMode="True" ButtonFileExtention="gif,jpg" ImageGalleryPath="~/imagesLib/" ToolbarLayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImage,InsertImageFromGallery,InsertRule|Cut,Copy,Paste;Undo,Redo,Print" />

这个可以自定义的。readme里也有说明。

 ParagraphMenu, FontFacesMenu, FontSizesMenu, FontForeColorsMenu,
 FontForeColorPicker, FontBackColorsMenu, FontBackColorPicker, Bold, Italic, Underline,
 Strikethrough, Superscript, Subscript, InsertImageFromGallery, CreateLink, Unlink,
 RemoveFormat, JustifyLeft, JustifyRight, JustifyCenter, JustifyFull, BulletedList,
 NumberedList, Indent, Outdent, Cut, Copy, Paste, Delete, Undo, Redo, Print, Save,
 ieSpellCheck, StyleMenu, SymbolsMenu, InsertHtmlMenu, InsertRule, InsertDate,
 InsertTime, WordClean, InsertImage, InsertTable, EditTable, InsertTableRowBefore,
 InsertTableRowAfter, DeleteTableRow, InsertTableColumnBefore, InsertTableColumnAfter,
 DeleteTableColumn, InsertForm, InsertForm, InsertTextBox, InsertTextArea,
 InsertRadioButton, InsertCheckBox, InsertDropDownList, InsertButton, InsertDiv,
 InsertImageFromGallery, Preview, SelectAll, EditStyle

其中的参数添加在ToolbarLayout中。比较有用的红色显示。

这样你可以运行了。

界面如下:

class="FreeTextBox1_DesignBox" id="FreeTextBox1_designEditor" style="padding: 0px; width: 598px; height: 349px;" src="about:blank">
   Design  HTML

如果出现如下错误:A potentially dangerous Request.Form value was detected from the client

则需要添加代码:ValidateRequest="false"

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FreeTextBox.aspx.cs" Inherits="FreeTextBox" ValidateRequest="false" %>

注意:你可以在属性窗口中进行众多设置。自己体会一下。

比如:ImageGalleryPath设置为~/imagesLib/

 下面讲解图像处理:

复制ftb.imagegallery.aspx进入项目文件夹:

<FTB:ImageGallery id="ImageGallery1"
   JavaScriptLocation="ExternalFile"
   UtilityImagesLocation="ExternalFile"
   SupportFolder="~/aspnet_client/FreeTextBox/"
   AllowImageDelete="true" AllowImageUpload="true" AllowDirectoryCreate="true" AllowDirectoryDelete="true"  runat="Server" />

我的代码如下:

<% @ Page Language = " C# "  ValidateRequest = " false "  Trace = " false "   %>
<% @ Register TagPrefix = " FTB "  Namespace = " FreeTextBoxControls "  Assembly = " FreeTextBox "   %>
< script runat = " server " >
protected   void  Page_Load(Object Src, EventArgs E)  {
    
    
// *** remove this return statement to use the following code ***
    return;

    
string currentFolder = ImageGallery1.CurrentImagesFolder;
    
    
// modify the directories allowed
    if (currentFolder == "~/imagesLib"{

        
// these are the default directories FTB:ImageGallery will find
        string[] defaultDirectories = System.IO.Directory.GetDirectories(Server.MapPath(currentFolder),"*");
        
        
// user defined custom directories
        string[] customDirectories = new string[] {"folder1","folder2"};
        
        
// the gallery will use these images in this instance
        ImageGallery1.CurrentDirectories = customDirectories;
    }

    
    
    
// modify the images allowed
    if (currentFolder == "~/imagesLib"{

        System.IO.DirectoryInfo directoryInfo 
= new System.IO.DirectoryInfo(Server.MapPath(currentFolder));

        
// these are the default images FTB:ImageGallery will find
        System.IO.FileInfo[] defaultImages = directoryInfo.GetFiles("*");
        
        
// user defined custom images (here, we're just allowing the first two)
        System.IO.FileInfo[] customImages = new System.IO.FileInfo[2{defaultImages[0], defaultImages[1]};
        
        
// the gallery will use these images in this instance
        ImageGallery1.CurrentImages = customImages;
    }
    
    
}

</ script >
< html xmlns = " http://www.w3.org/1999/xhtml " >
< head >
    
< title > Image Gallery </ title >
</ head >
< body >

    
< form id = " Form1 "  runat = " server "  enctype = " multipart/form-data " >   
    
        
< FTB:ImageGallery id = " ImageGallery1 "  
            JavaScriptLocation
= " ExternalFile "  
            UtilityImagesLocation
= " ExternalFile "  
            SupportFolder
= " ~/aspnet_client/FreeTextBox/ "
            AllowImageDelete
= " true "  AllowImageUpload = " true "  AllowDirectoryCreate = " true "  AllowDirectoryDelete = " true "   runat = " Server "   />
        
    
</ form >

</ body >
</ html >

 

自己对应文件夹体会一下:

SupportFolder="~/aspnet_client/FreeTextBox/" 就是对应的你复制的aspnet_client文件夹。

currentFolder == "~/imagesLib" 就是你设定的图像存储文件夹。运行后你可以新建或删除文件夹。

AllowImageDelete="true" AllowImageUpload="true" AllowDirectoryCreate="true" AllowDirectoryDelete="true"

就是使得上述功能能够使用。

我将其<htm>修改为<html xmlns="http://www.w3.org/1999/xhtml">省得老是报错。

默认的语言设置为英文,改为中文的用对应的那个值Language="zh-CN"。

测试通过。

下面贴一个我师兄用的布局图:<FTB:FreeTextBox id="FreeTextBoxXinXiNeiRong" runat="Server" AllowHtmlMode="True" ButtonFileExtention="gif,jpg,*.*" ImageGalleryPath="~/imagesLib/" ToolbarLayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImage,InsertRule,InsertImageFromGallery|Cut,Copy,Paste;Undo,Redo,Print" Height="400px" Width="550px" Language="zh-CN" />


我的添加了个表格
ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImage,InsertRule,InsertImageFromGallery,InsertTable|Cut,Copy,Paste;Undo,Redo,Print
http://www.lryc.cn/news/2413651.html

相关文章:

  • 【无线安全实践入门】破解WiFi密码的多个方法
  • 开根号计算机在线应用,根号计算器(万能计算器在线计算)
  • debugbar php漏洞,Laravel-debugbar 开发调试利器
  • Nodejs基础
  • CVE-2015-0235
  • python心理学实验平台,python心理学实验程序(psychopy)
  • 一个不错的网站,颜色推荐 http://www.colorhexa.com/
  • [ Python 库调用和管理 ] __init__.py 的基本使用和运作机制
  • js常见特效
  • 了解遗传算法
  • Web.xml配置之context-param
  • 密码学 / PKI 体系概述
  • C++ 算法篇 深度优先搜索(DFS)
  • 《帝国时代3:决定版》dll丢失?修复x3daudio1_7.dll文件指南
  • Ubuntu 中 安装ulipad 发现无法更新软件库,无法安装python-wxgtk2.8
  • APIHOOK实例剖析
  • InstallSeield安装及破解
  • 胡立阳七招
  • 史上最详细的Linux使用手册(持续更新中)
  • 火狐下载 firefox免费高速下载 firefox又出新版本了
  • 博雅书社网上书店系统的设计与实现
  • 车载电脑(car pc)
  • 基于Java实现医院网上预约挂号管理系统-任务书参考
  • 腾讯qq2014官方正式版 v6.3.12390 免费版
  • SpringBoot单元测试详解
  • awk数组
  • fw150um无线网卡linux驱动,fw150um无线网卡驱动
  • CreateTextFile 文件的使用
  • Cloudflare设置流程 免费CDN加速你的网站【2024年最新】
  • maven 构建报错 This failure was cached in the local repository and resolution is not reattempted until t