久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='Td3Er'><tr id='Td3Er'><dt id='Td3Er'><q id='Td3Er'><span id='Td3Er'><b id='Td3Er'><form id='Td3Er'><ins id='Td3Er'></ins><ul id='Td3Er'></ul><sub id='Td3Er'></sub></form><legend id='Td3Er'></legend><bdo id='Td3Er'><pre id='Td3Er'><center id='Td3Er'></center></pre></bdo></b><th id='Td3Er'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Td3Er'><tfoot id='Td3Er'></tfoot><dl id='Td3Er'><fieldset id='Td3Er'></fieldset></dl></div>

    <small id='Td3Er'></small><noframes id='Td3Er'>

    <legend id='Td3Er'><style id='Td3Er'><dir id='Td3Er'><q id='Td3Er'></q></dir></style></legend>
      <bdo id='Td3Er'></bdo><ul id='Td3Er'></ul>
    1. <tfoot id='Td3Er'></tfoot>
    2. 單擊時,如何使用 C# 編寫的 ActiveX 控件在 JavaS

      How can I make an ActiveX control written with C# raise events in JavaScript when clicked?(單擊時,如何使用 C# 編寫的 ActiveX 控件在 JavaScript 中引發事件?)
        <tbody id='SQR08'></tbody>

      <small id='SQR08'></small><noframes id='SQR08'>

        • <legend id='SQR08'><style id='SQR08'><dir id='SQR08'><q id='SQR08'></q></dir></style></legend>
          <tfoot id='SQR08'></tfoot>
              <bdo id='SQR08'></bdo><ul id='SQR08'></ul>
              <i id='SQR08'><tr id='SQR08'><dt id='SQR08'><q id='SQR08'><span id='SQR08'><b id='SQR08'><form id='SQR08'><ins id='SQR08'></ins><ul id='SQR08'></ul><sub id='SQR08'></sub></form><legend id='SQR08'></legend><bdo id='SQR08'><pre id='SQR08'><center id='SQR08'></center></pre></bdo></b><th id='SQR08'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SQR08'><tfoot id='SQR08'></tfoot><dl id='SQR08'><fieldset id='SQR08'></fieldset></dl></div>

              • 本文介紹了單擊時,如何使用 C# 編寫的 ActiveX 控件在 JavaScript 中引發事件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我已經在 SO 上看到了一些與此相關的問題,但我認為我的問題完全不同,不會被視為重復(如果我錯了,請告訴我).

                I'm seeing a few questions related to this on SO already, but I think mine is sufficiently different to not be considered a duplicate (if I'm wrong let me know).

                我有一個用 C# 編寫的 ActiveX 控件,雖然我大部分時間都在工作,但我想在單擊它時在 JavaScript 中引發一個事件(它顯示一個圖像,因此它是頁面上的一個可視元素).

                I have an ActiveX control I've written in C# and while I have it mostly working, I want to raise an event in JavaScript when it's clicked (it displays an image so it's a visual element on the page).

                我想要完成的最終目標與如果它是一個 <span> 標記并且它有一個 onclick 事件來引發一個單擊標記區域時的 JavaScript 函數.

                The end goal of what I'm looking to accomplish is no different than if it were a <span> tag and it had an onclick event to raise a JavaScript function when the area of the tag were clicked.

                我讀過的大部分內容 上詳細介紹了如何處理 ActiveX 控件中的事件和來回發送信息,這很好,但似乎過于復雜.我不想與 ActiveX 控件進行通信,我只需要一個 JavaScript 函數在我單擊它時觸發它,其方式類似于 <span><div> 標簽.我可以在 JavaScript 中處理所有其他事情.簡單地將控件包裝在 <span><div>onclick 事件沒有任何效果 - ActiveX 控件幾乎覆蓋它.

                Most of the stuff I've read on it goes into very fine detail on how to handle events in an ActiveX control and send info back/forth, and that's fine, but it seems overly complicated. I'm not looking to communicate with the ActiveX control, I just need a JavaScript function to fire off when I click it, in a way similar to a <span> or <div> tag. I can handle everything else in JavaScript. Simply wrapping the control in a <span> or <div> with an onclick event has no effect - the ActiveX control pretty much overrides it.

                對于用 C# 編寫的 ActiveX 控件,是否有一種簡單的方法來處理這個問題?

                Is there a simple way to handle this for an ActiveX control written in C#?

                我想另一種說法是 - 我正在使用第三方控件,我們必須使用類似于以下的代碼來讓它通過 JavaScript 與我們的 HTML 頁面進行通信

                I guess another way of putting it is - I'm working with a third party control and we have to use code similar to the following to get it to communicate with our HTML page via JavaScript

                <script type="text/javascript" event="OnMouseClick(index)" for="AXObjectName"> 
                        <!--
                         AXObjectName_OnMouseClick(index);
                        //-->
                </script>
                

                其中 AXObjectName 是控件的名稱/ID,AXObjectName_OnMouseClick 是它將在我的代碼中觸發的 JavaScript 函數的名稱,傳遞一個 index 參數.但是,要在控件中設置像 OnMouseClick 這樣的方法,我需要做些什么?如果我不想傳遞任何實際信息(即沒有 index),我什至必須走這么遠嗎?

                Where AXObjectName is the name/id of the control and AXObjectName_OnMouseClick is the name of the JavaScript function it will fire in my code, passing an index parameter. However, what all do I have to do to set up a method like OnMouseClick in the control? And if I don't want to pass any actual information (i.e., no index) do I even have to go this far?

                推薦答案

                ActiveX 事件是通過 COM 處理的,所以你需要深入研究一下不幸的是.

                ActiveX events are handled via COM, so you need to delve in there a bit unfortunately.

                使用 COM 要記住的是,一切都是通過接口處理的,因此您通常需要創建兩個接口,一個用于任何屬性,一個用于您的事件.

                The thing to remember with COM is that everything is handled via interfaces, so you normally need to create two interfaces, one for any properties and one for your events.

                事件的關鍵是使用 ComSourceInterfaces 屬性標記您的類,MSDN 將其描述為標識作為屬性類的 COM 事件源公開的接口列表."

                The key for events is marking your class with the ComSourceInterfaces attribute, which is described by MSDN as "Identifies a list of interfaces that are exposed as COM event sources for the attributed class."

                這個簡單的類結構應該適合你(過去也適合我).

                This simple class structure should work for you (it has for me in the past).

                namespace MyActiveX
                {
                    [Guid("Your-GUID") ,InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
                    public interface IActiveXEvents
                    {
                        [DispId(1)]
                        void OnMouseClick(int index);
                    }
                
                    [Guid("Another-GUID"),InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
                    public interface IActiveX
                    {       
                        //[DispId(1)]
                        // Any properties you want here like this
                        // string aProperty { get; set; }        
                    }
                
                    [ComVisible(true)]
                    [Guid("Yet-Another-GUID"), ClassInterface(ClassInterfaceType.None)]
                    [ProgId("MyActiveX")]
                    [ComSourceInterfaces(typeof(IActiveXEvents))]
                    public partial class MyActiveX : UserControl, IActiveX
                    {
                        public delegate void OnMouseClickHandler(int index);
                
                        public event OnMouseClickHandler OnMouseClick;
                
                        // Dummy Method to use when firing the event
                        private void MyActiveX_nMouseClick(int index)
                        {
                
                        }
                
                        public MyActiveX()
                        {
                            InitializeComponent();
                
                            // Bind event
                            this.OnMouseClick = new OnMouseClickHandler(this.MyActiveX_MouseClick)
                        }
                
                        public void FireTheEvent()
                        {
                            int index = -1;
                            this.OnMouseClick(index);
                        }       
                    }
                }
                

                如果您不需要任何屬性,您可以排除 IActiveX 接口.此外,如果您要使用 Click 事件,則需要將其標記為 new 以將其傳遞給 COM.

                If you don't need any properties you can just exclude the IActiveX interface. Also if you are going to use the Click event, you will need to mark it as new to pass it to COM.

                這篇關于單擊時,如何使用 C# 編寫的 ActiveX 控件在 JavaScript 中引發事件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                What are good algorithms for vehicle license plate detection?(車牌檢測有哪些好的算法?)
                onClick event for Image in Unity(Unity中圖像的onClick事件)
                Running Total C#(運行總 C#)
                Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時刪除目錄)
                asp.net listview highlight row on click(asp.net listview 在單擊時突出顯示行)
                Calling A Button OnClick from a function(從函數調用按鈕 OnClick)

                  <tfoot id='ih8j6'></tfoot>
                    <bdo id='ih8j6'></bdo><ul id='ih8j6'></ul>
                    <i id='ih8j6'><tr id='ih8j6'><dt id='ih8j6'><q id='ih8j6'><span id='ih8j6'><b id='ih8j6'><form id='ih8j6'><ins id='ih8j6'></ins><ul id='ih8j6'></ul><sub id='ih8j6'></sub></form><legend id='ih8j6'></legend><bdo id='ih8j6'><pre id='ih8j6'><center id='ih8j6'></center></pre></bdo></b><th id='ih8j6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ih8j6'><tfoot id='ih8j6'></tfoot><dl id='ih8j6'><fieldset id='ih8j6'></fieldset></dl></div>
                      <tbody id='ih8j6'></tbody>

                      <legend id='ih8j6'><style id='ih8j6'><dir id='ih8j6'><q id='ih8j6'></q></dir></style></legend>

                      1. <small id='ih8j6'></small><noframes id='ih8j6'>

                          主站蜘蛛池模板: 黄色av网站免费看 | 色婷婷国产精品综合在线观看 | 福利成人| 天天射天天干 | 99久久99久久精品国产片果冰 | 一区二区三区在线电影 | 国产精品一区二区三区在线 | 日韩av免费看 | 伦理二区 | 欧美精品乱码久久久久久按摩 | 亚洲综合色视频在线观看 | 午夜精品一区二区三区免费视频 | 久草视频网站 | 欧美在线视频免费 | 国产在线一区二 | 夜夜干夜夜操 | 久久久久久国产精品 | 亚洲九色 | 亚洲天堂精品久久 | 一a一片一级一片啪啪 | 中文字幕精品一区 | 视频1区2区 | 一级高清视频 | 欧美黑人一区 | 国产精品免费一区二区三区四区 | 国产精品久久久久久久久久久久久久 | 99久久中文字幕三级久久日本 | 91精品国产欧美一区二区成人 | 这里只有精品999 | 成人一区二区三区在线观看 | 免费观看a级毛片在线播放 黄网站免费入口 | 欧美二区在线 | 一色桃子av一区二区 | 亚洲一区二区久久久 | 国产成人精品福利 | 二区高清| 国产日韩久久 | 99久久精品国产麻豆演员表 | 中文在线一区二区 | 一级黄色淫片 | 国产在线观看一区二区三区 |