Hey,
I have the code:
Form1(void)
{
array<Label ^>^ labels = gcnew array<Label ^>(itemCount);
InitializeComponent();
for (int i = 0; i < itemCount; i++)
{
labels[i] = (gcnew Label());
labels[i]->Tag = (int)i;
labels[i]->Location =
Point(1, (i + 1) * 50);
labels[i]->Size =
System::Drawing::Size(250, 50);
this->Controls->Add(labels[i]);
}
}
This works perfectly. I want the labels to highlight, which I will do in the form-mouse-move event, as I will be placing controls over the labels etc.
private: System::Void Form1_MouseMove(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
Point^ y = e->Location;
if (itemCurrent != -1)
{
this->labels[itemCurrent]->BackColor =
System::Drawing::Color::DimGray;
}
}
Firstly, I want the Y value to be an int; I can't remember how to get the Y value of a co-ordinate.
But more importantly, I cannot change the label colour, as it will not register that its existence.