private void DataGridViewMouseMove(object sender, MouseEventArgs e)
        {
            var info = dataGridView1.HitTest(e.X, e.Y);

            // only draw again if the cell changes
            if (info.RowIndex == _currentMouseOverRow && info.ColumnIndex == _currentMouseOverColumn)
            {
                return;
            }

            _currentMouseOverRow    = info.RowIndex;
            _currentMouseOverColumn = info.ColumnIndex;

            string tooltipText;
            var    column = SlotsGridColumns.Find(GetColumnName(info.ColumnIndex));

            if (info.Type == DataGridViewHitTestType.ColumnHeader)
            {
                tooltipText = column?.MouseOverHeaderText;
            }
            else
            {
                tooltipText = column?.GetMouseOverText(GetRowSlotModel(info.RowIndex));
            }

            if (String.IsNullOrWhiteSpace(tooltipText))
            {
                toolTipGrid.Hide(dataGridView1);
            }
            else
            {
                toolTipGrid.Show(tooltipText, dataGridView1, e.X + 15, e.Y);
            }
        }
        private void AutoSizeColumn(int columnIndex)
        {
            var column = SlotsGridColumns.Find(GetColumnName(columnIndex));

            if (column is null)
            {
                return;
            }

            int columnWidth = 0;

            using (var g = dataGridView1.CreateGraphics())
            {
                for (int rowIndex = 0; rowIndex < dataGridView1.Rows.Count; rowIndex++)
                {
                    var slotModel = GetRowSlotModel(rowIndex);
                    if (slotModel is null)
                    {
                        continue;
                    }

                    int width = column.GetAutoSizeWidth(dataGridView1, slotModel, rowIndex, columnIndex);
                    if (columnWidth < width)
                    {
                        columnWidth = width + (int)(10 * GetDpiScale(g));
                    }
                }
            }

            var gridColumn = dataGridView1.Columns[columnIndex];

            if (columnWidth >= gridColumn.MinimumWidth)
            {
                gridColumn.Width = columnWidth;
            }
        }
        private void DataGridViewCellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        {
            var column = SlotsGridColumns.Find(GetColumnName(e.ColumnIndex));

            column?.PaintCell(dataGridView1, e, GetRowSlotModel(e.RowIndex));
        }