Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. Windows::Forms::ListView Repaint-Bug

Windows::Forms::ListView Repaint-Bug

Scheduled Pinned Locked Moved Windows Forms
graphicsdockerhelpquestion
2 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Allgaeuer
    wrote on last edited by
    #1

    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
    
    M 1 Reply Last reply
    0
    • A Allgaeuer

      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
      
      M Offline
      M Offline
      MicroVirus
      wrote on last edited by
      #2

      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[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups