Image resizes itself

Issues related to label design (working with databases, data processing, RFID encoding etc.) and printing (from NiceLabel Express, NiceLabel Pro, NiceForm and NicePrint)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
Posts: 17
Joined: Thu May 23, 2013 8:31 am

Image resizes itself

Post by SimonD » Thu Jul 11, 2013 10:06 am

Hi All,

I got a small problem over here.
I coded my own Labelprintig Software with Visual Basic 2010 Express - everything works fine beside the the image on the Label.
Everytime when i load the next data for the label - the imagevariable resizes itself and gets smaller - take a look on the pictures 1 - 2 - 3

Is this a known problem?

I load the data in this way -> Check the variablenames on the label -> compare it with an XMLfile - where the cellnames for the excelfile with the data is saved and then load the data from the excelfile

the code for that:

Code: Select all

                    LabelIntf = Nice.LabelOpenEx(LabelFileName)
                    Variablen = GetVariables(Groesse) 'Groesse = size of the label
                    For i = 0 To Variablen.Length - 1
                        If Variablen(i) = "Logo" Then 'Logo is the imagevariable - i set prefix and suffix for the path to the file
                            LabelIntf.Variables.FindByName("Logo").Prefix = XmlFile.Settings.Item("Einstellungen")("Pfad")("Logo").Value
                            LabelIntf.Variables.FindByName("Logo").Suffix = ".png"
                        End If
                Catch ex As Exception
                End Try
The code for reading the variables on the label I found here in the forum - i changed it to a function to return the variables in an array

Code: Select all

    Function GetVariables(ByVal Feld As String)
        LabelIntf = Nice.LabelOpenEx(XmlFile.Settings.Item("Einstellungen")("Pfad")("Layout").Value & Feld & ".lbl")
        Dim I As Integer
        Dim Variablen(LabelIntf.Variables.Count - 1) As String
        'Get variables
        For I = 1 To LabelIntf.Variables.Count
            ' We are only interested in prompted variables
            If LabelIntf.Variables.Item(I).VarType = vtPrompt Then
                Variablen(I - 1) = (LabelIntf.Variables.Item(I).Name)
            End If
        Return Variablen
    End Function
The code for the preview:

Code: Select all

    Sub getPreview()
        Dim Successful As Boolean
        If Not pb_preview.Image Is Nothing Then
        End If

        PreviewFileName = VB.Left(LabelFileName, Len(LabelFileName) - 4) & ".bmp"
        LabelIntf.Print("1, 0, 0, 0, SIMULATE, STOPUPDATES")
        Successful = LabelIntf.GetLabelPreview(PreviewFileName, pb_preview.Width, pb_preview.Height)
        If Successful Then
            pb_preview.Image = System.Drawing.Image.FromFile(PreviewFileName)
            pb_preview.Visible = True
        End If
    End Sub
I already tried to fix the position on the label - but that didn't help. When i restart the programm it starts with the original size.

Hope you could help me

Kind Regards
(154 KiB) Downloaded 122 times
3.JPG (16.97 KiB) Viewed 1770 times
2.JPG (17.01 KiB) Viewed 1770 times
1.JPG (18.08 KiB) Viewed 1770 times

Posts: 17
Joined: Thu May 23, 2013 8:31 am

Re: Image resizes itself

Post by SimonD » Thu Jul 11, 2013 1:45 pm

Found the solution by accident ;)

Code: Select all

LabelIntf.Print("1, 0, 0, 0, SIMULATE, STOPUPDATES")
somehow the simulation causes the resize of the image.


NiceLabel Development
NiceLabel Development
Posts: 22
Joined: Wed Nov 29, 2006 2:10 pm

Re: Image resizes itself

Post by primoz » Wed Jul 17, 2013 2:47 pm


I cannot reproduce the problem with my generic test application using random graphics file, can you send me the graphics file that is causing the problems.

Post Reply