I have a ListView in my Form in which I would like to override the IsInputKey method. I create the override like this:
public ref class myListView : ListView { protected: virtual bool IsInputKey(Keys keyData) override { if (keyData == Keys::Left || keyData == Keys::Right) { return true; } else { return ListView::IsInputKey(keyData); } } };
But then how do I use myListView in the designer instead of ListView?
I tried changing the form designer code from:
private: System::Windows::Forms::ListView^ listView1;
this->listView1= (gcnew System::Windows::Forms::ListView());
to:
private: myListView^ listView1;
this->listView1= (gcnew customListView());
This doesn't seem to work though since the gcnew line is within the "#pragma region Windows Form Designer generated code" block which has comments saying not to modify it's contents.
Is there a proper way to do this?
Thanks