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

📄 htmltextbox.cs

📁 ASP开发网站的 关于网站的设计和说明 还有SQL的程序 数据库
💻 CS
📖 第 1 页 / 共 5 页
字号:
		{
			get 
			{
				if (scrollbarStyle == null) 
				{
					scrollbarStyle = new ScrollbarStyle(ColorTranslator.FromHtml("#D4D0C8"),ColorTranslator.FromHtml("#000000"),ColorTranslator.FromHtml("#D4D0C8"),ColorTranslator.FromHtml("#D4D0C8"),ColorTranslator.FromHtml("#D4D0C8"),ColorTranslator.FromHtml("#808080"),ColorTranslator.FromHtml("#808080"),ColorTranslator.FromHtml("#D4D0C8"));
					if (IsTrackingViewState)
						((IStateManager)scrollbarStyle).TrackViewState();
				}
				return scrollbarStyle;
			}
		}
		private ScrollbarStyle scrollbarStyle;	
		/// <summary>
		/// Sets the style for how the toolbar is draw.
		/// </summary>
		[
		CategoryAttribute("Toolbar Behavior")
		]	
		public ToolbarType ToolbarType 
		{
			get 
			{ 
				object savedState = this.ViewState["ToolbarType"];
				return (savedState == null) ? ToolbarType.Office2003 : (ToolbarType) savedState;
			}
			set 
			{				
				ViewState["ToolbarType"] = value;
			}
		}
		private void SetButtonPath() 
		{
			switch (this.ToolbarType) 
			{
				default:
				case ToolbarType.Office2003:
					this.ButtonPath = "/images/ftb/office2003/";
					break;				
				case ToolbarType.OfficeXP:
					this.ButtonPath = "/images/ftb/officeXP/";
					break;
				case ToolbarType.Office2000:
					this.ButtonPath = "/images/ftb/office2000/";
					break;
			}
		}

		private void SetButtonStyle() 
		{
			if (ViewState["ToolbarType"] != null) 
			{
				if (this.ButtonPath == "") SetButtonPath();
				switch (this.ToolbarType) 
				{
					case ToolbarType.Office2003:
						this.BackColor = ColorTranslator.FromHtml("#9EBEF5");
						this.GutterBackColor = ColorTranslator.FromHtml("#81A9E2");
						this.ButtonOverStyle = true;
						this.ButtonOverImage = false;
						this.ButtonDownStyle = true;
						this.ButtonDownImage = false;
						this.ButtonStyle.OverBackColor = Color.Empty;
						this.ButtonStyle.OverBackgroundImage = this.ButtonPath + "toolbarbutton.over.gif";
						this.ButtonStyle.OverBorderColorLight = ColorTranslator.FromHtml("#000080");
						this.ButtonStyle.OverBorderColorDark = ColorTranslator.FromHtml("#000080");
						this.ButtonStyle.DownBackColor = Color.Empty;
						this.ButtonStyle.DownBackgroundImage = this.ButtonPath + "toolbarbutton.down.gif";
						this.ButtonStyle.DownBorderColorLight = ColorTranslator.FromHtml("#000080");
						this.ButtonStyle.DownBorderColorDark = ColorTranslator.FromHtml("#000080");
						this.ToolbarBackColor = System.Drawing.Color.Empty;
						this.ToolbarBackGroundImage = true;
						break;
					case ToolbarType.OfficeXP:
						this.BackColor = ColorTranslator.FromHtml("#D4D0C8");
						this.GutterBackColor = ColorTranslator.FromHtml("#BFBCB6");
						this.ButtonOverStyle = true;
						this.ButtonOverImage = true;
						this.ButtonDownStyle = true;
						this.ButtonDownImage = false;
						this.ButtonStyle.OverBackColor = ColorTranslator.FromHtml("#B6BDD2");
						this.ButtonStyle.OverBorderColorLight = ColorTranslator.FromHtml("#3169C6");
						this.ButtonStyle.OverBorderColorDark = ColorTranslator.FromHtml("#3169C6");
						this.ButtonStyle.DownBackColor = ColorTranslator.FromHtml("#8592B5");
						this.ButtonStyle.DownBorderColorLight = ColorTranslator.FromHtml("#3169C6");
						this.ButtonStyle.DownBorderColorDark = ColorTranslator.FromHtml("#3169C6");						
						this.ToolbarBackGroundImage = false;
						break;
					case ToolbarType.Office2000:
						this.BackColor = ColorTranslator.FromHtml("#D4D0C8");
						this.GutterBackColor = ColorTranslator.FromHtml("#BFBCB6");	
						this.ButtonOverStyle = true;
						this.ButtonOverImage = false;
						this.ButtonDownStyle = true;
						this.ButtonDownImage = false;
						this.ButtonStyle.OverBackColor = ColorTranslator.FromHtml("#D4D0C8");
						this.ButtonStyle.OverBorderColorLight = ColorTranslator.FromHtml("#FFFFFF");
						this.ButtonStyle.OverBorderColorDark = ColorTranslator.FromHtml("#808080");
						this.ButtonStyle.DownBackColor = ColorTranslator.FromHtml("#D4D0C8");
						this.ButtonStyle.DownBorderColorLight = ColorTranslator.FromHtml("#808080");
						this.ButtonStyle.DownBorderColorDark = ColorTranslator.FromHtml("#FFFFFF");
						this.ToolbarBackGroundImage = false;
						break;
					case ToolbarType.Custom:
						// do nothing
						break;
				}
			}
		}
		//Button Properties

		

		/// <summary>
		/// Style parameters for ToolbarButtons.  Is unused if ButtonType is set to FormButton.  If ToolbarType is manually set, these values may be overridden.  You should set ToolbarType to ToolbarType.Custom when customizing ButtonStyle
		/// </summary>
		[
		DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
		PersistenceMode(PersistenceMode.InnerProperty),
		NotifyParentProperty(true),
		CategoryAttribute("Toolbar Behavior")
		]
		public virtual ToolbarButtonStyle ButtonStyle 
		{
			get 
			{
				if (buttonStyle == null) 
				{
					if (this.ButtonPath == "") this.SetButtonPath();
					buttonStyle = new ToolbarButtonStyle(Color.Empty,Color.Empty,this.ButtonPath + "toolbarbutton.over.gif",ColorTranslator.FromHtml("#000080"),ColorTranslator.FromHtml("#000080"),this.ButtonPath + "toolbarbutton.down.gif",ColorTranslator.FromHtml("#000080"),ColorTranslator.FromHtml("#000080"));
					if (IsTrackingViewState)
						((IStateManager)buttonStyle).TrackViewState();
				}
				return buttonStyle;
			}
		}
		private ToolbarButtonStyle buttonStyle;

		protected override object SaveViewState() 
		{
			// Customized state management to handle saving 
			// state of contained objects such as styles.
			object baseState = base.SaveViewState();
			object buttonStyleState = (buttonStyle != null) ? 
				((IStateManager)buttonStyle).SaveViewState() : null;
			object scrollbarStyleState = (scrollbarStyle != null) ? 
				((IStateManager)scrollbarStyle).SaveViewState() : null;

			object[] myState = new object[3];
			myState[0] = baseState;
			myState[1] = buttonStyleState;
			myState[2] = scrollbarStyleState;

			return myState;
		}
		protected override void LoadViewState(object savedState) 
		{
			// Customized state management to handle 
			// state restoration of contained objects.

			if (savedState != null) 
			{
				object[] myState = (object[])savedState;

				if (myState[0] != null)
					base.LoadViewState(myState[0]);
				if (myState[1] != null)
					((IStateManager)ButtonStyle).LoadViewState(myState[1]);
				if (myState[2] != null)
					((IStateManager)ScrollbarStyle).LoadViewState(myState[2]);
			}
		}

		/// <summary>
		/// Determines how buttons are displayed.  Image is the default type.
		/// </summary>		
		[
		CategoryAttribute("Toolbar Items Options")
		]			
		public ButtonType ButtonType 
		{
			get 
			{ 
				object savedState = this.ViewState["ButtonType"];
				return (savedState == null) ? ButtonType.Image : (ButtonType) savedState;
			}
			set 
			{
				ViewState["ButtonType"] = value;
			}
		}
		/// <summary>
		/// Boolean for whether buttons change style (borders and back color) onMouseOver.
		/// </summary>		
		[
		CategoryAttribute("Toolbar Items Options")
		]		
		public bool ButtonOverStyle 
		{
			get 
			{ 
				object savedState = this.ViewState["ButtonOverStyle"];
				return (savedState == null) ? true : (bool) savedState;
			}
			set 
			{
				ViewState["ButtonOverStyle"] = value;
			}
		}
		/// <summary>
		/// Boolean for whether buttons change images onMouseOver.
		/// </summary>	
		public bool ButtonOverImage 
		{
			get 
			{ 
				object savedState = this.ViewState["ButtonOverImage"];
				return (savedState == null) ? false : (bool) savedState;
			}
			set 
			{
				ViewState["ButtonOverImage"] = value;
			}
		}
		/// <summary>
		/// Boolean for whether buttons change style (borders and back color) onMouseDown.
		/// </summary>	
		[
		CategoryAttribute("Toolbar Items Options")
		]				
		public bool ButtonDownStyle 
		{
			get 
			{ 
				object savedState = this.ViewState["ButtonDownStyle"];
				return (savedState == null) ? true : (bool) savedState;
			}
			set 
			{
				ViewState["ButtonDownStyle"] = value;
			}
		}
		/// <summary>
		/// Boolean for whether buttons change images onMouseDown.
		/// </summary>	
		[
		CategoryAttribute("Toolbar Items Options")
		]				
		public bool ButtonDownImage 
		{
			get 
			{ 
				object savedState = this.ViewState["ButtonDownImage"];
				return (savedState == null) ? false : (bool) savedState;
			}
			set 
			{
				ViewState["ButtonDownImage"] = value;
			}
		}
		/// <summary>
		/// The path to button images.  Defaults to String.Empty, but is set but ButtonStyle
		/// </summary>	
		[
		CategoryAttribute("External")
		]		
		public string ButtonPath 
		{
			get 
			{ 
				object savedState = this.ViewState["ButtonPath"];
				return (savedState == null) ? CommunityGlobals.ResolveBase("Communities/Common/Images/HtmlTextBoxEditor/office2003/") : (string) savedState;//SMR- CSK integration
			}
			set 
			{
				ViewState["ButtonPath"] = CommunityGlobals.ResolveBase(FixPath(value)); //SMR- CSK integration
			}
		}
		/// <summary>
		/// The file type extention of buttons (gif,jpg,png)
		/// </summary>	
		[
		CategoryAttribute("External")
		]					
		public string ButtonFileExtention 
		{
			get 
			{ 
				object savedState = this.ViewState["ButtonFileExtention"];
				return (savedState == null) ? "gif" : (string) savedState;
			}
			set 
			{
				ViewState["ButtonFileExtention"] = value;
			}
		}
		/// <summary>
		/// The path to helper files. Default is blank which will look in the current directory.  Automatically affixes a "/" if it's not included.
		/// </summary>	
		[
		CategoryAttribute("External")
		]						
		public string HelperFilesPath 
		{
			get 
			{ 
				object savedState = this.ViewState["HelperFilesPath"];
				return (savedState == null) ? CommunityGlobals.ResolveBase("Engine/Framework/HtmlTextBox/") : (string) savedState;//SMR- CSK integration
			}
			set 
			{
				if (value != "") 
				{
					if (value.Substring(value.Length) != "/") value += "/";
				}
				ViewState["HelperFilesPath"] = CommunityGlobals.ResolveBase(FixPath(value));//SMR- CSK integration
			}
		}
		/// <summary>
		/// Parameters included with all helper scripts
		/// </summary>	
		[
		CategoryAttribute("External")
		]						
		public string HelperFilesParameters 
		{
			get 
			{ 
				object savedState = this.ViewState["HelperFilesParameters"];
				return (savedState == null) ? "" : (string) savedState;
			}
			set 
			{
				ViewState["HelperFilesParameters"] = value;
			}
		}
		/// <summary>
		/// The path to for the InsertImageFromGallery Button.  Defaults to "images".  Use forward slashes "/" and do not all leading or trailing slashes.
		/// </summary>	
		[
		CategoryAttribute("External")
		]					
		public string ImageGalleryPath 
		{
			get 
			{ 
				object savedState = this.ViewState["ImageGalleryPath"];
				return (savedState == null) ? "Communities/Common/Images/HtmlTextBoxUserImages" : (string) savedState;//SMR- CSK integration
			}
			set 
			{
				value = FixPath(value);//SMR- CSK integration
				value.Replace("\\","/");
				if (value.Substring(0,1) == "/") value = value.Substring(1,value.Length-1);
				if (value.Substring(value.Length-1,1) == "/") value = value.Substring(0,value.Length-1);
				ViewState["ImageGalleryPath"] = value;
			}
		}	
		#endregion


		protected override void OnInit( EventArgs e ) 
		{
			//SMR- Begin: CSK integration
			if(Context.Items["SectionInfo"] != null)
			{
				objSectionInfo = ((SectionInfo)Context.Items["SectionInfo"]);
			}
			//SMR- End: CSK integration

            // Check for form tags
			GetFormClientID();
			base.OnInit(e);
		}
		private string GetFormClientID() 
		{
			if(IsHtmlForm(this.Parent)) 
			{
				return this.Parent.ClientID;
			}
			Control c = this.Parent;
			while(c != null) 
			{
				c = c.Parent;
				if(IsHtmlForm(c)) 
				{
					return c.Parent.ClientID;
				}
			}
			throw new Exception(string.Format("Control '{0}' of type '{1}' must be placed inside a form tag with runat=server",this.ID,this.GetType().ToString()));
		}
		private bool IsHtmlForm(Control c) 
		{
			return (c is HtmlForm);
		}
		protected override void OnLoad(EventArgs e) 
		{

			//SMR- Begin: CSK integration
			if(objSectionInfo != null)
			{
				string path = CommunityGlobals.GetSectionPath(CommunityGlobals.ResolveBase( "Communities" + "/" + objSectionInfo.Style )) + "Editor/";
				System.IO.DirectoryInfo DI = new System.IO.DirectoryInfo(Context.Server.MapPath(path));
				if(DI.Exists && DI.GetFiles("Editor.css").Length > 0)
				{
					this.DesignModeCss = path + "Editor.css";

				}
				else
				{
					this.DesignModeCss = CommunityGlobals.ResolveBase( "Communities/Common/Themes/Default/Styles/Editor/Editor.css" );
				}
				CheckAllowHtml();
			}
			else
			{
				this.DesignModeCss = CommunityGlobals.ResolveBase( "Communities/Common/Themes/Default/Styles/Editor/Editor.css" );
			}

			if(_allowHtml == AllowHtml.None && this.IsMshtmlEditorCapable)
			{
				this.ForceDownLevel = true;
			}
			else
			{
				if(_allowHtml == AllowHtml.Limited)
				{
					//this.DisablePaste = true;
					this.AllowHtmlMode = false;
				}
				
				//SMR- Begin: most of the origional OnLoad code
				if ((base.ID + "")== "") throw new Exception("The ID of an FTB control must be set");
				InitializeToolbars();
				SetUpToolbarItems();
				//SMR- End: most of the origional OnLoad code

			}
			//SMR- Begin: CSK integration	
		}

		protected override void OnPreRender( EventArgs e ) 
		{
			Page.RegisterRequiresPostBack(this);
			this.RegisterClientScript();
			base.OnPreRender(e);
		}
		// by manudea - 15/3/2003
		ResourceManager _resourceManager;

⌨️ 快捷键说明

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