图片加文字功能

This commit is contained in:
wule_5900x committed 2026-03-02 01:28:14 +08:00
1 parent fc31b4c48f
commit cce4c9da2d
9 files changed
+544 -20

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ namespace AllBase
/// <summary>
/// 版本ID
/// </summary>
public static int VersionCount = 875;
public static int VersionCount = 876;
//public static int VersionCount = 613;
/// <summary>
+9
View File
@@ -155,6 +155,12 @@
<Compile Include="ToolForms\GetJuShuitanProdForm.Designer.cs">
<DependentUpon>GetJuShuitanProdForm.cs</DependentUpon>
</Compile>
<Compile Include="ToolForms\ImgToolForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ToolForms\ImgToolForm.Designer.cs">
<DependentUpon>ImgToolForm.cs</DependentUpon>
</Compile>
<Compile Include="WXForms\AdminForms\WXAdminShopListForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -1087,6 +1093,9 @@
<EmbeddedResource Include="ToolForms\GetJuShuitanProdForm.resx">
<DependentUpon>GetJuShuitanProdForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ToolForms\ImgToolForm.resx">
<DependentUpon>ImgToolForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="WXForms\AdminForms\WXAdminShopListForm.resx">
<DependentUpon>WXAdminShopListForm.cs</DependentUpon>
</EmbeddedResource>
+9 -8
View File
@@ -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[] {
"全部",
"拼多多",
"抖音",
"淘宝",
+11 -5
View File
@@ -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 = "";
}
}
+256
View File
@@ -0,0 +1,256 @@
namespace TemuKJD.ToolForms
{
partial class ImgToolForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}
+124
View File
@@ -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;
}
}
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+9 -5
View File
@@ -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;
+5 -1
View File
@@ -21,6 +21,7 @@ namespace TemuKJD.WXForms.AdminForms
public Lazy<WXAdminShopListForm> adminShopForm = new Lazy<WXAdminShopListForm>();
public Lazy<PDDDBProdListForm> pddDbProdListForm = new Lazy<PDDDBProdListForm>();
public Lazy<GetJuShuitanProdForm> getJuShuitanProdForm = new Lazy<GetJuShuitanProdForm>();
public Lazy<ImgToolForm> imgToolForm = new Lazy<ImgToolForm>();
public WXAdminForm()
{
@@ -31,7 +32,7 @@ namespace TemuKJD.WXForms.AdminForms
tv.SelectedNode = tv.Nodes[0].Nodes[0];
tv.ExpandGroup(tv.Nodes[0].Name);
List<string> hideName = new List<string>() { "超级用户管理", "超级店铺管理", "PDD产品库", "SKU替换图", "选品加价管理", "认领待上传", "库存上传", "商品核价" };
List<string> hideName = new List<string>() { "图片工具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();