部分样式调整 ai生图逻辑调整

This commit is contained in:
wule committed 2026-05-09 13:26:55 +08:00
1 parent f04c74fa32
commit f9572ea046
11 files changed
+162 -75

No files matched your search

+40
View File
@@ -28,6 +28,8 @@ namespace TemuKJD.UserComponent
ControlStyles.AllPaintingInWmPaint,
true);
this.CellPainting += DataGridViewEx_CellPainting;
Task.Run(() =>
{
for (int i = 0; i < 50; i++)
@@ -190,6 +192,44 @@ namespace TemuKJD.UserComponent
e.Graphics.DrawRectangle(new Pen(this.BorderColor), new Rectangle(0, 0, this.Width - 1, this.Height - 1));
}
private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
//if (e.ColumnIndex == yourCheckBoxColumnIndex && e.RowIndex >= 0)
//{
// bool isChecked = (bool)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
// Rectangle checkBoxBounds = new Rectangle(e.CellBounds.Location.X + 10, e.CellBounds.Location.Y + (e.CellBounds.Height - 20) / 2, 20, 20); // 自定义大小和位置
// ControlPaint.DrawCheckBox(e.Graphics, checkBoxBounds, DataGridViewState.Default, isChecked); // 绘制复选框
// e.Handled = true; // 阻止默认绘制
//}
}
private int checkBoxSize = 12;
public Color CheckBoxColor = Color.White;
public Color CheckBoxRowBoxCheckColor = Color.Blue;
public Color CheckBoxRowBoxBorderColor = Color.Blue;
private void DataGridViewEx_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
{
var cellTmp = this.Rows[e.RowIndex].Cells[e.ColumnIndex];
if (cellTmp is DataGridViewCheckBoxCell)
{
e.PaintBackground(e.CellBounds, true);
bool isChecked = (bool)cellTmp.Value;
var locationX = e.CellBounds.Location.X + e.CellBounds.Width / 2 - checkBoxSize / 2 - 1;
var locationY = e.CellBounds.Location.Y + e.CellBounds.Height / 2 - checkBoxSize / 2;
Rectangle checkBoxBounds = new Rectangle(locationX, locationY, checkBoxSize, checkBoxSize); // 自定义大小和位置
//ControlPaint.DrawCheckBox(e.Graphics, checkBoxBounds, isChecked ? ButtonState.Checked : ButtonState.Normal); // 绘制复选框
UcCheckBox.DrawCheckBoxIcon(e.Graphics, checkBoxBounds, isChecked, CheckBoxColor, CheckBoxRowBoxCheckColor, CheckBoxRowBoxBorderColor);
e.Handled = true; // 阻止默认绘制
}
}
}
private bool multiSelectCheckBox = true;
/// <summary>
/// 选择框批量选中(使用Shift按键)