gpt4 book ai didi

c# - Code 39 条码

转载 作者:行者123 更新时间:2023-11-30 19:58:57 26 4
gpt4 key购买 nike

也许有一个简单的解决方案,但我似乎找不到,我需要在不增加字体大小的情况下增加条形码的高度。

                // Barcode Text Block
TextBlock barcode = new TextBlock();
barcode.Text = "12345678-123";
barcode.FontFamily = new FontFamily("Free 3 Of 9");
barcode.Margin = new Thickness(736, 638, 0, 50);
barcode.FontSize = 65;
page.Children.Add(barcode);

// Baarcode Number Text Block
TextBlock pageText = new TextBlock();
string s = "*12345678-123*";
s = s.Insert(1, " ").Insert(3, " ").Insert(5, " ").Insert(7, " ").Insert(9, " ").Insert(11, " ").Insert(13, " ").Insert(15, " ").Insert(17, " ").Insert(19, " ").Insert(21, " ").Insert(23, " ").Insert(25, " ");
pageText.Text = s;

pageText.FontFamily = new FontFamily("Arial");
pageText.Margin = new Thickness(743, 685, 0, 50);
pageText.FontSize = 26;
page.Children.Add(pageText);

目前看起来是这样的:

enter image description here

我需要条形码的高度大约高 10 像素,但不要让它变宽。 height 属性没有影响它。

最佳答案

这是一个例子

// Barcode Text Block
TextBlock barcode = new TextBlock();
barcode.Text = "12345678-123";
barcode.FontFamily = new FontFamily("Free 3 Of 9");
barcode.Margin = new Thickness(736, 638, 0, 50);
barcode.FontSize = 65;
//apply scale
barcode.RenderTransform = new ScaleTransform() { ScaleY = 1.1 };

此转换会将条形码元素缩放到 10% 的额外高度,您可以根据需要进行调整。

关于c# - Code 39 条码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25399031/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com