国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

VB.NET中的Line控件

2024-07-10 13:00:49
字體:
來源:轉載
供稿:網友

在vb.net中去掉了line控件,我們用.net轉換包含有line控件的vb6的工程后,發現取而代之的是label。

其實我們還可以有另一種畫線的方法:

public class line
inherits system.windows.forms.usercontrol
public toplc as system.drawing.color = system.drawing.color.white '上線顏色
public footlc as system.drawing.color = system.drawing.color.black '下線顏色
public linet as type '直線類型
public enum type
tf '凸
ft '凹
flat '平面
end enum
#region " windows 窗體設計器生成的代碼 "
public sub new()
mybase.new()
'該調用是 windows 窗體設計器所必需的。
initializecomponent()
'在 initializecomponent() 調用之后添加任何初始化
end sub
'usercontrol 重寫 dispose 以清理組件列表。
protected overloads overrides sub dispose(byval disposing as boolean)
if disposing then
if not (components is nothing) then
components.dispose()
end if
end if
mybase.dispose(disposing)
end sub
'windows 窗體設計器所必需的
private components as system.componentmodel.icontainer
'注意: 以下過程是 windows 窗體設計器所必需的
'可以使用 windows 窗體設計器修改此過程。
'不要使用代碼編輯器修改它。
<system.diagnostics.debuggerstepthrough()> private sub initializecomponent()
'
'line
'
me.name = "line"
me.size = new system.drawing.size(304, 72)
end sub
#end region
#region " 屬性 "
<system.componentmodel.description("直線類型:" & vbcrlf & "tf '凸" & vbcrlf & "ft '凹" & vbcrlf & "flat '平面")> public property linetype() as type
get
linetype = linet
end get
set(byval value as type)
linet = value
end set
end property
<system.componentmodel.description("上線顏色")> public property toplinecolor() as system.drawing.color
get
toplinecolor = toplc
end get
set(byval value as system.drawing.color)
toplc = value
end set
end property
<system.componentmodel.description("下線顏色")> public property footlinecolor() as system.drawing.color
get
footlinecolor = footlc
end get
set(byval value as system.drawing.color)
footlc = value
end set
end property
#end region
private sub line_paint(byval sender as object, byval e as system.windows.forms.painteventargs) handles mybase.paint
dim topline as new pen(me.toplinecolor)
dim footline as new pen(me.footlinecolor)
dim startx as integer
dim starty as integer
select case linet
case linet.flat
e.graphics.drawline(topline, 0 + startx, 0, me.width + startx, 0)
e.graphics.drawline(topline, 1 + startx, 1, me.width + startx, 1)
case linet.tf
e.graphics.drawline(topline, 0 + startx, 0, me.width + startx, 0)
e.graphics.drawline(footline, 1 + startx, 1, me.width + startx, 1)
case linet.ft
e.graphics.drawline(footline, 0 + startx, 0, me.width + startx, 0)
e.graphics.drawline(topline, 1 + startx, 1, me.width + startx, 1)
end select
end sub
private sub line_resize(byval sender as object, byval e as system.eventargs) handles mybase.resize
me.height = 2
end sub
end class



新建一個類,把以上代碼粘貼即可。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 临湘市| 四平市| 双鸭山市| 静宁县| 鹤峰县| 新沂市| 新安县| 西城区| 贞丰县| 章丘市| 泾阳县| 呼图壁县| 莱芜市| 彭山县| 平谷区| 宁安市| 瑞昌市| 平江县| 阳山县| 台前县| 卫辉市| 嵊泗县| 台南县| 临澧县| 阿图什市| 信阳市| 乌鲁木齐市| 安顺市| 乐陵市| 台中市| 神池县| 商丘市| 上饶县| 南城县| 宜昌市| 五家渠市| 临沂市| 雷山县| 略阳县| 佳木斯市| 惠安县|