user3042916
user3042916

Reputation: 87

Override C++/CLI functions

How to override C++/CLI functions ?

Upvotes: 0

Views: 923

Answers (2)

Justin Chang
Justin Chang

Reputation: 36

Here is the example of override OnPaint function in Picturebox. If you want to override the function, go to MSDN to understand the function which can override. Those function which can be override often follow the name of "OnXXXX( OOOOeventarg^ e)"

#pragma once

using namespace System::Drawing;
using namespace System::Windows::Forms;

ref class CustomPicturebox : public System::Windows::Forms::PictureBox
{
    public:
        CustomPicturebox();

    virtual void OnPaint(PaintEventArgs^ e) override {

        // Repeat the native behavior of .NET
        __super::OnPaint(e); 

        // Do whatever you want
        e->Graphics->FillRectangle(gcnew SolidBrush(Color::Blue), System::Drawing::RectangleF(0,0,50,50));
    }
};

Upvotes: 2

MisterC
MisterC

Reputation: 249

Looking at the git of OpenCV, to be exact defs.h, l. 503-506, you can find:

CV_INLINE int cvRound( int value )
{
    return value;
}

So the function is already overloaded for integers and it does not convert int to double implicitly.

Upvotes: 1

Related Questions