C++ /CLI padding of DataGridView DefaultCellStyle

C++ /CLI padding of DataGridView DefaultCellStyle

本文关键字:DataGridView DefaultCellStyle of padding CLI C++      更新时间:2023-10-16

我想在CellMouseEnter事件上更改我的cellpadding。我觉得这会很简单。

System::Void dgv_CellMouseEnter(System::Object^ sender, 
System::Windows::Forms::DataGridViewCellEventArgs^  e) {
dgv->Rows[e->RowIndex]->DefaultCellStyle->Padding =gcnew 
System::Windows::Forms::Padding(5);
}

但我收到一个错误

funktion "System::Windows::Forms::DataGridViewCellStyle::Padding::set" cannot 
be called with the given argument list. Argument types are: 
(System::Windows::Forms::Padding ^)
object type is :System::Windows::Forms::DataGridViewCellStyle^

填充属性(集(不接受指针类型。

尝试删除gcnew(正在工作(。

dgv->Rows[e->RowIndex]->DefaultCellStyle->Padding  =  System::Windows::Forms::Padding(5);