2016-07-06 9 views
-1

に表示されます、私はこのコードを持っている:Syncfusionバーコードコントロールのテキストdoesntのは、BMP VB NETを印刷

Private Sub BuildCode() 
    Dim barcode As String = TextBox1.Text + "%" + TextBox2.Text + "&" + TextBox6.Text + "*" 
    'TextBox3.Text = barcode 
    SfBarcode1.Text = barcode 
End Sub 
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
    BMP = New Bitmap(GroupBox1.Width, GroupBox1.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb) 
    'BMP.SetResolution(300, 300) 
    GroupBox1.DrawToBitmap(BMP, New Rectangle(0, 0, GroupBox1.Width, GroupBox1.Height)) 
    Dim pd As New PrintDocument 
    Dim pdialog As New PrintDialog 
    AddHandler pd.PrintPage, (Sub(s, args) 
            args.Graphics.DrawImage(BMP, 0, 0) 
            args.HasMorePages = False 
           End Sub) 
    pdialog.ShowDialog() 
    pd.PrinterSettings.PrinterName = pdialog.PrinterSettings.PrinterName 
    pd.Print() 
End Sub 

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged 
    BuildCode() 
End Sub 

私はそのバーコードを印刷するのTextBox1コントロールを聞かせてください。私がsyncfusionバーコードコントロールに価値をおろすと、それはうまく構築され、バーコードを表示しますが、バーコードの代わりに印刷すると何も表示されません。

何ができますか?

+0

BMPは有効ですか:PictureBoxを追加し、その画像をBMPに設定し、.Refresh()します。それはいいよね?たぶん、画像が32bpp ....プリンタは本当に 'アルファ'を使用することはできませんので、24bppを試してください。私は分かりません。ただの推測です。 – ABuckau

+0

はすべてbmpで問題ありません。私は本当に何が間違っているのか分からない。もし私がsyncfusionコンポーネントの代わりにテキストボックスを入れて、バーコードを印刷するテキストボックスのフォント特性をバーコードフォントに変更することによってバーコードを生成すると、しかし、私はsfbarcode1に値を渡すとすぐにバーコードを印刷しますが、それはバーコードを画面上に正確に表示します。素晴らしい。 –

答えて

0

バーコードをイメージとしてエクスポートし、イメージをグループボックスに挿入し、参照用のグループボックスコントロールを印刷するための回避策のサンプルを作成しました。詳細は以下のコードスニペットとサンプルを参照してください。

'initialize the barcode control 
    Dim barcode As SfBarcode = New SfBarcode() 

    'set the barcode symbology type 
    barcode.Symbology = BarcodeSymbolType.Code128A 

    'set the input text 
    barcode.Text = TextBox1.Text 

    'export the barcode control as image 
    PictureBox1.Image = barcode.ToImage(PictureBox1.Size) 

サンプルリンク: http://www.syncfusion.com/downloads/support/forum/124890/ze/BarcodeVb1482679502

あなたはこれを試してみて、私は、これはあなたの実際の要件を満たしているかどうか教えてくださいでした。

+0

こんにちは。 ToImageはSfBarcodeのメンバーではありません。このエラーを出力します。どうなり得るか? –

+0

バーコードからイメージへの変換のサポートは、最新バージョン(14.2.0.26)でのみ提供されています。最新バージョンに更新してください。 https://www.syncfusion.com/downloads/latest-version – Karthikeyan

関連する問題