greetings, i need a replacement for TableLayoutPanelCellPosition. i have made this class:
public class GridUnit
{
public GridUnit()
{
Column = 0;
Row = 0;
}
public GridUnit(int column, int row)
{
Column = column;
Row = row;
}
public int Column { get; set; }
public int Row { get; set; }
}
private TableLayoutPanelCellPosition homeLastPositionFirst = new TableLayoutPanelCellPosition(0, 0);
private GridUnit homeLastPositionLast = new GridUnit();
and if i do:
homeLastPositionLast = homeLastPositionFirst
i get errors and this is expected. my question is what else do i need to implement so that i can do this?
thank you for your time and just for the record im new at this.
Since you want to maintain code portability, you will need to convert your
GridUnitintoTableLayoutPanelCellPositionwhen you want to use it. You could implement static methods to do the conversion for you.You would use the conversion methods like this:
Even better, you could turn the conversion methods into conversion operators:
Then you can cast between GridUnit and TableLayoutPanelCellPosition:
If you wanted to allow free conversion between GridUnit and TableLayoutPanelCellPosition without explicit casting, you would change
explicitintoimplicitin the converstion operator. Then you could do this: