diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 6242c5c..bfdaf71 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 875; + public static int VersionCount = 876; //public static int VersionCount = 613; /// diff --git a/TEMUKJD/KJD.csproj b/TEMUKJD/KJD.csproj index f76f0d6..a69dc5a 100644 --- a/TEMUKJD/KJD.csproj +++ b/TEMUKJD/KJD.csproj @@ -155,6 +155,12 @@ GetJuShuitanProdForm.cs + + Form + + + ImgToolForm.cs + Form @@ -1087,6 +1093,9 @@ GetJuShuitanProdForm.cs + + ImgToolForm.cs + WXAdminShopListForm.cs diff --git a/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs b/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs index ab238a4..964b9d1 100644 --- a/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs +++ b/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs @@ -160,7 +160,7 @@ namespace TemuKJD.ToolForms this.splitContainer2.Panel1.Controls.Add(this.btnNext); this.splitContainer2.Panel1.Controls.Add(this.btnPrev); this.splitContainer2.Panel1.Controls.Add(this.txtAddress); - this.splitContainer2.Size = new System.Drawing.Size(1390, 432); + this.splitContainer2.Size = new System.Drawing.Size(1390, 433); this.splitContainer2.SplitterDistance = 26; this.splitContainer2.TabIndex = 6; // @@ -398,7 +398,7 @@ namespace TemuKJD.ToolForms this.splitContainer1.Panel2.Controls.Add(this.btnImportCookie); this.splitContainer1.Panel2.Controls.Add(this.label2); this.splitContainer1.Size = new System.Drawing.Size(1404, 561); - this.splitContainer1.SplitterDistance = 468; + this.splitContainer1.SplitterDistance = 469; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // @@ -414,7 +414,7 @@ namespace TemuKJD.ToolForms this.ucTabControlMetro1.Name = "ucTabControlMetro1"; this.ucTabControlMetro1.SelectedIndex = 0; this.ucTabControlMetro1.ShowCloseButton = false; - this.ucTabControlMetro1.Size = new System.Drawing.Size(1404, 468); + this.ucTabControlMetro1.Size = new System.Drawing.Size(1404, 469); this.ucTabControlMetro1.TabIndex = 462; this.ucTabControlMetro1.TabSelectColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucTabControlMetro1.TabSelectTextColor = System.Drawing.Color.Gray; @@ -426,7 +426,7 @@ namespace TemuKJD.ToolForms this.tabPage1.Location = new System.Drawing.Point(4, 26); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(1396, 438); + this.tabPage1.Size = new System.Drawing.Size(1396, 439); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "商品页面"; this.tabPage1.UseVisualStyleBackColor = true; @@ -448,7 +448,7 @@ namespace TemuKJD.ToolForms this.tabPage3.Controls.Add(this.splitContainer3); this.tabPage3.Location = new System.Drawing.Point(4, 26); this.tabPage3.Name = "tabPage3"; - this.tabPage3.Size = new System.Drawing.Size(1396, 437); + this.tabPage3.Size = new System.Drawing.Size(1396, 438); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "下架SKU查询"; this.tabPage3.UseVisualStyleBackColor = true; @@ -480,7 +480,7 @@ namespace TemuKJD.ToolForms // this.splitContainer3.Panel2.Controls.Add(this.pictureBox1); this.splitContainer3.Panel2.Controls.Add(this.dgvDownSku); - this.splitContainer3.Size = new System.Drawing.Size(1396, 437); + this.splitContainer3.Size = new System.Drawing.Size(1396, 438); this.splitContainer3.SplitterDistance = 82; this.splitContainer3.TabIndex = 0; // @@ -638,7 +638,7 @@ namespace TemuKJD.ToolForms // this.pictureBox1.Anchor = System.Windows.Forms.AnchorStyles.None; this.pictureBox1.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pictureBox1.Location = new System.Drawing.Point(673, 150); + this.pictureBox1.Location = new System.Drawing.Point(673, 151); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(50, 50); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -686,7 +686,7 @@ namespace TemuKJD.ToolForms this.dgvDownSku.Name = "dgvDownSku"; this.dgvDownSku.ReadOnly = true; this.dgvDownSku.RowTemplate.Height = 23; - this.dgvDownSku.Size = new System.Drawing.Size(1396, 351); + this.dgvDownSku.Size = new System.Drawing.Size(1396, 352); this.dgvDownSku.TabIndex = 8; // // colDownSelect @@ -999,6 +999,7 @@ namespace TemuKJD.ToolForms this.cmbPlatformType.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.cmbPlatformType.FormattingEnabled = true; this.cmbPlatformType.Items.AddRange(new object[] { + "全部", "拼多多", "抖音", "淘宝", diff --git a/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs b/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs index 221153f..16a360f 100644 --- a/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs +++ b/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs @@ -453,7 +453,8 @@ namespace TemuKJD.ToolForms Jobj["pageNum"] = page; //Jobj["mallSort"] = "SELL_SEVEN"; // 采集近7日爆品 //CREATED 采集近30日新品 - Jobj["platformType"] = platformType; + if (!string.IsNullOrEmpty(platformType)) + Jobj["platformType"] = platformType; Invoke(new Action(() => { this.statusBar.lblTaskStatus.Text = "正在采集第 " + page + " 页"; @@ -609,7 +610,8 @@ namespace TemuKJD.ToolForms Jobj["pageNum"] = page; //Jobj["mallSort"] = "SELL_SEVEN"; - Jobj["platformType"] = platformType; + if (!string.IsNullOrEmpty(platformType)) + Jobj["platformType"] = platformType; Invoke(new Action(() => { this.statusBar.lblTaskStatus.Text = "正在采集第 " + page + " 页"; @@ -781,7 +783,7 @@ namespace TemuKJD.ToolForms private void btnGetDetail_Click(object sender, EventArgs e) { - if (platformType == "Pinduoduo") + if (platformType == "Pinduoduo" || string.IsNullOrEmpty(platformType)) GetPinDuoduoProd(); else if (platformType == "douyin") GetDyProd(); @@ -977,7 +979,11 @@ namespace TemuKJD.ToolForms private void cmbPlatformType_SelectedIndexChanged(object sender, EventArgs e) { //["TouTiaoFXG","Taobao","Pinduoduo","WXChannel"] - if (cmbPlatformType.Text == "抖音") + if (cmbPlatformType.Text == "拼多多") + { + platformType = "Pinduoduo"; + } + else if (cmbPlatformType.Text == "抖音") { platformType = "douyin"; } @@ -991,7 +997,7 @@ namespace TemuKJD.ToolForms } else { - platformType = "Pinduoduo"; + platformType = ""; } } diff --git a/TEMUKJD/ToolForms/ImgToolForm.Designer.cs b/TEMUKJD/ToolForms/ImgToolForm.Designer.cs new file mode 100644 index 0000000..7b014f8 --- /dev/null +++ b/TEMUKJD/ToolForms/ImgToolForm.Designer.cs @@ -0,0 +1,256 @@ + +namespace TemuKJD.ToolForms +{ + partial class ImgToolForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.btnSelectImg = new DevComponents.DotNetBar.PanelEx(); + this.btnSave = new DevComponents.DotNetBar.PanelEx(); + this.btnMake = new DevComponents.DotNetBar.PanelEx(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.pbImage = new System.Windows.Forms.PictureBox(); + this.txtX = new System.Windows.Forms.TextBox(); + this.txtY = new System.Windows.Forms.TextBox(); + this.txtSize = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pbImage)).BeginInit(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.BackColor = System.Drawing.Color.White; + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.label3); + this.splitContainer1.Panel1.Controls.Add(this.label2); + this.splitContainer1.Panel1.Controls.Add(this.txtSize); + this.splitContainer1.Panel1.Controls.Add(this.txtY); + this.splitContainer1.Panel1.Controls.Add(this.txtX); + this.splitContainer1.Panel1.Controls.Add(this.btnSelectImg); + this.splitContainer1.Panel1.Controls.Add(this.btnSave); + this.splitContainer1.Panel1.Controls.Add(this.btnMake); + this.splitContainer1.Panel1.Controls.Add(this.label1); + this.splitContainer1.Panel1.Controls.Add(this.textBox1); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.pbImage); + this.splitContainer1.Size = new System.Drawing.Size(800, 530); + this.splitContainer1.SplitterDistance = 266; + this.splitContainer1.TabIndex = 0; + // + // btnSelectImg + // + this.btnSelectImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnSelectImg.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnSelectImg.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnSelectImg.DisabledBackColor = System.Drawing.Color.Empty; + this.btnSelectImg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnSelectImg.Location = new System.Drawing.Point(26, 130); + this.btnSelectImg.Name = "btnSelectImg"; + this.btnSelectImg.Size = new System.Drawing.Size(79, 25); + this.btnSelectImg.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnSelectImg.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSelectImg.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSelectImg.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnSelectImg.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnSelectImg.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnSelectImg.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnSelectImg.Style.GradientAngle = 90; + this.btnSelectImg.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnSelectImg.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSelectImg.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSelectImg.TabIndex = 730; + this.btnSelectImg.Text = "选择图片"; + this.btnSelectImg.Click += new System.EventHandler(this.btnSelectImg_Click); + // + // btnSave + // + this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnSave.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnSave.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnSave.DisabledBackColor = System.Drawing.Color.Empty; + this.btnSave.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnSave.Location = new System.Drawing.Point(155, 164); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(55, 25); + this.btnSave.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnSave.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSave.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSave.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnSave.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnSave.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnSave.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnSave.Style.GradientAngle = 90; + this.btnSave.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnSave.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSave.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSave.TabIndex = 726; + this.btnSave.Text = "保存"; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // btnMake + // + this.btnMake.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnMake.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnMake.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnMake.DisabledBackColor = System.Drawing.Color.Empty; + this.btnMake.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnMake.Location = new System.Drawing.Point(155, 130); + this.btnMake.Name = "btnMake"; + this.btnMake.Size = new System.Drawing.Size(55, 25); + this.btnMake.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnMake.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnMake.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnMake.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnMake.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnMake.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnMake.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnMake.Style.GradientAngle = 90; + this.btnMake.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnMake.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnMake.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnMake.TabIndex = 722; + this.btnMake.Text = "生成"; + this.btnMake.Click += new System.EventHandler(this.btnMake_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(23, 29); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(56, 17); + this.label1.TabIndex = 1; + this.label1.Text = "图片文字"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(83, 26); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(127, 23); + this.textBox1.TabIndex = 0; + // + // pbImage + // + this.pbImage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pbImage.Dock = System.Windows.Forms.DockStyle.Fill; + this.pbImage.Location = new System.Drawing.Point(0, 0); + this.pbImage.Name = "pbImage"; + this.pbImage.Size = new System.Drawing.Size(530, 530); + this.pbImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pbImage.TabIndex = 707; + this.pbImage.TabStop = false; + // + // txtX + // + this.txtX.Location = new System.Drawing.Point(83, 62); + this.txtX.Name = "txtX"; + this.txtX.Size = new System.Drawing.Size(61, 23); + this.txtX.TabIndex = 740; + this.txtX.Text = "860"; + // + // txtY + // + this.txtY.Location = new System.Drawing.Point(149, 62); + this.txtY.Name = "txtY"; + this.txtY.Size = new System.Drawing.Size(61, 23); + this.txtY.TabIndex = 741; + this.txtY.Text = "1020"; + // + // txtSize + // + this.txtSize.Location = new System.Drawing.Point(83, 96); + this.txtSize.Name = "txtSize"; + this.txtSize.Size = new System.Drawing.Size(127, 23); + this.txtSize.TabIndex = 742; + this.txtSize.Text = "44"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(23, 65); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(56, 17); + this.label2.TabIndex = 743; + this.label2.Text = "文字坐标"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(23, 99); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(56, 17); + this.label3.TabIndex = 744; + this.label3.Text = "文字尺寸"; + // + // ImgToolForm + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.ClientSize = new System.Drawing.Size(800, 530); + this.Controls.Add(this.splitContainer1); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Name = "ImgToolForm"; + this.Text = "ImgToolForm"; + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pbImage)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private DevComponents.DotNetBar.PanelEx btnSave; + private DevComponents.DotNetBar.PanelEx btnMake; + private DevComponents.DotNetBar.PanelEx btnSelectImg; + private System.Windows.Forms.PictureBox pbImage; + private System.Windows.Forms.TextBox txtY; + private System.Windows.Forms.TextBox txtX; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtSize; + } +} \ No newline at end of file diff --git a/TEMUKJD/ToolForms/ImgToolForm.cs b/TEMUKJD/ToolForms/ImgToolForm.cs new file mode 100644 index 0000000..9ca36bd --- /dev/null +++ b/TEMUKJD/ToolForms/ImgToolForm.cs @@ -0,0 +1,124 @@ +using NaiBa.Util.Extension; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using TemuKJD.BaseForms; + +namespace TemuKJD.ToolForms +{ + public partial class ImgToolForm : Form + { + public ImgToolForm() + { + InitializeComponent(); + } + + Image baseImg; + Image newImg; + + private void btnMake_Click(object sender, EventArgs e) + { + if(baseImg == null) + { + BaseMsgForm.ShowError("请先选择图片"); + return; + } + + var newImg = new Bitmap(baseImg.Width, baseImg.Height); + using (Graphics g = Graphics.FromImage(newImg)) + { + //g.Clear(Color.White); + g.DrawImage(baseImg, new Rectangle(0, 0, newImg.Width, newImg.Height), 0, 0, baseImg.Width, baseImg.Height, GraphicsUnit.Pixel); + + g.FillRectangle(Brushes.White, txtX.Text.Trim().ParseToInt(), txtY.Text.Trim().ParseToInt(), 500, 120); + + //Font font = new Font("宋体", txtSize.Text.Trim().ParseToInt(), FontStyle.Bold); + Font font = new Font("宋体", txtSize.Text.Trim().ParseToInt(), FontStyle.Regular); + //Font font = new Font("微软雅黑", 15, FontStyle.Regular); + Brush textBrush = Brushes.Black; + textBrush = new SolidBrush(Color.FromArgb(0,0,0)); + g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; + RectangleF rectF = new RectangleF(txtX.Text.Trim().ParseToInt(), txtY.Text.Trim().ParseToInt(), baseImg.Width - 80, baseImg.Height - 80); + if (!string.IsNullOrWhiteSpace(textBox1.Text.Trim())) + g.DrawString(textBox1.Text.Trim(), font, textBrush, rectF); + } + + this.pbImage.Image = newImg; + } + + private void btnSave_Click(object sender, EventArgs e) + { + if (this.pbImage.Image == null) + { + BaseMsgForm.ShowError("图片为空!"); + return; + } + + string fileName = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".jpg"; + if (!string.IsNullOrEmpty(this.pbImage.ImageLocation)) + { + fileName = this.pbImage.ImageLocation.Replace("://", ".").Replace('/', '.'); + } + SaveFileDialog sfd = new SaveFileDialog(); + sfd.Filter = "JPeg Image|*.jpg;*.jpeg"; + sfd.Title = "保存图片"; + sfd.FileName = fileName; + if (sfd.ShowDialog() == DialogResult.OK) + { + try + { + pbImage.Image.Save(sfd.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); + } + catch (Exception ex) + { + BaseMsgForm.ShowError(ex.Message); + } + } + } + + private void btnSelectImg_Click(object sender, EventArgs e) + { + OpenFileDialog openFileDialog = new OpenFileDialog(); + openFileDialog.Multiselect = false; + // 设置过滤条件,只显示文本文件 + openFileDialog.Filter = "图片文件 (*.jpeg;*.jpg;*.png)|*.jpeg;*.jpg;*.png|All files (*.*)|*.*"; + // 显示对话框并获取结果 + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + try + { + string filePath = openFileDialog.FileName; + Image image = Image.FromFile(filePath); + + string imgBase64 = ""; + using (MemoryStream memoryStream = new MemoryStream()) + { + image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg); + byte[] imageBytes = memoryStream.ToArray(); + imgBase64 = Convert.ToBase64String(imageBytes); + } + //string img_md5 = BaseClass.GetMd5(imgBase64); + if (this.pbImage.Tag.ParseToString() != imgBase64) + { + this.pbImage.Tag = imgBase64; + this.pbImage.ImageLocation = ""; + this.pbImage.Image = image; + this.baseImg = image; + } + } + catch (Exception ex) + { + BaseMsgForm.ShowError("打开自定义sku图片失败 " + ex.Message); + return; + } + } + } + } +} diff --git a/TEMUKJD/ToolForms/ImgToolForm.resx b/TEMUKJD/ToolForms/ImgToolForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/TEMUKJD/ToolForms/ImgToolForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs b/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs index 5d51103..6999616 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs @@ -32,11 +32,13 @@ System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("超级用户管理"); System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("PDD产品库"); System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("厂家商品采集"); - System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] { + System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("图片工具"); + System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] { treeNode1, treeNode2, treeNode3, - treeNode4}); + treeNode4, + treeNode5}); this.panel1 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); @@ -135,10 +137,12 @@ treeNode3.Text = "PDD产品库"; treeNode4.Name = "厂家商品采集"; treeNode4.Text = "厂家商品采集"; - treeNode5.Name = "超级权限管理"; - treeNode5.Text = "超级权限管理"; + treeNode5.Name = "图片工具"; + treeNode5.Text = "图片工具"; + treeNode6.Name = "超级权限管理"; + treeNode6.Text = "超级权限管理"; this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { - treeNode5}); + treeNode6}); this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); this.tv.Size = new System.Drawing.Size(140, 446); this.tv.TabIndex = 1; diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs b/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs index 628707f..c70ca19 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs @@ -21,6 +21,7 @@ namespace TemuKJD.WXForms.AdminForms public Lazy adminShopForm = new Lazy(); public Lazy pddDbProdListForm = new Lazy(); public Lazy getJuShuitanProdForm = new Lazy(); + public Lazy imgToolForm = new Lazy(); public WXAdminForm() { @@ -31,7 +32,7 @@ namespace TemuKJD.WXForms.AdminForms tv.SelectedNode = tv.Nodes[0].Nodes[0]; tv.ExpandGroup(tv.Nodes[0].Name); - List hideName = new List() { "超级用户管理", "超级店铺管理", "PDD产品库", "SKU替换图", "选品加价管理", "认领待上传", "库存上传", "商品核价" }; + List hideName = new List() { "图片工具1", "超级用户管理", "超级店铺管理", "PDD产品库", "SKU替换图", "选品加价管理", "认领待上传", "库存上传", "商品核价" }; if (BaseClass.GroupId == 3) { @@ -84,6 +85,9 @@ namespace TemuKJD.WXForms.AdminForms case "厂家商品采集": SetForm(getJuShuitanProdForm.Value); break; + case "图片工具": + SetForm(imgToolForm.Value); + break; } //})); //}).Start();