国产探花免费观看_亚洲丰满少妇自慰呻吟_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



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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 灵川县| 黄冈市| 乌拉特后旗| 陈巴尔虎旗| 托克逊县| 涿鹿县| 上饶县| 虎林市| 台安县| 湘潭市| 许昌县| 巫山县| 金堂县| 樟树市| 木兰县| 体育| 仁寿县| 信阳市| 阜南县| 普洱| 永州市| 南涧| 高密市| 施甸县| 洛浦县| 客服| 天门市| 田阳县| 子洲县| 滦南县| 梅河口市| 湘潭市| 宁晋县| 双辽市| 庆安县| 晋中市| 荔浦县| 通海县| 邵武市| 广元市| 山西省|