📄 compositetablecontrol_step1.vb
字号:
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Namespace WroxControls
Public Class CompositeTableControl
Inherits Control
Dim _table As Table ' Make table a member so we can access it at any point
Protected Overrides Sub CreateChildControls()
Dim text As LiteralControl
text = new LiteralControl("<h1>ASP.NET Control Development in C#</h1>")
Controls.Add(text)
Dim row As TableRow
Dim cell As TableCell
' Create a table and set a 2 pixel border
_table = new Table()
_table.BorderWidth = 2
Controls.Add(_table)
' Add 10 row each with 5 cells
Dim x As Integer
For x = 0 To 9
' Create a row and add it to the table
row = new TableRow()
_table.Rows.Add(row)
' Create a cell that contains the text
Dim y As Integer
For y = 1 to 4
text = new LiteralControl("Row: " & x & " Cell: " & y)
cell = new TableCell()
cell.Controls.Add(text)
row.Cells.Add(cell)
Next
Next
End Sub
End Class
End Namespace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -