本文整理汇总了VB.NET中System.Web.UI.WebControls.WebParts.WebPartChrome类的典型用法代码示例。如果您正苦于以下问题:VB.NET WebPartChrome类的具体用法?VB.NET WebPartChrome怎么用?VB.NET WebPartChrome使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebPartChrome类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: New
' 导入命名空间
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Namespace Samples.AspNet.VB.Controls
<AspNetHostingPermission(SecurityAction.Demand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class MyZone
Inherits WebPartZone
Private _renderVerbsInMenu As Boolean
Protected Overrides Function CreateWebPartChrome() As WebPartChrome
Dim theChrome As WebPartChrome = _
New MyWebPartChrome(Me, Me.WebPartManager)
If RenderVerbsInMenu Then
Me.WebPartVerbRenderMode = WebPartVerbRenderMode.Menu
Else
Me.WebPartVerbRenderMode = WebPartVerbRenderMode.TitleBar
End If
Return theChrome
End Function
Public Property RenderVerbsInMenu() As Boolean
Get
Return _renderVerbsInMenu
End Get
Set(ByVal value As Boolean)
_renderVerbsInMenu = value
End Set
End Property
End Class
<AspNetHostingPermission(SecurityAction.Demand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class MyWebPartChrome
Inherits WebPartChrome
Dim theManager As WebPartManager
Dim theZone As WebPartZoneBase
Public Sub New(ByVal aZone As WebPartZoneBase, _
ByVal aManager As WebPartManager)
MyBase.New(aZone, aManager)
theManager = aManager
theZone = aZone
End Sub
Protected Overrides Function GetWebPartVerbs _
(ByVal webPart As WebPart) As WebPartVerbCollection
Dim verbSet As New ArrayList()
Dim verb As WebPartVerb
For Each verb In MyBase.GetWebPartVerbs(webPart)
If verb.Text <> "Close" Then
verbSet.Add(verb)
End If
Next verb
Dim reducedVerbSet As WebPartVerbCollection = _
New WebPartVerbCollection(verbSet)
Return reducedVerbSet
End Function
Protected Overrides Function CreateWebPartChromeStyle _
(ByVal part As WebPart, ByVal chromeType As PartChromeType) As Style
Dim finalStyle As New Style()
finalStyle.CopyFrom(MyBase.CreateWebPartChromeStyle(Part, chromeType))
finalStyle.Font.Name = "Verdana"
Return finalStyle
End Function
Protected Overrides Sub RenderPartContents _
(ByVal writer As HtmlTextWriter, ByVal part As WebPart)
If part Is Me.WebPartManager.SelectedWebPart Then
HttpContext.Current.Response.Write("<span>Not rendered</span>")
Else
If (Me.Zone.GetType() Is GetType(MyZone)) Then
part.RenderControl(writer)
End If
End If
End Sub
End Class
End Namespace