标签: picturebox

当我尝试打印条形码图像时,为什么我的条形码图像不适合条形码打印机设置中指定的纸张尺寸?

我正在使用Zen Barcode Rendering Framework在 C# Windows 窗体应用程序中创建条形码。我有两个文本框(一个用于条形码本身,另一个用于我希望打印在条形码标签上的相关文本)。同样,我将生成的条形码图像加载到图片框中并尝试打印该图像,但每次按下打印按钮时,结果都不合适(有时打印机打印白色的空标签,有时条形码打印不完整。有趣的是,我不得不说,为了让条形码出现在标签上,即使它看起来不完整,我必须选择非常大的纸张尺寸)。这是我的代码:

我的生成条形码按钮的点击事件的代码:

private void Button1_Click(object sender, EventArgs e)
{
        string barcode = textBox1.Text;

        Zen.Barcode.Code128BarcodeDraw brcd = Zen.Barcode.BarcodeDrawFactory.Code128WithChecksum;
        var barcodeImage = brcd.Draw(barcode, 50);

        int resultImageWidth;
        if(barcodeImage.Width >= textBox2.Text.Length*8)
        {
            resultImageWidth = barcodeImage.Width;
        }
        else
        {
            resultImageWidth = textBox2.Text.Length*8;
        }

        var resultImage = new Bitmap(resultImageWidth, barcodeImage.Height + 60); // 20 is bottom padding, adjust to your text

        using (var graphics = Graphics.FromImage(resultImage))
        using (var font = new Font("IranYekan", 10))
        using (var brush = new …
Run Code Online (Sandbox Code Playgroud)

c# barcode picturebox winforms barcode-printing

0
推荐指数
1
解决办法
2517
查看次数

C# 图片框作为表单的接受按钮

有没有办法将图片框设置为winform的接受按钮?我试图在表单属性上设置它,但它没有显示出来。感谢您的回答。

c# picturebox acceptbutton winforms

-1
推荐指数
1
解决办法
902
查看次数

源代码中的WinForms C#Picturebox

如何使用源代码(没有设计器)将Picturebox放在表单中?我试过这个:

  PictureBox pb = new PictureBox();
  pb.Size = new Size(10,10);
  pb.Location = new Point(10,10);
  pb.ImageLocation= @"C:\Users\user\Desktop\NoName\NoName\StandardPos.png";
  pb.Load();
  pb.Refresh();
  pb.Show();
Run Code Online (Sandbox Code Playgroud)

但是有些东西我不见了.

c# picturebox winforms output

-1
推荐指数
1
解决办法
251
查看次数

这可能有三角形的 PictureBox 而不是矩形的吗?

这是否可以PictureBox在 Windows 窗体中使用三角形控件而不是矩形控件?

.net c# user-controls picturebox winforms

-1
推荐指数
1
解决办法
619
查看次数

在视觉工作室2013年从面板复制自由手绘图

我想在视觉工作室的一个表格(图片框)中自由地绘制并在另一个面板/图片框上复制相同的图形(我绘制).它们也不应该是形成一条线而是一条连续线的点.请帮忙.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        Pen p_white;

        bool draw = true;

        private Graphics objgraphics;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            Pen p_black = new Pen(new SolidBrush(Color.Black));

            if (draw)
            {
                objgraphics = panel1.CreateGraphics();

            }

        }

        /*private void panel1_MouseDown(object sender, MouseEventArgs e)
        {
            bool …
Run Code Online (Sandbox Code Playgroud)

c# panel picturebox winforms

-2
推荐指数
1
解决办法
1127
查看次数

如何在picturebox中显示pdf文件?

我想在图片框中显示一个pdf页面.有可能吗?如果没有,我可以在视觉工作室的窗体内显示pdf页面吗?谢谢

c# pdf picturebox winforms pdf-viewer

-5
推荐指数
1
解决办法
5715
查看次数