3

これには簡単な解決策があるかもしれませんが、見つけられないようです。フォントサイズを大きくせずにバーコードの高さを上げる必要があります。

                // 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);

現在、次のようになっています。

ここに画像の説明を入力

バーコードの高さを、幅を広げずに約 10 ピクセル高くする必要があります。高さのプロパティは影響しませんでした。

4

1 に答える 1

7

ここにサンプルがあります

// 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% 余分な高さにスケーリングされます。必要に応じて調整できます。

于 2014-08-20T07:40:11.167 に答える