954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

VC++ question

hey
im using vc++ clr to build my application...im using the datagridview, but im having some problems with it because its quite poorly documented in C++..i want to know a couple of things.

1... how to change the color and text of a single row header cell as well as the text in the row header cell.

2... how to change the standard column width..

thanks in advance :)

thinkingofaname
Newbie Poster
7 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

Here are some things to contemplate:

private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e)
   {
      dataGridView1->Columns->Add("asdf", "myASDF");

      // set the column width
      dataGridView1->Columns[0]->Width = 444;

      // Add some rows
      for (int i = 0; i < 3; i++)
      {
         dataGridView1->Rows->Add();
         dataGridView1->Rows[i]->Cells[0]->Value = "adsf " + i.ToString();
      }

      // Change the header text color
      dataGridView1->Columns[0]->HeaderCell->Style->ForeColor = Color::Green;

      // Change a cell's text color
      dataGridView1->Rows[1]->Cells[0]->Style->ForeColor = Color::Red;
   }
thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: