• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

VB.NET TableDesigner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了VB.NET中System.Web.UI.Design.WebControls.TableDesigner的典型用法代码示例。如果您正苦于以下问题:VB.NET TableDesigner类的具体用法?VB.NET TableDesigner怎么用?VB.NET TableDesigner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TableDesigner类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。

示例1: StyledTableDesigner

' Create a class, named StyledTableDesigner,
' that derives from the TableDesigner class.
' This class displays a class named StyledTable
' at design time.
Public Class StyledTableDesigner
   Inherits TableDesigner
   
   ' Override the GetDesignTimeHtml method to display
   ' placeholder text at design time for the 
   ' rows and cells of the StyledTable class.
   Public Overrides Function GetDesignTimeHtml() As String
       Dim sTable As StyledTable = CType(Component, StyledTable)
       Dim designTimeHTML As String
       Dim rows As TableRowCollection = sTable.Rows
       Dim cellsWithDummyContents As ArrayList = Nothing
      
       Dim emptyTable As Boolean = rows.Count = 0
       Dim emptyRows As Boolean = False
       Dim counter As Integer = 1
       Dim numcells As Integer = 2
       
       Try     
           ' Create two cells to display
           ' in a row at design time.
           If emptyTable Then
               Dim row As TableRow = New TableRow()
               rows.Add(row)
         
               Dim i As Integer
               For i = 0 To numcells - 1
                   Dim c As TableCell = New TableCell()
                   c.Text = "Cell #" & counter.ToString()
                   counter += 1
                   rows(0).Cells.Add(c)
               Next i
           Else
               emptyRows = True
               Dim j As Integer
               For j = 0 To rows.Count - 1
                   If rows(j).Cells.Count <> 0 Then
                       emptyRows = False
                       Exit For
                   End If
               Next j
               If emptyRows = True Then
                   Dim k As Integer
                   For k = 0 To numcells - 1
                       Dim c As TableCell = New TableCell()
                       c.Text = "Cell #" & counter.ToString()
                       counter += 1
                       rows(0).Cells.Add(c)
                   Next k
                End If
           End If
      
           If emptyTable = False Then
               ' If the rows and cells were defined by the user, but the
               ' cells remain empty this code defines a string to display 
               ' in them at design time.
               Dim row As TableRow
               For Each row In rows
                   Dim c As TableCell
                   For Each c In row.Cells
                       If ((c.Text.Length = 0) AndAlso (c.HasControls() = False)) Then
                          If cellsWithDummyContents Is Nothing Then
                              cellsWithDummyContents = New ArrayList()
                          End If
                          cellsWithDummyContents.Add(c)
                          c.Text = "Cell #" & counter.ToString()
                          counter += 1
                       End If
                   Next c
               Next row
           End If
           ' Retrieve the design-time HTML for the StyledTable class.
           designTimeHTML = MyBase.GetDesignTimeHtml()

       Finally
           ' If the StyledTable was empty before the dummy text was added,
           ' restore it to that state.
           If emptyTable Then
               rows.Clear()
           Else
               ' Clear the cells that were empty before the dummy text 
               ' was added.
               If Not (cellsWithDummyContents Is Nothing) Then
                   Dim c As TableCell
                   For Each c In  cellsWithDummyContents
                       c.Text = [String].Empty
                   Next c
               End If
               If emptyRows Then
                   rows(0).Cells.Clear()
               End If
           End If
      
       End Try
       Return designTimeHTML
   End Function

End Class
开发者ID:VB.NET开发者,项目名称:System.Web.UI.Design.WebControls,代码行数:101,代码来源:TableDesigner


示例2: New

' Create a class that uses the StyledTableDesigner
 ' class to display its contents at design time.
<Designer("Examples.AspNet.Design.StyledTableDesigner", "TableDesigner")> _
Public Class StyledTable
  Inherits Table 
    

    Private tableStyle As Style = New Style()
    
    Public Sub New()
       tableStyle.BackColor = Color.LightBlue
       tableStyle.BorderColor = Color.Black
       
       CellSpacing = 4
       CellPadding = 0
       GridLines = GridLines.None
       BorderWidth = Unit.Point(1)
       Width = Unit.Percentage(100)
       Height = Unit.Percentage(100)

    End Sub
End Class
开发者ID:VB.NET开发者,项目名称:System.Web.UI.Design.WebControls,代码行数:22,代码来源:TableDesigner



注:本文中的System.Web.UI.Design.WebControls.TableDesigner类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
VB.NET DataControlFieldCell类代码示例发布时间:2022-05-26
下一篇:
VB.NET LoginDesigner类代码示例发布时间:2022-05-26
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap