Click here to Skip to main content
16,005,316 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionMy own User Control is not defined Pin
John Smith 0078-Nov-08 23:08
John Smith 0078-Nov-08 23:08 
AnswerRe: My own User Control is not defined Pin
Thomas Stockwell10-Nov-08 1:13
professionalThomas Stockwell10-Nov-08 1:13 
GeneralRe: My own User Control is not defined Pin
John Smith 00717-Nov-08 1:45
John Smith 00717-Nov-08 1:45 
QuestionHow to Generate Barcode Directly from VB.Net Pin
NOUFIi8-Nov-08 19:10
NOUFIi8-Nov-08 19:10 
AnswerRe: How to Generate Barcode Directly from VB.Net Pin
Sipder8-Nov-08 20:41
Sipder8-Nov-08 20:41 
Questionproblem with printing barcode [modified] Pin
Sipder8-Nov-08 2:17
Sipder8-Nov-08 2:17 
AnswerRe: problem with printing barcode Pin
Dave Kreskowiak8-Nov-08 4:25
mveDave Kreskowiak8-Nov-08 4:25 
AnswerRe: problem with printing barcode Pin
sph3rex8-Nov-08 4:38
sph3rex8-Nov-08 4:38 
Probably that`s because the bitmap you`re loading has a different aspect ratio from the picture box ur fitting it into. Stretch means that the image will fill the container, so it your picture box has a size like Width:200, Height:150 and the barcode has let`s say Width: 100, Height: 120 it will appear disproportioned in the picture box.

One way to get around this would be this:
 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim _hW As Single = Me.PictureBox1.Image.Width
        Dim _hH As Single = Me.PictureBox1.Image.Height
        Dim ratio As Single = IIf(_hW >= _hH, _hW / _hH, _hH / _hW)
'resize image according to which is the highest ... Width or Height
        If (_hW > _hH) Then
            Me.PictureBox1.Image = ResizeImg(Me.PictureBox1.Image, New Size(Me.PictureBox1.Width, Me.PictureBox1.Width / ratio))
        Else
            Me.PictureBox1.Image = ResizeImg(Me.PictureBox1.Image, New Size(Me.PictureBox1.Height / ratio, Me.PictureBox1.Height))
        End If
    End Sub

    Public Function ResizeImg(ByVal img As Image, ByVal size As Size) As Image
        Dim bm As Bitmap = New Bitmap(img, Convert.ToUInt32(size.Width), Convert.ToUInt32(size.Height))
        Dim myNewImage As Graphics = Graphics.FromImage(bm)
        myNewImage.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
        Return bm
    End Function


The above code assumes that the barcode image is loaded in the picturebox at runtime. You can modify the code to fit ur exact needs moving the Form1_Load code to the place in code where u need it.

If the program that generates your barcodes allows it, try increasing the HEIGHT of the bars to fit into the picture boxes aspect ratio.
GeneralRe: problem with printing barcode [modified] Pin
Sipder8-Nov-08 22:26
Sipder8-Nov-08 22:26 
QuestionOLE_COLOR (Help) Pin
sarfarazaliqureshi7-Nov-08 22:49
sarfarazaliqureshi7-Nov-08 22:49 
AnswerRe: OLE_COLOR (Help) Pin
Dave Kreskowiak8-Nov-08 4:23
mveDave Kreskowiak8-Nov-08 4:23 
GeneralRe: OLE_COLOR (Help) Pin
sarfarazaliqureshi8-Nov-08 8:19
sarfarazaliqureshi8-Nov-08 8:19 
GeneralRe: OLE_COLOR (Help) Pin
Dave Kreskowiak8-Nov-08 10:16
mveDave Kreskowiak8-Nov-08 10:16 
GeneralRe: OLE_COLOR (Help) [modified] Pin
sph3rex8-Nov-08 10:57
sph3rex8-Nov-08 10:57 
GeneralRe: OLE_COLOR (Help) Pin
sarfarazaliqureshi9-Nov-08 8:47
sarfarazaliqureshi9-Nov-08 8:47 
AnswerRe: OLE_COLOR (Help) Pin
sarfarazaliqureshi8-Nov-08 8:26
sarfarazaliqureshi8-Nov-08 8:26 
QuestionChart Problem. Pin
Nanda_MR7-Nov-08 22:14
Nanda_MR7-Nov-08 22:14 
AnswerRe: Chart Problem. Pin
Dave Kreskowiak8-Nov-08 4:22
mveDave Kreskowiak8-Nov-08 4:22 
GeneralRe: Chart Problem. Pin
Nanda_MR9-Nov-08 17:41
Nanda_MR9-Nov-08 17:41 
Questionhow do i remove "database login" from my crystal report?? Pin
graced887-Nov-08 16:41
graced887-Nov-08 16:41 
AnswerRe: how do i remove "database login" from my crystal report?? Pin
Wendelius8-Nov-08 3:50
mentorWendelius8-Nov-08 3:50 
GeneralRe: how do i remove "database login" from my crystal report?? Pin
graced888-Nov-08 16:30
graced888-Nov-08 16:30 
GeneralRe: how do i remove "database login" from my crystal report?? Pin
Wendelius8-Nov-08 21:12
mentorWendelius8-Nov-08 21:12 
GeneralRe: how do i remove "database login" from my crystal report?? Pin
graced889-Nov-08 15:07
graced889-Nov-08 15:07 
GeneralRe: how do i remove "database login" from my crystal report?? Pin
Wendelius9-Nov-08 18:09
mentorWendelius9-Nov-08 18:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.