Windows::Forms::ListView Repaint-Bug
-
Hello, i have a question regarding the System::Windows::Forms::ListView. There's a bug witch i can't get rid of. The intention was to create a ListView item whose last column adjusts to the available space of the surrounding panel. Please check the following code: Form1.h:
#pragma once
#include "MDIChild.h"
namespace ListView_Test {
using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); MDIChild ^ child = gcnew MDIChild(); child->MdiParent=this; child->Show(); } protected: ~Form1() { if (components) { delete components; } } private: System::ComponentModel::Container ^components; void InitializeComponent(void) { this->SuspendLayout(); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(1060, 484); this->IsMdiContainer = true; this->Name = L"Form1"; this->Text = L"Form1"; this->ResumeLayout(false); } };
}
MDIChild.h:
#pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;namespace ListView_Test {
public ref class MDIChild : public System::Windows::Forms::Form { public: MDIChild(void) { InitializeComponent(); } protected: ~MDIChild() { if (components) { delete components; } } private: System::Windows::Forms::ListView^ listView1; private: System::Windows::Forms::ColumnHeader^ columnHeader1; private: System::Windows::Forms::ColumnHeader^ columnHeader2; private: System::Windows::Forms::ColumnHeader^ columnHeader3; private: System::Windows::Forms::ColumnHeader^ columnHeader4; private: System::Windows::Forms::ColumnHeader^ columnHeader5; private: System::Windows::Forms::ColumnHeader^ columnHeader6; private: System::Windo
-
Hello, i have a question regarding the System::Windows::Forms::ListView. There's a bug witch i can't get rid of. The intention was to create a ListView item whose last column adjusts to the available space of the surrounding panel. Please check the following code: Form1.h:
#pragma once
#include "MDIChild.h"
namespace ListView_Test {
using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); MDIChild ^ child = gcnew MDIChild(); child->MdiParent=this; child->Show(); } protected: ~Form1() { if (components) { delete components; } } private: System::ComponentModel::Container ^components; void InitializeComponent(void) { this->SuspendLayout(); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(1060, 484); this->IsMdiContainer = true; this->Name = L"Form1"; this->Text = L"Form1"; this->ResumeLayout(false); } };
}
MDIChild.h:
#pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;namespace ListView_Test {
public ref class MDIChild : public System::Windows::Forms::Form { public: MDIChild(void) { InitializeComponent(); } protected: ~MDIChild() { if (components) { delete components; } } private: System::Windows::Forms::ListView^ listView1; private: System::Windows::Forms::ColumnHeader^ columnHeader1; private: System::Windows::Forms::ColumnHeader^ columnHeader2; private: System::Windows::Forms::ColumnHeader^ columnHeader3; private: System::Windows::Forms::ColumnHeader^ columnHeader4; private: System::Windows::Forms::ColumnHeader^ columnHeader5; private: System::Windows::Forms::ColumnHeader^ columnHeader6; private: System::Windo
Have you tried handling the Layout event, instead of Resize? On the resize page, it is suggested that for a custom layout (of child elements), that Layout should be handled instead of resize. I'm guessing it might affect the repaint and re-positioning of the child controls, hopefully removing the bug. Control.Resize Event[^] Control.Layout event[^]