部分样式调整 ai生图逻辑调整
This commit is contained in:
1 parent
f04c74fa32
commit
f9572ea046
11 files changed
+162
-75
No files matched your search
@@ -27,7 +27,7 @@ namespace AllBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 版本ID
|
/// 版本ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int VersionCount = 1051;
|
public static int VersionCount = 1052;
|
||||||
//public static int VersionCount = 613;
|
//public static int VersionCount = 613;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -67,13 +67,17 @@ namespace AllBase.Helper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static ConcurrentList<PddClientInfo> PddClientInfoList = new ConcurrentList<PddClientInfo>();
|
public static ConcurrentList<PddClientInfo> PddClientInfoList = new ConcurrentList<PddClientInfo>();
|
||||||
|
|
||||||
public static System.Drawing.Color KJDMainColor = System.Drawing.Color.FromArgb(63, 126, 255);
|
public static System.Drawing.Color DefaultMainColor { get; set; } = System.Drawing.Color.FromArgb(63, 126, 255);
|
||||||
public static System.Drawing.Color KJDMainColor2 = System.Drawing.Color.FromArgb(185, 215, 255);
|
public static System.Drawing.Color DefaultMainColorLight { get; set; } = System.Drawing.Color.FromArgb(185, 215, 255);
|
||||||
public static System.Drawing.Color KJDBorderColor = System.Drawing.Color.FromArgb(25, 98, 200);
|
public static System.Drawing.Color DefaultBorderColor { get; set; } = System.Drawing.Color.FromArgb(25, 98, 200);
|
||||||
|
|
||||||
public static System.Drawing.Color PddMainColor = System.Drawing.Color.FromArgb(225, 120, 135);
|
public static System.Drawing.Color MainColor { get; set; } = System.Drawing.Color.FromArgb(63, 126, 255);
|
||||||
public static System.Drawing.Color PddMainColor2 = System.Drawing.Color.FromArgb(255, 235, 245);
|
public static System.Drawing.Color MainColorLight { get; set; } = System.Drawing.Color.FromArgb(185, 215, 255);
|
||||||
public static System.Drawing.Color PddBorderColor = System.Drawing.Color.FromArgb(195, 112, 135);
|
public static System.Drawing.Color BorderColor { get; set; } = System.Drawing.Color.FromArgb(25, 98, 200);
|
||||||
|
|
||||||
|
public static System.Drawing.Color PddMainColor { get; set; } = System.Drawing.Color.FromArgb(225, 120, 135);
|
||||||
|
public static System.Drawing.Color PddMainColorLight { get; set; } = System.Drawing.Color.FromArgb(255, 235, 245);
|
||||||
|
public static System.Drawing.Color PddBorderColor { get; set; } = System.Drawing.Color.FromArgb(195, 112, 135);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ShopPlatform
|
public enum ShopPlatform
|
||||||
|
|||||||
@@ -103,68 +103,71 @@ namespace TemuKJD.BaseForms
|
|||||||
setSkinColor(c);
|
setSkinColor(c);
|
||||||
|
|
||||||
// pdd皮肤颜色
|
// pdd皮肤颜色
|
||||||
if (BaseClass.MainPath == "binxixi")
|
if (BaseClass.MainPath == "binxixi" || BaseClass.MainPath == "weixin")
|
||||||
{
|
{
|
||||||
if (c is Panel && c.BackColor == GlobalConfig.KJDMainColor)
|
if (c is Panel && c.BackColor == GlobalConfig.DefaultMainColor)
|
||||||
{
|
{
|
||||||
c.BackColor = GlobalConfig.PddMainColor;
|
c.BackColor = GlobalConfig.MainColor;
|
||||||
}
|
}
|
||||||
if (c is PanelEx && c.Name.StartsWith("btn"))
|
if (c is PanelEx && c.Name.StartsWith("btn"))
|
||||||
{
|
{
|
||||||
var pnl = c as PanelEx;
|
var pnl = c as PanelEx;
|
||||||
if (pnl.Style.BackColor1.Color == GlobalConfig.KJDMainColor)
|
if (pnl.Style.BackColor1.Color == GlobalConfig.DefaultMainColor)
|
||||||
{
|
{
|
||||||
pnl.Style.BackColor1.Color = GlobalConfig.PddMainColor;
|
pnl.Style.BackColor1.Color = GlobalConfig.MainColor;
|
||||||
pnl.Style.BackColor2.Color = GlobalConfig.PddMainColor;
|
pnl.Style.BackColor2.Color = GlobalConfig.MainColor;
|
||||||
pnl.StyleMouseOver.BackColor1.Color = GlobalConfig.PddBorderColor;
|
pnl.StyleMouseOver.BackColor1.Color = GlobalConfig.BorderColor;
|
||||||
pnl.StyleMouseOver.BackColor2.Color = GlobalConfig.PddBorderColor;
|
pnl.StyleMouseOver.BackColor2.Color = GlobalConfig.BorderColor;
|
||||||
}
|
}
|
||||||
else if (pnl.Style.BorderColor.Color == GlobalConfig.KJDMainColor)
|
else if (pnl.Style.BorderColor.Color == GlobalConfig.DefaultMainColor)
|
||||||
{
|
{
|
||||||
pnl.Style.BorderColor.Color = GlobalConfig.PddMainColor;
|
pnl.Style.BorderColor.Color = GlobalConfig.MainColor;
|
||||||
pnl.Style.BackColor1.Color = GlobalConfig.PddMainColor2;
|
pnl.Style.BackColor1.Color = GlobalConfig.MainColorLight;
|
||||||
pnl.Style.BackColor2.Color = GlobalConfig.PddMainColor2;
|
pnl.Style.BackColor2.Color = GlobalConfig.MainColorLight;
|
||||||
pnl.Style.ForeColor.Color = GlobalConfig.PddBorderColor;
|
pnl.Style.ForeColor.Color = GlobalConfig.BorderColor;
|
||||||
pnl.StyleMouseOver.BackColor1.Color = GlobalConfig.PddBorderColor;
|
pnl.StyleMouseOver.BackColor1.Color = GlobalConfig.BorderColor;
|
||||||
pnl.StyleMouseOver.BackColor2.Color = GlobalConfig.PddBorderColor;
|
pnl.StyleMouseOver.BackColor2.Color = GlobalConfig.BorderColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c is ButtonEx)
|
if (c is ButtonEx)
|
||||||
{
|
{
|
||||||
c.BackColor = GlobalConfig.PddMainColor;
|
c.BackColor = GlobalConfig.MainColor;
|
||||||
}
|
}
|
||||||
if (c is SplitContainer && c.BackColor == GlobalConfig.KJDMainColor)
|
if (c is SplitContainer && c.BackColor == GlobalConfig.DefaultMainColor)
|
||||||
{
|
{
|
||||||
c.BackColor = GlobalConfig.PddMainColor;
|
c.BackColor = GlobalConfig.MainColor;
|
||||||
}
|
}
|
||||||
if (c is UserComponent.UcTreeView)
|
if (c is UserComponent.UcTreeView)
|
||||||
{
|
{
|
||||||
var tv = c as UserComponent.UcTreeView;
|
var tv = c as UserComponent.UcTreeView;
|
||||||
tv.ChildNodeSelectedBgColor = GlobalConfig.PddMainColor;
|
tv.ChildNodeSelectedBgColor = GlobalConfig.MainColor;
|
||||||
}
|
}
|
||||||
if (c is UserComponent.UcGroupBoxEx && (c as UserComponent.UcGroupBoxEx).BorderColor == GlobalConfig.KJDMainColor)
|
if (c is UserComponent.UcGroupBoxEx && (c as UserComponent.UcGroupBoxEx).BorderColor == GlobalConfig.DefaultMainColor)
|
||||||
{
|
{
|
||||||
var gb = c as UserComponent.UcGroupBoxEx;
|
var gb = c as UserComponent.UcGroupBoxEx;
|
||||||
gb.BorderColor = GlobalConfig.PddMainColor;
|
gb.BorderColor = GlobalConfig.MainColor;
|
||||||
}
|
}
|
||||||
if (c is UserComponent.DataGridViewEx)
|
if (c is UserComponent.DataGridViewEx)
|
||||||
{
|
{
|
||||||
var dgv = c as UserComponent.DataGridViewEx;
|
var dgv = c as UserComponent.DataGridViewEx;
|
||||||
dgv.BorderColor = GlobalConfig.PddMainColor;
|
dgv.BorderColor = GlobalConfig.MainColor;
|
||||||
dgv.DefaultCellStyle.SelectionBackColor = GlobalConfig.PddMainColor;
|
dgv.DefaultCellStyle.SelectionBackColor = GlobalConfig.MainColor;
|
||||||
|
|
||||||
|
dgv.CheckBoxRowBoxCheckColor = GlobalConfig.MainColor;
|
||||||
|
dgv.CheckBoxRowBoxBorderColor = GlobalConfig.BorderColor;
|
||||||
}
|
}
|
||||||
if (c is UserComponent.UcCheckBox)
|
if (c is UserComponent.UcCheckBox)
|
||||||
{
|
{
|
||||||
var chk = c as UserComponent.UcCheckBox;
|
var chk = c as UserComponent.UcCheckBox;
|
||||||
chk.CheckBoxCheckColor = GlobalConfig.PddMainColor;
|
chk.CheckBoxCheckColor = GlobalConfig.MainColor;
|
||||||
chk.CheckBoxBorderColor = GlobalConfig.PddBorderColor;
|
chk.CheckBoxBorderColor = GlobalConfig.BorderColor;
|
||||||
}
|
}
|
||||||
if (c is UcTabControlMetro)
|
if (c is UcTabControlMetro)
|
||||||
{
|
{
|
||||||
var tc = c as UcTabControlMetro;
|
var tc = c as UcTabControlMetro;
|
||||||
tc.BorderColor = GlobalConfig.PddBorderColor;
|
tc.BorderColor = GlobalConfig.BorderColor;
|
||||||
tc.TabSelectColor = GlobalConfig.PddMainColor;
|
tc.TabSelectColor = GlobalConfig.MainColor;
|
||||||
tc.TabSelectTextColor = GlobalConfig.PddMainColor;
|
tc.TabSelectTextColor = GlobalConfig.MainColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using AllBase;
|
using AllBase;
|
||||||
|
using AllBase.Helper;
|
||||||
using NaiBa.Util;
|
using NaiBa.Util;
|
||||||
using NaiBa.Util.Extension;
|
using NaiBa.Util.Extension;
|
||||||
using System;
|
using System;
|
||||||
@@ -12,6 +13,7 @@ using System.Text;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using TemuKJD.UserComponent;
|
||||||
|
|
||||||
namespace TemuKJD.Extension
|
namespace TemuKJD.Extension
|
||||||
{
|
{
|
||||||
@@ -22,7 +24,7 @@ namespace TemuKJD.Extension
|
|||||||
return CellCollection.Cast<DataGridViewCell>().FirstOrDefault(c => c.OwningColumn.Name == name)?.Value;
|
return CellCollection.Cast<DataGridViewCell>().FirstOrDefault(c => c.OwningColumn.Name == name)?.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CheckBox AddSelectorColumn(this DataGridView dgv, string columnName = "Selected", Action<DataGridViewColumn> addHeaderCheckBoxOverride = null)
|
public static UcCheckBox AddSelectorColumn(this DataGridView dgv, string columnName = "Selected", Action<DataGridViewColumn> addHeaderCheckBoxOverride = null)
|
||||||
{
|
{
|
||||||
if (dgv.Columns[columnName] == null)
|
if (dgv.Columns[columnName] == null)
|
||||||
{
|
{
|
||||||
@@ -53,7 +55,7 @@ namespace TemuKJD.Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CheckBox AddHeaderCheckBox(this DataGridViewColumn column, HorizontalAlignment align = HorizontalAlignment.Center, int leftBorderOffset = 0, int rightBorderOffset = 0, Func<object, bool> getValue = null, Action<object, bool> setValue = null, bool isSetCheckedChangedEvent = true, CheckBox checkBox = null, bool isClearHeaderText = false)
|
public static UcCheckBox AddHeaderCheckBox(this DataGridViewColumn column, HorizontalAlignment align = HorizontalAlignment.Center, int leftBorderOffset = 0, int rightBorderOffset = 0, Func<object, bool> getValue = null, Action<object, bool> setValue = null, bool isSetCheckedChangedEvent = true, UcCheckBox checkBox = null, bool isClearHeaderText = false)
|
||||||
{
|
{
|
||||||
if (column?.DataGridView == null) //throw new ArgumentNullException("First you need to add the column to grid.");
|
if (column?.DataGridView == null) //throw new ArgumentNullException("First you need to add the column to grid.");
|
||||||
MessageBox.Show("DataGridView中没有对应的CheckBox列");
|
MessageBox.Show("DataGridView中没有对应的CheckBox列");
|
||||||
@@ -61,10 +63,11 @@ namespace TemuKJD.Extension
|
|||||||
// Creating checkbox without panel
|
// Creating checkbox without panel
|
||||||
if (checkBox == null)
|
if (checkBox == null)
|
||||||
{
|
{
|
||||||
checkBox = new CheckBox();
|
checkBox = new UcCheckBox();
|
||||||
|
|
||||||
checkBox.Name = "chk" + column.Name;
|
checkBox.Name = "chk" + column.Name;
|
||||||
}
|
}
|
||||||
checkBox.Size = new Size(24, 20);
|
checkBox.Size = new Size(13, 13);
|
||||||
checkBox.BackColor = Color.Transparent;
|
checkBox.BackColor = Color.Transparent;
|
||||||
checkBox.Enabled = true;
|
checkBox.Enabled = true;
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -154,6 +154,9 @@ namespace TemuKJD
|
|||||||
if (loginType == "Pdd")
|
if (loginType == "Pdd")
|
||||||
{
|
{
|
||||||
BaseClass.MainPath = "binxixi";
|
BaseClass.MainPath = "binxixi";
|
||||||
|
GlobalConfig.MainColor = GlobalConfig.PddMainColor;
|
||||||
|
GlobalConfig.MainColorLight = GlobalConfig.PddMainColorLight;
|
||||||
|
GlobalConfig.BorderColor = GlobalConfig.PddBorderColor;
|
||||||
this.pnlJit.Visible = false;
|
this.pnlJit.Visible = false;
|
||||||
}
|
}
|
||||||
else if (loginType == "Dy")
|
else if (loginType == "Dy")
|
||||||
@@ -247,7 +250,7 @@ namespace TemuKJD
|
|||||||
navPanel.Style.BackgroundImage = Properties.Resources.pdd_bg;
|
navPanel.Style.BackgroundImage = Properties.Resources.pdd_bg;
|
||||||
plTopRight.BackgroundImage = null;
|
plTopRight.BackgroundImage = null;
|
||||||
this.BackColor = GlobalConfig.PddBorderColor;
|
this.BackColor = GlobalConfig.PddBorderColor;
|
||||||
lblVersionInfo.ForeColor = GlobalConfig.PddMainColor2;
|
lblVersionInfo.ForeColor = GlobalConfig.PddMainColorLight;
|
||||||
|
|
||||||
BaseClass.ToolName = "29供应链 - 多多管理工具";
|
BaseClass.ToolName = "29供应链 - 多多管理工具";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7698,6 +7698,7 @@ Content-Type: image/jpeg
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
List<Task> tList = new List<Task>();
|
List<Task> tList = new List<Task>();
|
||||||
|
List<string> errStrLst = new List<string>();
|
||||||
foreach (var sku in prodInfo.detail.sku)
|
foreach (var sku in prodInfo.detail.sku)
|
||||||
{
|
{
|
||||||
while (tList.Count >= 10)
|
while (tList.Count >= 10)
|
||||||
@@ -7734,13 +7735,18 @@ Content-Type: image/jpeg
|
|||||||
var pddUpImgApi = new PddApi(shop);
|
var pddUpImgApi = new PddApi(shop);
|
||||||
pddUpImgApi.Data["image"] = "data:image/jpeg;base64," + imgBase64;
|
pddUpImgApi.Data["image"] = "data:image/jpeg;base64," + imgBase64;
|
||||||
var pddUpImgApiRst = pddUpImgApi.PddGoodsImageUpload();
|
var pddUpImgApiRst = pddUpImgApi.PddGoodsImageUpload();
|
||||||
|
if (!pddUpImgApiRst.Contains("\"goods_image_upload_response\""))
|
||||||
|
pddUpImgApiRst = pddUpImgApi.PddGoodsImageUpload();
|
||||||
if (!pddUpImgApiRst.Contains("\"goods_image_upload_response\""))
|
if (!pddUpImgApiRst.Contains("\"goods_image_upload_response\""))
|
||||||
pddUpImgApiRst = pddUpImgApi.PddGoodsImageUpload();
|
pddUpImgApiRst = pddUpImgApi.PddGoodsImageUpload();
|
||||||
if (!pddUpImgApiRst.Contains("\"goods_image_upload_response\""))
|
if (!pddUpImgApiRst.Contains("\"goods_image_upload_response\""))
|
||||||
{
|
{
|
||||||
errMsg = BaseRegex.GetStringJson(ref pddUpImgApiRst, "error_msg");
|
errMsg = BaseRegex.GetStringJson(ref pddUpImgApiRst, "error_msg");
|
||||||
|
if (string.IsNullOrEmpty(errMsg))
|
||||||
|
errMsg = BaseRegex.GetStringJson(ref pddUpImgApiRst, "errorMsg");
|
||||||
if (string.IsNullOrEmpty(errMsg))
|
if (string.IsNullOrEmpty(errMsg))
|
||||||
errMsg = pddUpImgApiRst;
|
errMsg = pddUpImgApiRst;
|
||||||
|
errStrLst.Add("生成Sku图片错误 " + errMsg);
|
||||||
return "生成Sku图片错误 " + errMsg;
|
return "生成Sku图片错误 " + errMsg;
|
||||||
}
|
}
|
||||||
var thumb_url = BaseRegex.GetStringJson(ref pddUpImgApiRst, "image_url");
|
var thumb_url = BaseRegex.GetStringJson(ref pddUpImgApiRst, "image_url");
|
||||||
@@ -7748,7 +7754,8 @@ Content-Type: image/jpeg
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
errStrLst.Add("生成Ai图片错误 " + html);
|
||||||
|
return "生成Ai图片错误 " + html;
|
||||||
}
|
}
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
@@ -7764,6 +7771,11 @@ Content-Type: image/jpeg
|
|||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
tList.RemoveAll(t => t.IsCanceled || t.IsFaulted || t.IsCompleted);
|
tList.RemoveAll(t => t.IsCanceled || t.IsFaulted || t.IsCompleted);
|
||||||
}
|
}
|
||||||
|
// 错误超过一定数量直接报错返回
|
||||||
|
if (errStrLst.Count > 0 && errStrLst.Count >= prodInfo.detail.sku.Count / 3)
|
||||||
|
{
|
||||||
|
return string.Join(",", errStrLst);
|
||||||
|
}
|
||||||
|
|
||||||
// 重新设置ai主图
|
// 重新设置ai主图
|
||||||
var newMainImgLst = prodInfo.detail.sku.Select(s => s.thumb_url).OrderBy(x => Guid.NewGuid()).ToList();
|
var newMainImgLst = prodInfo.detail.sku.Select(s => s.thumb_url).OrderBy(x => Guid.NewGuid()).ToList();
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ using System.Windows.Forms.VisualStyles;
|
|||||||
|
|
||||||
namespace TemuKJD.UserComponent
|
namespace TemuKJD.UserComponent
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 带表头全选的选择框列
|
||||||
|
/// </summary>
|
||||||
public class DataGridViewCheckBoxColumnSelectAll : DataGridViewCheckBoxColumn
|
public class DataGridViewCheckBoxColumnSelectAll : DataGridViewCheckBoxColumn
|
||||||
{
|
{
|
||||||
private DatagridViewCheckBoxHeaderCell headerCell;
|
private DatagridViewCheckBoxHeaderCell headerCell;
|
||||||
@@ -100,7 +103,6 @@ namespace TemuKJD.UserComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 头被选中时触发OnCheckBoxClicked事件.
|
/// 头被选中时触发OnCheckBoxClicked事件.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -113,7 +115,6 @@ namespace TemuKJD.UserComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public delegate void CheckBoxClickedHandler(bool state);
|
public delegate void CheckBoxClickedHandler(bool state);
|
||||||
|
|
||||||
internal class DatagridViewCheckBoxHeaderCell : DataGridViewColumnHeaderCell
|
internal class DatagridViewCheckBoxHeaderCell : DataGridViewColumnHeaderCell
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ namespace TemuKJD.UserComponent
|
|||||||
ControlStyles.AllPaintingInWmPaint,
|
ControlStyles.AllPaintingInWmPaint,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
|
this.CellPainting += DataGridViewEx_CellPainting;
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 50; i++)
|
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));
|
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;
|
private bool multiSelectCheckBox = true;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 选择框批量选中(使用Shift按键)
|
/// 选择框批量选中(使用Shift按键)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using AllBase.Helper;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -16,38 +17,45 @@ namespace TemuKJD.UserComponent
|
|||||||
public UcCheckBox()
|
public UcCheckBox()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.CheckBoxCheckColor = GlobalConfig.MainColor;
|
||||||
|
this.CheckBoxBorderColor = GlobalConfig.BorderColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UcCheckBox(IContainer container)
|
public UcCheckBox(IContainer container)
|
||||||
{
|
{
|
||||||
container.Add(this);
|
container.Add(this);
|
||||||
|
this.CheckBoxCheckColor = GlobalConfig.MainColor;
|
||||||
|
this.CheckBoxBorderColor = GlobalConfig.BorderColor;
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int checkBoxSize = 12;
|
private int checkBoxSize = 12;
|
||||||
public Color CheckBoxColor = Color.White;
|
public Color CheckBoxColor = Color.White;
|
||||||
public Color CheckBoxCheckColor = Color.Blue;
|
public Color CheckBoxCheckColor = GlobalConfig.DefaultMainColor;
|
||||||
public Color CheckBoxBorderColor = Color.Blue;
|
public Color CheckBoxBorderColor = GlobalConfig.DefaultBorderColor;
|
||||||
|
|
||||||
protected override void OnPaint(PaintEventArgs e)
|
protected override void OnPaint(PaintEventArgs e)
|
||||||
{
|
{
|
||||||
//base.OnPaint(e); // 禁用系统绘制
|
//base.OnPaint(e); // 禁用系统绘制全部
|
||||||
|
base.OnPaintBackground(e); // 使用系统绘制背景
|
||||||
|
|
||||||
//if (e.ClipRectangle.X != 0 || e.ClipRectangle.Y != 0)
|
//if (e.ClipRectangle.X != 0 || e.ClipRectangle.Y != 0)
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
Graphics g = e.Graphics;
|
Graphics g = e.Graphics;
|
||||||
g.Clear(this.BackColor);
|
//g.Clear(this.CheckBoxColor);
|
||||||
|
|
||||||
//填充背景色
|
//填充背景色
|
||||||
//g.FillRectangle(new SolidBrush(this.BackColor), e.ClipRectangle);
|
//g.FillRectangle(new SolidBrush(this.BackColor), e.ClipRectangle);
|
||||||
g.FillRectangle(new SolidBrush(this.BackColor), this.ClientRectangle);
|
g.FillRectangle(new SolidBrush(this.BackColor), this.ClientRectangle);
|
||||||
|
|
||||||
|
Size size = TextRenderer.MeasureText(this.Text, Font);
|
||||||
//绘制圆形(注释此句,以备后用)
|
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; // 或者 AntiAliasGridFit // 平滑字体
|
||||||
//Brush brush = new SolidBrush(this.Checked ? checkBoxCheckColor : checkBoxColor);
|
//e.Graphics.DrawString(this.Text, Font, new SolidBrush(this.ForeColor),
|
||||||
//g.FillEllipse(brush, 0, (Height - checkBoxSize) / 2, checkBoxSize, checkBoxSize); // 绘制圆形按钮
|
// new PointF(e.ClipRectangle.X + checkBoxSize + 2 + Padding.Left, e.ClipRectangle.Y + (Height - size.Height) / 2));
|
||||||
|
e.Graphics.DrawString(this.Text, Font, new SolidBrush(this.ForeColor),
|
||||||
|
new PointF(this.ClientRectangle.X + checkBoxSize + 2 + Padding.Left, this.ClientRectangle.Y + (Height - size.Height) / 2));
|
||||||
|
|
||||||
Rectangle rt = new Rectangle();
|
Rectangle rt = new Rectangle();
|
||||||
rt.X = 0;
|
rt.X = 0;
|
||||||
@@ -55,28 +63,41 @@ namespace TemuKJD.UserComponent
|
|||||||
rt.Width = checkBoxSize;
|
rt.Width = checkBoxSize;
|
||||||
rt.Height = checkBoxSize;
|
rt.Height = checkBoxSize;
|
||||||
|
|
||||||
Color color = this.Checked ? CheckBoxCheckColor : CheckBoxColor;
|
DrawCheckBoxIcon(g, rt, this.Checked, this.CheckBoxColor, this.CheckBoxCheckColor, this.CheckBoxBorderColor);
|
||||||
DrawRoundedRectangle(g, rt, 2, color, true);
|
|
||||||
DrawRoundedRectangle(g, rt, 2, CheckBoxBorderColor);
|
|
||||||
|
|
||||||
if (this.Checked)
|
|
||||||
{
|
|
||||||
// 绘制勾号
|
|
||||||
Pen p = new Pen(Color.FromArgb(180, 255, 255, 255));
|
|
||||||
//g.DrawLine(Pens.SkyBlue, rt.X + 3, rt.Y + 6, rt.X + 5, rt.Y + 8);
|
|
||||||
//g.DrawLine(Pens.SkyBlue, rt.X + 5, rt.Y + 8, rt.X + 9, rt.Y + 4);
|
|
||||||
g.DrawLine(p, rt.X + 3, rt.Y + 6, rt.X + 5, rt.Y + 8);
|
|
||||||
g.DrawLine(p, rt.X + 5, rt.Y + 8, rt.X + 9, rt.Y + 4);
|
|
||||||
}
|
|
||||||
Size size = TextRenderer.MeasureText(this.Text, Font);
|
|
||||||
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; // 或者 AntiAliasGridFit // 平滑字体
|
|
||||||
//e.Graphics.DrawString(this.Text, Font, new SolidBrush(this.ForeColor),
|
|
||||||
// new PointF(e.ClipRectangle.X + checkBoxSize + 2 + Padding.Left, e.ClipRectangle.Y + (Height - size.Height) / 2));
|
|
||||||
e.Graphics.DrawString(this.Text, Font, new SolidBrush(this.ForeColor),
|
|
||||||
new PointF(this.ClientRectangle.X + checkBoxSize + 2 + Padding.Left, this.ClientRectangle.Y + (Height - size.Height) / 2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawRoundedRectangle(Graphics g, Rectangle rect, int radius, Color color, bool isFill = false)
|
public static void DrawCheckBoxIcon(Graphics g, Rectangle rt, bool isChecked, Color checkBoxColor, Color checkBoxCheckColor, Color checkBoxBorderColor)
|
||||||
|
{
|
||||||
|
//绘制圆形(注释此句,以备后用)
|
||||||
|
//Brush brush = new SolidBrush(this.Checked ? checkBoxCheckColor : checkBoxColor);
|
||||||
|
//g.FillEllipse(brush, 0, (Height - checkBoxSize) / 2, checkBoxSize, checkBoxSize); // 绘制圆形按钮
|
||||||
|
|
||||||
|
Color color = isChecked ? checkBoxCheckColor : checkBoxColor;
|
||||||
|
|
||||||
|
if (isChecked)
|
||||||
|
{
|
||||||
|
DrawRoundedRectangle(g, rt, 2, color, true);
|
||||||
|
DrawRoundedRectangle(g, rt, 2, checkBoxBorderColor);
|
||||||
|
|
||||||
|
// 绘制勾号
|
||||||
|
Pen p = new Pen(Color.FromArgb(220, 255, 255, 255), 1);
|
||||||
|
//g.DrawLine(Pens.SkyBlue, rt.X + 3, rt.Y + 6, rt.X + 5, rt.Y + 8);
|
||||||
|
//g.DrawLine(Pens.SkyBlue, rt.X + 5, rt.Y + 8, rt.X + 9, rt.Y + 4);
|
||||||
|
g.DrawLine(p, rt.X + 3, rt.Y + 5, rt.X + 5, rt.Y + 7);
|
||||||
|
g.DrawLine(p, rt.X + 5, rt.Y + 7, rt.X + 9, rt.Y + 3);
|
||||||
|
g.DrawLine(p, rt.X + 3, rt.Y + 6, rt.X + 5, rt.Y + 8);
|
||||||
|
g.DrawLine(p, rt.X + 5, rt.Y + 8, rt.X + 9, rt.Y + 4);
|
||||||
|
g.DrawLine(p, rt.X + 3, rt.Y + 7, rt.X + 5, rt.Y + 9);
|
||||||
|
g.DrawLine(p, rt.X + 5, rt.Y + 9, rt.X + 9, rt.Y + 5);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawRoundedRectangle(g, rt, 3, color, true);
|
||||||
|
DrawRoundedRectangle(g, rt, 3, checkBoxBorderColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DrawRoundedRectangle(Graphics g, Rectangle rect, int radius, Color color, bool isFill = false)
|
||||||
{
|
{
|
||||||
using (GraphicsPath path = new GraphicsPath())
|
using (GraphicsPath path = new GraphicsPath())
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -72,7 +72,7 @@ namespace TemuKJD.WXForms.AdminForms
|
|||||||
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
|
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
|
||||||
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
|
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
|
||||||
this.panel3 = new System.Windows.Forms.Panel();
|
this.panel3 = new System.Windows.Forms.Panel();
|
||||||
this.colSelect = new TemuKJD.UserComponent.DataGridViewCheckBoxColumnSelectAll();
|
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||||
this.colLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.colLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.colShopAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.colShopAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
@@ -1055,7 +1055,7 @@ namespace TemuKJD.WXForms.AdminForms
|
|||||||
private System.Windows.Forms.Panel panel3;
|
private System.Windows.Forms.Panel panel3;
|
||||||
public System.Windows.Forms.Label lblAddToAccount;
|
public System.Windows.Forms.Label lblAddToAccount;
|
||||||
public DevComponents.DotNetBar.PanelEx btnAddToAccount;
|
public DevComponents.DotNetBar.PanelEx btnAddToAccount;
|
||||||
private UserComponent.DataGridViewCheckBoxColumnSelectAll colSelect;
|
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn colLoginName;
|
private System.Windows.Forms.DataGridViewTextBoxColumn colLoginName;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
|
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopAccount;
|
private System.Windows.Forms.DataGridViewTextBoxColumn colShopAccount;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace TemuKJD.WXForms.AdminForms
|
|||||||
{
|
{
|
||||||
this.ucSplitPage1.PageChange += UcSplitPage1_PageChange;
|
this.ucSplitPage1.PageChange += UcSplitPage1_PageChange;
|
||||||
|
|
||||||
//this.dgvShop.AddSelectorColumn("colSelect");
|
this.dgvShop.AddSelectorColumn("colSelect");
|
||||||
this.dgvShop.AddMergeColumnHeader(new List<string>() { /*"colMinus",*/ "colProductRemaining", "colPlus" }, "选品限额");
|
this.dgvShop.AddMergeColumnHeader(new List<string>() { /*"colMinus",*/ "colProductRemaining", "colPlus" }, "选品限额");
|
||||||
this.dgvShop.AddMergeColumn(new List<string>() { /*"colMinus",*/ "colProductRemaining", "colPlus" });
|
this.dgvShop.AddMergeColumn(new List<string>() { /*"colMinus",*/ "colProductRemaining", "colPlus" });
|
||||||
this.dgvShop.Columns["colMinus"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
this.dgvShop.Columns["colMinus"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||||
|
|||||||
Reference in new issue
Block a user