利用公有Event響應usercontrol事件

2021-06-15 22:07:18 字數 2579 閱讀 9347

在masterpage中為自定義控制項留出位置,在畫面中進行呼叫。

在usercontrol裡公開event事件,然後就可以在畫面中直接進行響應了

syokuinlistarea.ascx.vb

#region

" 公開するイベント定義" '

支給年月區分が変更されたイベント

public

delegate

sub shikyunengetsukubunchangedeventhandler(byval sender as

object, byval e as taisyosyokuineventargs)

public

event shikyunengetsukubunchanged as shikyunengetsukubunchangedeventhandler

protected

overridable

sub onshikyunengetsukubunchanged(byval sender as

object, byval e as taisyosyokuineventargs)

raiseevent shikyunengetsukubunchanged(sender, e)

endsub#end

region

protected

sub dummyshikyunengetsukubunchangedbutton_click(byval sender as

object, byval e as system.eventargs) handles dummyshikyunengetsukubunchangedbutton.click

dim tse as

new taisyosyokuineventargs

tse.shikyunengetsu = dummyshikyunengetsu.text

tse.shikyukubun = dummyshikyukubun.text

tse.syokuinbango = dummysyokuinbango.text

onshikyunengetsukubunchanged(sender, tse)

endsubmasterpage.master.vb

<

tdvalign

="top"

style

="height: 1px">

<

asp:

contentplaceholder

id="syokuinlistarea"

runat

="server">

asp:

contentplaceholder

> td

>

qyo1250.aspx

<%

@page

language

="vb"

masterpagefile

="~/asp/master/kojinmaintenancelayout.master"

autoeventwireup

="false"

codefile

="qyo1250.aspx.vb"

inherits

="asp_qyo1250"

title

=" 給與履歴保守

"%>

<%

@register

src="../usercontrol/syokuinlistarea.ascx"

tagname

="syokuinlistarea"

tagprefix

="userctl"

%>

<

asp:

content

id="cntpage1"

contentplaceholderid

="syokuinlistarea"

runat

="server"

enableviewstate

="false">

<

userctl

:syokuinlistarea

id="syokuinlistarea"

runat

="server"

/>

asp:content

>

qyo1250.vb

public

sub usercontrol_syokuintaisyoarea_changedtogenbango(byval sender as

object, byval tse as taisyosyokuineventargs) handles syokuinlistarea.shikyunengetsukubunchanged

msgbox(tse.shikyunengetsu + " " + tse.shikyukubun + " " + tse.syokuinbango)

endsub

ATL所自帶響應Event的類

原文 atl所自帶響應event的類有兩個 idispevent impl idispeventimpl 它們的區別是乙個是否帶型別庫,現在看看他們的模板引數 template class atl no vtable idispevent impl public idispeventlocator ...

Linux 新的事件等待 響應機制eventfd

常用的程序 執行緒間通訊機制有管道 訊號量 訊息佇列 訊號 共享記憶體 socket等等,其中主要作為程序 執行緒間通知 等待的有管道pipe和socket。從linux 2.6.27版本開始增加了eventfd,主要用於程序或者執行緒間的通訊 如通知 等待機制的實現 注 eventfd用於程序 執...

利用event的inaxes屬性獲取當前trace

當滑鼠進入乙個matplotlib.figure.axes時,會觸發axes enter事件,並傳入引數event,event有乙個屬性event.inaxes,通過該屬性遍歷mplcanvas的self.axes陣列,即self.axes.index event.inaxes 可以得到該axes在...