Files
2017-03-26 20:00:03 +02:00

77 lines
2.9 KiB
VB.net

Imports System
Imports System.ComponentModel
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Actions
Imports DevExpress.Persistent.Base
Imports DevExpress.Web.ASPxHtmlEditor
Imports DevExpress.ExpressApp.HtmlPropertyEditor.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI
Imports DevExpress.ExpressApp.Editors
Public Class HTMLEditorUserVC
Inherits DevExpress.ExpressApp.ViewController(Of DetailView)
Private htmlEditors As ArrayList
Public Sub New()
MyBase.New()
htmlEditors = New ArrayList
htmlEditors.Clear()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
Dim fView As DetailView = TryCast(View, DetailView)
If (Not fView Is Nothing) AndAlso (fView.ViewEditMode = ViewEditMode.View) Then
fView.ViewEditMode = ViewEditMode.Edit
End If
End Sub
Protected Overrides Sub OnViewControlsCreated()
MyBase.OnViewControlsCreated()
Dim editor As ASPxHtmlPropertyEditor
Dim htmlEditor As ASPxHtmlEditor
If View.ViewEditMode = Editors.ViewEditMode.Edit Then
For Each editor In View.GetItems(Of ASPxHtmlPropertyEditor)()
If editor.Control IsNot Nothing Then
htmlEditor = TryCast(editor.Control, Table).Rows(0).Cells(1).Controls(0)
If htmlEditor IsNot Nothing Then
htmlEditors.Add(htmlEditor)
End If
End If
Next
AddHandler TryCast(View.Control, Control).PreRender, AddressOf ChangeHtmlEditorWidthController_PreRender
End If
End Sub
Sub ChangeHtmlEditorWidthController_PreRender(sender As Object, e As EventArgs)
Dim htmlEditor As ASPxHtmlEditor
Dim _Toolbar As DevExpress.Web.ASPxHtmlEditor.HtmlEditorToolbar
Dim _ToolbarItem As DevExpress.Web.ASPxHtmlEditor.HtmlEditorToolbarItem
For Each htmlEditor In htmlEditors
htmlEditor.Width = Unit.Percentage(100)
'-- InsertImage tiltása.
For Each _Toolbar In htmlEditor.Toolbars
For Each _ToolbarItem In _Toolbar.Items
If TryCast(_ToolbarItem, ToolbarInsertImageDialogButton) IsNot Nothing Then
_ToolbarItem.Visible = False
End If
If TryCast(_ToolbarItem, ToolbarInsertLinkDialogButton) IsNot Nothing Then
_ToolbarItem.Visible = False
End If
If TryCast(_ToolbarItem, ToolbarUnlinkButton) IsNot Nothing Then
_ToolbarItem.Visible = False
End If
Next
Next
Next
htmlEditors.Clear()
End Sub
End Class