從spread中移出焦點

2021-04-15 21:05:22 字數 2786 閱讀 2946

dim enter*** as boolean = false

private sub form1_load(byval sender as system.object, byval e as system.eventargs) handles mybase.load

me.cmb_yyyymm.items.add(datetime.today.year & "/" & format(datetime.now.addmonths(-2).month, "00"))

me.cmb_yyyymm.items.add(datetime.today.year & "/" & format(datetime.now.addmonths(-1).month, "00"))

me.cmb_yyyymm.items.add(datetime.today.year & "/" & format(datetime.today.month, "00"))

me.cmb_yyyymm.dropdownstyle = comboboxstyle.dropdownlist

me.cmb_yyyymm.selectedindex = 2

me.fpspread1.editmodepermanent = false

'' 編集中セルの enterキー押下による動作を無効とする。

dim im as new farpoint.win.spread.inputmap

'im = fpspread1.getinputmap(farpoint.win.spread.inputmapmode.whenfocused)

'im.put(new farpoint.win.spread.keystroke(keys.enter, keys.none), farpoint.win.spread.spreadactions.none)

'[f2]:編集開始

im.put(new farpoint.win.spread.keystroke(keys.f2, keys.none), _

farpoint.win.spread.spreadactions.startediting)

'フォーカス時のenterキー押下による動作を「次列へ移動」とします。

im = fpspread1.getinputmap(inputmapmode.whenfocused)

im.put(new keystroke(keys.enter, keys.none), spreadactions.movetonextcolumnwrap)

im.put(new keystroke(keys.tab, keys.none), spreadactions.movetonextcolumnwrap)

end sub

private sub form1_keydown(byval sender as object, byval e as system.windows.forms.keyeventargs) handles mybase.keydown

if e.keycode = keys.enter or e.keycode = keys.tab then

if e.control = false then

if not typeof me.activecontrol is farpoint.win.spread.fpspread then

me.selectnextcontrol(me.activecontrol, true, true, true, true)

end if

end if

end if

end sub

private sub fpspread1_advance(byval sender as object, byval e as farpoint.win.spread.advanceeventargs) handles fpspread1.advance

if enter*** and e.advancenext or (fpspread1.activesheet.activecolumnindex = 0 and fpspread1.activesheet.activecolumnindex = 0) then

if fpspread1.activesheet.activerowindex = fpspread1.activesheet.rowcount - 1 and _

fpspread1.activesheet.activecolumnindex = fpspread1.activesheet.columncount - 1 then

'最終セルでのenterキー押下によってアクティブセルを先頭に位置付けます

e.cancel = true

me.selectnextcontrol(me.activecontrol, true, true, true, true)

else

me.selectnextcontrol(me.activecontrol, false, true, true, true)

end if

enter*** = false

end if

end sub

private sub fpspread1_keydown(byval sender as object, byval e as system.windows.forms.keyeventargs) handles fpspread1.keydown

enter*** = false

if e.keycode = keys.enter or e.keycode = keys.tab then

'enterキー押下を検知

enter*** = true

end if

end sub 

Spread在C 中的應用

spread屬於com類的乙個 元件,相信大家在vb資料庫程式中應用很廣。現在就簡單摘要一下該元件在c 中的應用。首先是把spread新增到工程中,這是普通的.net中對com引用,這裡不再詳細描述,只是說明一下 該控制項位於spread的bin目錄下,名稱為spr32x60.ocx,別引用錯了。再...

vue中監聽input框獲取焦點,失去焦點的問題

博主之前在用vue的獲取焦點,失去焦點的時候,出現了 blur和 focus無效的情況。當時百思不得其解。今天又在寫vue頁面的時候,突然 blur和 focus又好用了。emmmm,看來這部分值得一戰。1 html 這是html的輸入框。定義了乙個獲取焦點,失去焦點的方法 2 js部分 失去焦點和...

android中設定控制項獲得焦點

android中,要使控制項獲得焦點,需要先setfocus,再requestfocus。以button為例 btn.setfocusable true btn.setfocusableintouchmode true btn.requestfocus btn.requestfocusfromtou...