开发者

Convert nb.FormClosed += (s, ex) => to C++ CLI

开发者 https://www.devze.com 2023-04-04 23:00 出处:网络
I want to convert this nb.FormClosed += (s, ex) => (overriding OnClose form method) to C++ CLI. I was trying something like .override but can\'t fi开发者_运维技巧nd correct C++CLI variant of i

I want to convert this

nb.FormClosed += (s, ex) =>
(overriding OnClose form method) 

to C++ CLI. I was trying something like .override but can't fi开发者_运维技巧nd correct C++CLI variant of it.


That doesn't override OnClose. That adds an event listener to the FormClosed event.

C++/CLI doesn't support lambda expressions. You'll need to subscribe with a real method. You'll also need to initialize the delegate instance explicitly. Here's the basic syntax:

nb->FormClosed += gcnew FormClosedEventHandler(this, &ClassName::MyCloseHandler)
0

精彩评论

暂无评论...
验证码 换一张
取 消