轉載freetextbox的用法

FreeTextBox 3.0以上版本均支持內部模式,即圖片資源和javascript都集成在dll中, 本文僅探討內部模式(Internal Resources).

1) 把FTBv3-1-1Framework-1.1FreetextBox.dll拷入bin目錄.

2) 在項目中添加FreetextBox.dll的dll引用

3) Web.config加入如下代碼

1
<?xml version="1.0" encoding="utf-8" ?>
2  
<configuration>
3   
<system.web>
4    
<httpHandlers>
5     
<add verb="GET" path="FtbWebResource.axd" type="FreeTextBoxControls.AssemblyResourceHandler, FreeTextBox" />
6    
</httpHandlers>
7   
<system.web>
<configuration>

3. 使用FreeTextBox 

1) aspx頁面頂上

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

2) 調用

<FTB:FreeTextBox id="FreeTextBox1" runat="Server" />
3)工具欄皮膚


ToolbarStyleConfiguration = Offoce2003/OfficeXP/Office2000/MAC

4) 得到保存編輯的內容


 1 private void InitializeComponent()
 2 {    
 3     //    指向同一個委託
 4     this.FreeTextBox1.SaveClick += new System.EventHandler this.FreeTextBox1_SaveClick);
 5     this.Button1.Click += new System.EventHandler(this.FreeTextBox1_SaveClick);
 6 }
 7 
 8 private void FreeTextBox1_SaveClick(object sender, System.EventArgs e)
 9 {
10     divshow.InnerHtml = FreeTextBox1.Text;
11 }
5) 客戶端中檢測到有潛在危險的 Request.Form 值

<%@ Page language="c#"  ValidateRequest="false"%>

4 圖片上傳


1) 工具欄上添加ImageGallery按鈕.


<FTB:FreeTextBox ID="A_Contents" runat="server" ToolbarStyleConfiguration="Office2003" Height="300px"
    ImageGalleryPath
="~/UploadFile/" Language="zh-CN" ToolbarLayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,FontBackColorPicker|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImage|Cut,Copy,Save,Paste,Delete;Undo,Redo,Print|InsertRule,Preview,InsertImageFromGallery"
    Visible
="true" Width="652px">
</FTB:FreeTextBox>
2) 拷貝 "ftb.imagegallery.aspx" 文件到同一目錄下 

http://wiki.freetextbox.com/default.aspx/FreeTextBoxWiki.ImageGallery

3) FreeTextBox 屬性設置

ImageGalleryPath = "~/image/upload"  上傳默認路徑
ImageGalleryUrl = "ftb.imagegallery.aspx?rif={0}
&cif={0}"  ftb.imagegallery.aspx的目錄, 只能用相對目錄,不可以用"~"

4) ImageGallery 的設置
ftb.imagegallery.aspx文件裏


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

AllowDirectoryCreate - 能否建立文件夾
AllowDirectoryDelete - 能否刪除文件夾
AllowImageUpload - 能否上傳圖片
AllowImageDelete - 能否刪除圖片
AcceptedFileTypes - 可以上傳文件擴展名的數組(array)

 

freetextbox、很好引用呀
發一篇相關引用給你
將freetextbox文件夾中的所有文件copy到你所需要的項目文件的根目錄下。即:wwwroot/"你的項目文件名下"另外,你會看到解壓後的文件裏含有三個framework(分別是1-0,1-1,2-0)如果你的環境是visual stduio2003的話,直接將framework1-1文件裏面的的freetextbox.dll文件copy到斧項目文件的bin文件夾下就可以了。
     最後。添加兩個引用就行了。
     第一個引用是在解決方案下的你的項目文件名那點擊右鍵,選擇"添加引用",然後選擇"項目"標籤,瀏覽到時你的bin目錄的freetextbox.ll文件,確定就行了。
     第二個引用是在工具箱的“常用”添加引用,同樣引用這個文件就行了.
      哦,別忘了要在webconfig文件中添加如下命令:     
<system.web>
<httpHandlers>
<add verb="GET"
path
="FtbWebResource.axd"
type
="FreeTextBoxControls.AssemblyResourceHandler, FreeTextBox" />
</httpHandlers>
</system.web>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章