update 20250129
This commit is contained in:
Generated
+305
-3
@@ -32,6 +32,32 @@
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.textBox4 = new System.Windows.Forms.TextBox();
|
||||
this.textBox5 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.textBox6 = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.textBox7 = new System.Windows.Forms.TextBox();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.textBox8 = new System.Windows.Forms.TextBox();
|
||||
this.textBox9 = new System.Windows.Forms.TextBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.textBox10 = new System.Windows.Forms.TextBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.textBox11 = new System.Windows.Forms.TextBox();
|
||||
this.textBox12 = new System.Windows.Forms.TextBox();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.textBox13 = new System.Windows.Forms.TextBox();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -54,7 +80,7 @@
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(113, 78);
|
||||
this.button1.Location = new System.Drawing.Point(31, 88);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 2;
|
||||
@@ -64,17 +90,267 @@
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Location = new System.Drawing.Point(31, 148);
|
||||
this.pictureBox1.Location = new System.Drawing.Point(31, 243);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(643, 483);
|
||||
this.pictureBox1.Size = new System.Drawing.Size(643, 443);
|
||||
this.pictureBox1.TabIndex = 3;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(435, 33);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(69, 20);
|
||||
this.textBox2.TabIndex = 4;
|
||||
this.textBox2.Text = "793";
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.Location = new System.Drawing.Point(435, 59);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.Size = new System.Drawing.Size(69, 20);
|
||||
this.textBox3.TabIndex = 5;
|
||||
this.textBox3.Text = "360";
|
||||
//
|
||||
// textBox4
|
||||
//
|
||||
this.textBox4.Location = new System.Drawing.Point(579, 33);
|
||||
this.textBox4.Name = "textBox4";
|
||||
this.textBox4.Size = new System.Drawing.Size(69, 20);
|
||||
this.textBox4.TabIndex = 6;
|
||||
this.textBox4.Text = "200";
|
||||
//
|
||||
// textBox5
|
||||
//
|
||||
this.textBox5.Location = new System.Drawing.Point(579, 59);
|
||||
this.textBox5.Name = "textBox5";
|
||||
this.textBox5.Size = new System.Drawing.Size(69, 20);
|
||||
this.textBox5.TabIndex = 7;
|
||||
this.textBox5.Text = "33";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(372, 36);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(26, 13);
|
||||
this.label2.TabIndex = 8;
|
||||
this.label2.Text = "Top";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(520, 36);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(35, 13);
|
||||
this.label3.TabIndex = 9;
|
||||
this.label3.Text = "Width";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(372, 62);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(25, 13);
|
||||
this.label4.TabIndex = 10;
|
||||
this.label4.Text = "Left";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(520, 56);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(38, 13);
|
||||
this.label5.TabIndex = 11;
|
||||
this.label5.Text = "Height";
|
||||
//
|
||||
// textBox6
|
||||
//
|
||||
this.textBox6.Location = new System.Drawing.Point(435, 122);
|
||||
this.textBox6.Name = "textBox6";
|
||||
this.textBox6.Size = new System.Drawing.Size(69, 20);
|
||||
this.textBox6.TabIndex = 12;
|
||||
this.textBox6.Text = "0";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(373, 125);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(56, 13);
|
||||
this.label6.TabIndex = 13;
|
||||
this.label6.Text = "Rotatation";
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(31, 119);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(75, 23);
|
||||
this.button2.TabIndex = 14;
|
||||
this.button2.Text = "Syncfusion";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Location = new System.Drawing.Point(31, 148);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(75, 23);
|
||||
this.button3.TabIndex = 15;
|
||||
this.button3.Text = "Word";
|
||||
this.button3.UseVisualStyleBackColor = true;
|
||||
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(373, 151);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(45, 13);
|
||||
this.label7.TabIndex = 17;
|
||||
this.label7.Text = "BC-Font";
|
||||
//
|
||||
// textBox7
|
||||
//
|
||||
this.textBox7.Location = new System.Drawing.Point(435, 148);
|
||||
this.textBox7.Name = "textBox7";
|
||||
this.textBox7.Size = new System.Drawing.Size(69, 20);
|
||||
this.textBox7.TabIndex = 16;
|
||||
this.textBox7.Text = "Bar 25i c HR";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(517, 151);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(45, 13);
|
||||
this.label8.TabIndex = 19;
|
||||
this.label8.Text = "BC-Font";
|
||||
//
|
||||
// textBox8
|
||||
//
|
||||
this.textBox8.Location = new System.Drawing.Point(579, 148);
|
||||
this.textBox8.Name = "textBox8";
|
||||
this.textBox8.Size = new System.Drawing.Size(69, 20);
|
||||
this.textBox8.TabIndex = 18;
|
||||
this.textBox8.Text = "Futura Book";
|
||||
//
|
||||
// textBox9
|
||||
//
|
||||
this.textBox9.Location = new System.Drawing.Point(579, 122);
|
||||
this.textBox9.Name = "textBox9";
|
||||
this.textBox9.Size = new System.Drawing.Size(69, 20);
|
||||
this.textBox9.TabIndex = 20;
|
||||
this.textBox9.Text = "F";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(520, 122);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(39, 13);
|
||||
this.label9.TabIndex = 21;
|
||||
this.label9.Text = "Zusatz";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(373, 99);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(49, 13);
|
||||
this.label10.TabIndex = 23;
|
||||
this.label10.Text = "Img-With";
|
||||
//
|
||||
// textBox10
|
||||
//
|
||||
this.textBox10.Location = new System.Drawing.Point(435, 96);
|
||||
this.textBox10.Name = "textBox10";
|
||||
this.textBox10.Size = new System.Drawing.Size(69, 20);
|
||||
this.textBox10.TabIndex = 22;
|
||||
this.textBox10.Text = "350";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(517, 99);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(35, 13);
|
||||
this.label11.TabIndex = 25;
|
||||
this.label11.Text = "Img-H";
|
||||
//
|
||||
// textBox11
|
||||
//
|
||||
this.textBox11.Location = new System.Drawing.Point(579, 96);
|
||||
this.textBox11.Name = "textBox11";
|
||||
this.textBox11.Size = new System.Drawing.Size(69, 20);
|
||||
this.textBox11.TabIndex = 24;
|
||||
this.textBox11.Text = "50";
|
||||
//
|
||||
// textBox12
|
||||
//
|
||||
this.textBox12.Location = new System.Drawing.Point(435, 174);
|
||||
this.textBox12.Name = "textBox12";
|
||||
this.textBox12.Size = new System.Drawing.Size(44, 20);
|
||||
this.textBox12.TabIndex = 26;
|
||||
this.textBox12.Text = "36";
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(372, 177);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(27, 13);
|
||||
this.label12.TabIndex = 27;
|
||||
this.label12.Text = "Size";
|
||||
//
|
||||
// textBox13
|
||||
//
|
||||
this.textBox13.Location = new System.Drawing.Point(579, 177);
|
||||
this.textBox13.Name = "textBox13";
|
||||
this.textBox13.Size = new System.Drawing.Size(44, 20);
|
||||
this.textBox13.TabIndex = 28;
|
||||
this.textBox13.Text = "9";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(520, 181);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(45, 13);
|
||||
this.label13.TabIndex = 29;
|
||||
this.label13.Text = "BC-Font";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 707);
|
||||
this.Controls.Add(this.label13);
|
||||
this.Controls.Add(this.textBox13);
|
||||
this.Controls.Add(this.label12);
|
||||
this.Controls.Add(this.textBox12);
|
||||
this.Controls.Add(this.label11);
|
||||
this.Controls.Add(this.textBox11);
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.textBox10);
|
||||
this.Controls.Add(this.label9);
|
||||
this.Controls.Add(this.textBox9);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.textBox8);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.textBox7);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.textBox6);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.textBox5);
|
||||
this.Controls.Add(this.textBox4);
|
||||
this.Controls.Add(this.textBox3);
|
||||
this.Controls.Add(this.textBox2);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.label1);
|
||||
@@ -94,6 +370,32 @@
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.TextBox textBox2;
|
||||
private System.Windows.Forms.TextBox textBox3;
|
||||
private System.Windows.Forms.TextBox textBox4;
|
||||
private System.Windows.Forms.TextBox textBox5;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox textBox6;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox textBox7;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.TextBox textBox8;
|
||||
private System.Windows.Forms.TextBox textBox9;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.TextBox textBox10;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.TextBox textBox11;
|
||||
private System.Windows.Forms.TextBox textBox12;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.TextBox textBox13;
|
||||
private System.Windows.Forms.Label label13;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+277
-14
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.Office.Interop.Word;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@@ -7,9 +8,17 @@ using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Text;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Syncfusion.DocIO;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using Shape = Syncfusion.DocIO.DLS.Shape;
|
||||
using System.IO;
|
||||
using BarcodeLib;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Office.Core;
|
||||
|
||||
|
||||
namespace ZZ_BarcpdeFromFont
|
||||
@@ -21,13 +30,60 @@ namespace ZZ_BarcpdeFromFont
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string barcode_font;
|
||||
public string barcode_fontsize;
|
||||
public string zusatz_font;
|
||||
public string zusatz_size;
|
||||
|
||||
public string width;
|
||||
public string height;
|
||||
public string top;
|
||||
public string left;
|
||||
|
||||
public string imagewith;
|
||||
public string imageheight;
|
||||
|
||||
public string inhalt;
|
||||
public string zusatz;
|
||||
public string rotation;
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
string inp = Bar25I(this.textBox1.Text);
|
||||
Font f = new Font("Bar 25i c", 46);
|
||||
//Font f = new Font("Bar 25i c", 46);
|
||||
BarcodeLib.clsBarI25 barbarcode = new BarcodeLib.clsBarI25();
|
||||
BarcodeLib.Barcode Barcode = new BarcodeLib.Barcode();
|
||||
|
||||
barcode_font = textBox7.Text;
|
||||
barcode_fontsize = textBox12.Text;
|
||||
zusatz_font = textBox8.Text;
|
||||
zusatz_size = textBox13.Text;
|
||||
|
||||
width = textBox4.Text;
|
||||
height = textBox5.Text;
|
||||
top = textBox2.Text;
|
||||
left = textBox3.Text;
|
||||
|
||||
imagewith = textBox10.Text;
|
||||
imageheight = textBox11.Text;
|
||||
|
||||
inhalt = textBox1.Text;
|
||||
zusatz = textBox9.Text;
|
||||
rotation = textBox6.Text;
|
||||
|
||||
// pictureBox1.Image = barbarcode.GetBarI25(Color.Black, Color.White, inp, "Bar 25i c HR", 36, 350, 50, " U", "Futur Book", 8,0);
|
||||
|
||||
System.Drawing.Image barcodeimage;
|
||||
barcodeimage = barbarcode.GetBarI25(Color.Black, Color.White, inhalt, barcode_font, Convert.ToInt32(barcode_fontsize), Convert.ToInt32(imagewith), Convert.ToInt32(imageheight), zusatz, zusatz_font, Convert.ToInt32(zusatz_size), Convert.ToInt32(rotation));
|
||||
//barcodeimage = ScaleImage(barcodeimage, Convert.ToInt32(this.imageheight));
|
||||
// barcodeimage = ScaleImage(barcodeimage, 200, 33);
|
||||
//barcodeimage = Barcode.Get_LinerBarcode(Barcoded.Symbology.I2of5, inhalt,inhalt + " "+zusatz,"Below", zusatz_font, Convert.ToInt32(zusatz_size),Convert.ToInt32(rotation));
|
||||
//barcodeimage = Barcode.Get_LinerBarcode(Barcoded.Symbology.I2of5, inhalt, inhalt + " " + zusatz, "Below", zusatz_font, Convert.ToInt32(zusatz_size), Convert.ToInt32(rotation));
|
||||
barcodeimage = Barcode.Get_LinerBarcode(Barcoded.Symbology.I2of5C ,inhalt, inhalt + " " + zusatz, "Below", zusatz_font, Convert.ToInt32(zusatz_size), Convert.ToInt32(rotation));
|
||||
// barcodeimage = AutoSizeImage(barcodeimage, Convert.ToInt32(width), Convert.ToInt32(height),false);
|
||||
barcodeimage = ScaleImage(barcodeimage, 50);
|
||||
pictureBox1.Image = barcodeimage;
|
||||
pictureBox1.Image.Save(@"x:\gaga.png");
|
||||
|
||||
pictureBox1.Image = barbarcode.GetBarI25(Color.Black, Color.White, inp, "Bar 25i c HR", 36, 350, 50, " U", "Futur Book", 8,270);
|
||||
//pictureBox1.Image= DrawText(inp, f, Color.Black, 140,textBox1.Text+ " U");
|
||||
//pictureBox1.Image = DrawText1(Color.Black, Color.White, "Bar 25i c HR", 36, inp, 350, 50, " U",0);
|
||||
|
||||
@@ -123,7 +179,7 @@ namespace ZZ_BarcpdeFromFont
|
||||
|
||||
//}
|
||||
|
||||
public Image DrawText(String text, Font font, Color textColor, int maxWidth, String path)
|
||||
public Image DrawText(String text, System.Drawing.Font font, Color textColor, int maxWidth, String path)
|
||||
{
|
||||
//first, create a dummy bitmap just to get a graphics object
|
||||
Image img = new Bitmap(1, 1);
|
||||
@@ -142,7 +198,7 @@ namespace ZZ_BarcpdeFromFont
|
||||
|
||||
int multi = 4;
|
||||
//create a new image of the right size
|
||||
img = new Bitmap((int)textSize.Width*multi, (int)textSize.Height);
|
||||
img = new Bitmap((int)textSize.Width * multi, (int)textSize.Height);
|
||||
|
||||
drawing = Graphics.FromImage(img);
|
||||
//Adjust for high quality
|
||||
@@ -158,9 +214,9 @@ namespace ZZ_BarcpdeFromFont
|
||||
//create a brush for the text
|
||||
Brush textBrush = new SolidBrush(textColor);
|
||||
|
||||
Font ftext = new Font("Arial", 15,FontStyle.Bold);
|
||||
drawing.DrawString(text, font, textBrush, new RectangleF(0, 0, textSize.Width*multi, textSize.Height), sf);
|
||||
drawing.DrawString(path, ftext, textBrush, new RectangleF(50, 50, textSize.Width*multi , textSize.Height ), sf);
|
||||
System.Drawing.Font ftext = new System.Drawing.Font("Arial", 15, FontStyle.Bold);
|
||||
drawing.DrawString(text, font, textBrush, new RectangleF(0, 0, textSize.Width * multi, textSize.Height), sf);
|
||||
drawing.DrawString(path, ftext, textBrush, new RectangleF(50, 50, textSize.Width * multi, textSize.Height), sf);
|
||||
|
||||
drawing.Save();
|
||||
|
||||
@@ -176,20 +232,20 @@ namespace ZZ_BarcpdeFromFont
|
||||
{
|
||||
Bitmap img = new Bitmap(width, height);
|
||||
Graphics Gimg = Graphics.FromImage(img);
|
||||
Font imgFont = new Font(fontName, fontSize);
|
||||
System.Drawing.Font imgFont = new System.Drawing.Font(fontName, fontSize);
|
||||
PointF imgPoint = new PointF(5, 5);
|
||||
SolidBrush bForeColor = new SolidBrush(foreColor);
|
||||
SolidBrush bBackColor = new SolidBrush(backColor);
|
||||
Gimg.FillRectangle(bBackColor, 0, 0, width, height);
|
||||
Gimg.DrawString(txt, imgFont, bForeColor, imgPoint);
|
||||
Font fzFont = new Font("Arial", 9);
|
||||
System.Drawing.Font fzFont = new System.Drawing.Font("Arial", 9);
|
||||
|
||||
SizeF textSize = Gimg.MeasureString(zusatz, fzFont, 50);
|
||||
|
||||
PointF imgPointZusatz= new PointF(width-textSize.Width-15, 30);
|
||||
PointF imgPointZusatz = new PointF(width - textSize.Width - 15, 30);
|
||||
Gimg.DrawString(zusatz, fzFont, bForeColor, imgPointZusatz);
|
||||
|
||||
return RotateImage(img, rotation,true,true,Color.White);
|
||||
return RotateImage(img, rotation, true, true, Color.White);
|
||||
//img.Save(imagePath, ImageFormat.Jpeg);
|
||||
}
|
||||
|
||||
@@ -279,7 +335,7 @@ namespace ZZ_BarcpdeFromFont
|
||||
gfx.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
|
||||
//now draw our new image onto the graphics object
|
||||
gfx.DrawImage(img, new Point(0, 0));
|
||||
gfx.DrawImage(img, new System.Drawing.Point(0, 0));
|
||||
|
||||
//dispose of our Graphics object
|
||||
gfx.Dispose();
|
||||
@@ -291,6 +347,213 @@ namespace ZZ_BarcpdeFromFont
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public System.Drawing.Image AutoSizeImage(System.Drawing.Image oBitmap, int maxWidth, int maxHeight, bool bStretch = false)
|
||||
{
|
||||
|
||||
// Größenverhältnis der max. Dimension
|
||||
float maxRatio = (float)(maxWidth / (double)maxHeight);
|
||||
|
||||
// Bildgröße und aktuelles Größenverhältnis
|
||||
int imgWidth = oBitmap.Width;
|
||||
int imgHeight = oBitmap.Height;
|
||||
float imgRatio = (float)(imgWidth / (double)imgHeight);
|
||||
|
||||
// Bild anpassen?
|
||||
if (imgWidth > maxWidth | imgHeight > maxHeight | bStretch)
|
||||
{
|
||||
if (imgRatio <= maxRatio)
|
||||
{
|
||||
// Größenverhältnis des Bildes ist kleiner als die
|
||||
// maximale Größe, in der das Bild angezeigt werden kann.
|
||||
// In diesem Fall muss die Bildbreite angepasst werden.
|
||||
imgWidth = (int)Math.Round(imgWidth / (imgHeight / (double)maxHeight));
|
||||
imgHeight = maxHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Größenverhältnis des Bildes ist größer als die
|
||||
// maximale Größe, in der das Bild angezeigt werden kann.
|
||||
// In diesem Fall muss die Bildhöhe angepasst werden.
|
||||
imgHeight = (int)Math.Round(imgHeight / (imgWidth / (double)maxWidth));
|
||||
imgWidth = maxWidth;
|
||||
}
|
||||
|
||||
// Bitmap-Objekt in der neuen Größe erstellen
|
||||
var oImage = new Bitmap(imgWidth, imgHeight);
|
||||
|
||||
// Bild interpolieren, damit die Qualität erhalten bleibt
|
||||
using (Graphics g = Graphics.FromImage(oImage))
|
||||
{
|
||||
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
|
||||
g.DrawImage(oBitmap, new System.Drawing.Rectangle(0, 0, imgWidth, imgHeight));
|
||||
}
|
||||
|
||||
// neues Bitmap zurückgeben
|
||||
return oImage;
|
||||
}
|
||||
else
|
||||
{
|
||||
// unverändertes Originalbild zurückgeben
|
||||
return oBitmap;
|
||||
}
|
||||
}
|
||||
public static System.Drawing.Image ScaleImage(System.Drawing.Image image, int maxWidth, int maxHeight)
|
||||
{
|
||||
var ratioX = (double)maxWidth / image.Width;
|
||||
var ratioY = (double)maxHeight / image.Height;
|
||||
var ratio = Math.Min(ratioX, ratioY);
|
||||
|
||||
var newWidth = (int)(image.Width * ratio);
|
||||
var newHeight = (int)(image.Height * ratio);
|
||||
|
||||
var newImage = new Bitmap(newWidth, newHeight);
|
||||
|
||||
using (var graphics = Graphics.FromImage(newImage))
|
||||
graphics.DrawImage(image, 0, 0, newWidth, newHeight);
|
||||
|
||||
return newImage;
|
||||
}
|
||||
|
||||
public static Image ScaleImage(Image image, int height)
|
||||
{
|
||||
double ratio = (double)height / image.Height;
|
||||
int newWidth = (int)(image.Width * ratio);
|
||||
int newHeight = (int)(image.Height * ratio);
|
||||
Bitmap newImage = new Bitmap(newWidth, newHeight);
|
||||
using (Graphics g = Graphics.FromImage(newImage))
|
||||
{
|
||||
g.DrawImage(image, 0, 0, newWidth, newHeight);
|
||||
}
|
||||
image.Dispose();
|
||||
return newImage;
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
|
||||
word.Documents.Open(@"E:\Software-Projekte\OnDoc\Excel_Dateien\empty.docx");
|
||||
FindAndReplaceImages(word.ActiveDocument, @"x:\gaga.png");
|
||||
word.Visible = true;
|
||||
|
||||
|
||||
}
|
||||
private void FindAndReplaceImages(Document wordDoc, string imagePath)
|
||||
{
|
||||
var sec = wordDoc.Application.Selection.Sections[1];
|
||||
|
||||
|
||||
foreach (Section wordSection in wordDoc.Sections)
|
||||
{
|
||||
var footer = sec.Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary];
|
||||
//var footerImage = footer.Shapes.AddShape(1, 0, 0, 594, 280);
|
||||
var footerImage = footer.Shapes.AddShape(1, Convert.ToInt32(this.left), Convert.ToInt32(this.top), Convert.ToInt32(this.width), Convert.ToInt32(this.height));
|
||||
footerImage.Fill.UserPicture(imagePath);
|
||||
footerImage.WrapFormat.Type = WdWrapType.wdWrapThrough;
|
||||
footerImage.WrapFormat.AllowOverlap = -1;
|
||||
footerImage.WrapFormat.Side = WdWrapSideType.wdWrapBoth;
|
||||
|
||||
footerImage.RelativeHorizontalPosition = WdRelativeHorizontalPosition.wdRelativeHorizontalPositionPage;
|
||||
footerImage.RelativeVerticalPosition = WdRelativeVerticalPosition.wdRelativeVerticalPositionPage;
|
||||
footerImage.Top = (float)Convert.ToInt32(this.top);
|
||||
}
|
||||
}
|
||||
|
||||
public void Lic()
|
||||
{
|
||||
// 25. string lickey = "Ngo9BigBOggjHTQxAR8/V1NCaF5cXmZCf1FpRmJGdld5fUVHYVZUTXxaS00DNHVRdkdnWXdecXRdQ2heUU13XUI="
|
||||
//string lickey = "Ngo9BigBOggjHTQxAR8/V1NCaF5cXmZCf1FpRmJGdld5fUVHYVZUTXxaS00DNHVRdkdnWXZeeXRQR2NZUEZ2WkE=";
|
||||
string lickey = "MzYzODg2NkAzMjM4MmUzMDJlMzBTOWljRmxNelA1d1VGOHpGR0lxQzB6UTAwKzIxK2VBNEhBZFp5alcxb1NVPQ==";
|
||||
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(lickey);
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
WordDocument document = new WordDocument();
|
||||
document.Open(@"E:\Software-Projekte\OnDoc\Excel_Dateien\empty.docx");
|
||||
|
||||
IWParagraph paragraph = document.Sections[0].Paragraphs[0];
|
||||
if (document.Sections.Count < 1)
|
||||
{
|
||||
document.AddSection();
|
||||
}
|
||||
IWParagraph footerparagraph;
|
||||
if (document.Sections[0].HeadersFooters.Footer.Paragraphs.Count < 1)
|
||||
{
|
||||
footerparagraph = document.Sections[0].HeadersFooters.Footer.AddParagraph();
|
||||
}
|
||||
footerparagraph = document.Sections[0].HeadersFooters.Footer.Paragraphs[0];
|
||||
System.Drawing.Image sfimage = Image.FromFile(@"x:\gaga.png");
|
||||
//sfimage = AutoSizeImage(sfimage, Convert.ToInt32(this.width), Convert.ToInt32(this.height), false);
|
||||
//sfimage = ScaleImage(sfimage, Convert.ToInt32(this.width), Convert.ToInt32(this.height));
|
||||
|
||||
Shape rectangle = footerparagraph.AppendShape(AutoShapeType.Rectangle, Convert.ToInt32(this.width), Convert.ToInt32(this.height));
|
||||
paragraph = rectangle.TextBody.AddParagraph() as WParagraph;
|
||||
rectangle.LineFormat.Line = false;
|
||||
|
||||
|
||||
IWPicture pic = paragraph.AppendPicture(sfimage);
|
||||
pic.Width = 160;
|
||||
pic.Height = 28;
|
||||
|
||||
|
||||
rectangle.VerticalPosition = (Convert.ToInt32(this.top)/150 * 2.83465f);
|
||||
rectangle.HorizontalPosition = Convert.ToInt32(this.left);
|
||||
//rectangle.LineFormat.DashStyle = LineDashing.Dot;
|
||||
//rectangle.LineFormat.Color = Color.DarkGray;
|
||||
//IWParagraph rectangleparagraph = rectangle.TextBody.AddParagraph();
|
||||
//IWPicture picture = rectangleparagraph.AppendPicture(sfimage);
|
||||
//footerparagraph.AppendShape
|
||||
document.Save(@"x:\gaga.docx");
|
||||
document.Close();
|
||||
System.Diagnostics.Process.Start("winword.exe", "/w " + @"x:\gaga.docx");
|
||||
|
||||
return;
|
||||
//WordDocument document = new WordDocument();
|
||||
//document.Open(@"E:\Software-Projekte\OnDoc\Excel_Dateien\empty.docx");
|
||||
////Add a new section to the document.
|
||||
//IWSection section = document.AddSection();
|
||||
////Add a new paragraph to the section.
|
||||
//IWParagraph paragraph = section.AddParagraph() as WParagraph;
|
||||
//Shape rectangle = paragraph.AppendShape(AutoShapeType.RoundedRectangle, 150, 100);
|
||||
//rectangle.VerticalPosition = 72;
|
||||
//rectangle.HorizontalPosition = 72;
|
||||
//paragraph = section.AddParagraph() as WParagraph;
|
||||
//paragraph = rectangle.TextBody.AddParagraph() as WParagraph;
|
||||
//System.Drawing.Image sfimage = Image.FromFile(@"x:\gaga.png");
|
||||
//paragraph.AppendPicture(sfimage);
|
||||
//IWTextRange text = paragraph.AppendText("This text is in rounded rectangle shape");
|
||||
//text.CharacterFormat.TextColor = Color.Green;
|
||||
//text.CharacterFormat.Bold = true;
|
||||
////Apply fill color for shape.
|
||||
//rectangle.FillFormat.Fill = true;
|
||||
//rectangle.FillFormat.Color = Color.LightGray;
|
||||
////Set transparency (opacity) to the shape fill color.
|
||||
//rectangle.FillFormat.Transparency = 75;
|
||||
////Apply wrap formats.
|
||||
//rectangle.WrapFormat.TextWrappingStyle = TextWrappingStyle.Square;
|
||||
//rectangle.WrapFormat.TextWrappingType = TextWrappingType.Right;
|
||||
////Set horizontal and vertical origin.
|
||||
//rectangle.HorizontalOrigin = HorizontalOrigin.Margin;
|
||||
//rectangle.VerticalOrigin = VerticalOrigin.Page;
|
||||
////Set line format.
|
||||
//rectangle.LineFormat.DashStyle = LineDashing.Dot;
|
||||
//rectangle.LineFormat.Color = Color.DarkGray;
|
||||
////Set the left internal margin for the shape.
|
||||
//rectangle.TextFrame.InternalMargin.Left = 30;
|
||||
////Set the right internal margin for the shape.
|
||||
//rectangle.TextFrame.InternalMargin.Right = 24;
|
||||
////Set the bottom internal margin for the shape.
|
||||
//rectangle.TextFrame.InternalMargin.Bottom = 18;
|
||||
////Set the top internal margin for the shape.
|
||||
//rectangle.TextFrame.InternalMargin.Top = 6;
|
||||
////Saves the Word document to MemoryStream
|
||||
|
||||
//document.Save(@"x:\gaga.docx", FormatType.Docx);
|
||||
////Closes the Word document
|
||||
//document.Close();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,24 @@
|
||||
<Reference Include="BarcodeLib">
|
||||
<HintPath>..\BarcodeLib\bin\Debug\BarcodeLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>..\Client\bin\Debug\Microsoft.Office.Interop.Word.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>..\Client\bin\Debug\Office.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Syncfusion.DocIO.Base, Version=28.1462.33.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>C:\Program Files (x86)\Syncfusion\Essential Studio\Windows\28.1.33\Assemblies\4.6.2\Syncfusion.DocIO.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Syncfusion.Licensing, Version=28.1462.33.0, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\DOCGEN\bin\Debug\Syncfusion.Licensing.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@@ -47,6 +65,9 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="vbBarcodes">
|
||||
<HintPath>..\vbBarcodes\bin\Debug\vbBarcodes.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
vbBarcodes
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:vbBarcodes.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:vbBarcodes.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:vbBarcodes.My.Resources.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
0882598c3e6683ec65762e0b9c0cadbd3f56336060c48a0325ee34ee4e039773
|
||||
178d6a6354869d8cf7f9c627bf441e59c1c43aed288772763358de69240bb2a6
|
||||
|
||||
@@ -33,3 +33,14 @@ E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\Logging.pdb
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\NLog.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\NLog.Database.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\obj\Debug\ZZ_Barcp.BFEBD557.Up2Date
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\vbBarcodes.dll
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\MW6.SDK.dll
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\vbBarcodes.pdb
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\vbBarcodes.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\Syncfusion.DocIO.Base.dll
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\Syncfusion.Licensing.dll
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\Syncfusion.Compression.Base.dll
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\Syncfusion.OfficeChart.Base.dll
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\Syncfusion.DocIO.Base.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\Syncfusion.Compression.Base.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\ZZ_BarcpdeFromFont\bin\Debug\Syncfusion.OfficeChart.Base.xml
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user