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

首頁 > 編程 > .NET > 正文

.net datagrid 選擇多行

2024-07-10 13:03:05
字體:
來源:轉載
供稿:網友
功能:點擊datagrid并且按住鍵盤上的ctrl或shift可選擇多行

public class mydatagridclass
inherits datagrid
private m as new arraylist

public readonly property multiselectedindex() as integer()
get
return m.toarray(gettype(integer))
end get
end property

protected overrides sub onmousedown(byval e as system.windows.forms.mouseeventargs)
debug.writeline("datagrid has hit")
dim posdg as point = new point(e.x, e.y)
dim hitdg as datagrid.hittestinfo = hittest(posdg)
if hitdatagrid(hitdg) then
mybase.onmousedown(e)
debug.writeline("mousedown has gogogo.....")
end if
end sub

private function hitdatagrid(byval hit as datagrid.hittestinfo) as boolean
try
select case me.modifierkeys
case keys.control
if hit.row > -1 then
if m.indexof(hit.row) > -1 then
m.remove(hit.row)
me.unselect(hit.row)
else
m.add(hit.row)
me.select(hit.row)
end if
end if
return false
case keys.shift
if hit.row > -1 then
for each indexold as integer in m
me.unselect(indexold)
next
m.clear()
dim i, intstep as integer
if hit.row > me.currentrowindex then
intstep = 1
else
intstep = -1
end if
for i = me.currentrowindex to hit.row step intstep
m.add(i)
me.select(i)
next
end if
return false
case else
for each index as integer in m
me.unselect(index)
next
m.clear()
if hit.type = datagrid.hittesttype.rowheader then
m.add(hit.row)
end if
return true
end select
catch ex as exception
debug.writeline(ex.tostring)
end try
end function
end class


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 巴青县| 安宁市| 五大连池市| 金寨县| 辽阳县| 八宿县| 临安市| 那曲县| 怀宁县| 衢州市| 渭南市| 桃园市| 莒南县| 客服| 双城市| 永修县| 界首市| 集安市| 康保县| 晋宁县| 屯留县| 乡城县| 高唐县| 平顺县| 江达县| 海原县| 嘉定区| 巩义市| 石门县| 镇安县| 阜新市| 广西| 正定县| 三都| 建水县| 无棣县| 陆河县| 碌曲县| 泰宁县| 青冈县| 霍邱县|