Home Image-Pro Automation (Macros, Apps, Reports)
Options

Possible Library Conflict -- 2019-10-10-163010

2019-10-10-163010

All --

I am working on an app that has been working well.

I am attempting to add

        'CONNECT WITH THE CAMERA CAPTURE COMMANDS
        With Capture.CaptureCommands.Preview(Nothing)

                'If the PREVIEW is ON
                If (.previewon = True) _
                    Then

                        'CHANGE THE CAMERA STATUS TRAFFIC SIGNAL
                        pictureBox_LivePreviewTraffic.BackgroundImage  = _
                            Image.FromFile( MacroDir & "\Traffic-Grn.jpg" )

                    Else

                        'CHANGE THE CAMERA STATUS TRAFFIC SIGNAL
                        pictureBox_LivePreviewTraffic.BackgroundImage  = _
                            Image.FromFile( MacroDir & "\Traffic-Red.jpg" )

                    End If

            End With
to the APP.

I find to support the

    IMAGE.FROMFILE COMMAND

that I have to add

    Imports System.Drawing

to the .IPP FILE for the PROJECT.

Unfortunately this seems to interfere with the

    ANCHOR =

line that is commented out in the code below.
        With Adjust.ImageCommands.Canvas(Nothing)
'            .Anchor = Image.CanvasAnchor.TopLeft
            .Size = New System.Drawing.Size(MyImageWidth,MyImageHeight+(MyImageHeight*.2))
            .Background = System.Drawing.Color.FromArgb(CType(255, Byte),CType(255, Byte),CType(255, Byte))
            .AverageBackground = False
            .Visible = True
            .Run(doc1, image2)
        End With
I was able to patch this up with

        'ADJUST THE CANVAS SIZE AND LEARN THE IMAGE INFO FOR THE NEW IMAGE
        Dim image2
        With Adjust.ImageCommands.Canvas(Nothing)
'            .Anchor = Image.CanvasAnchor.TopLeft
            .Anchor = 0
            .Size = New System.Drawing.Size(MyImageWidth,MyImageHeight+(MyImageHeight*.2))
            .Background = System.Drawing.Color.FromArgb(CType(255, Byte),CType(255, Byte),CType(255, Byte))
            .AverageBackground = False
            .Visible = True
            .Run(doc1, image2)
        End With
because of the info within



Everything is working now but I am wondering if there is a better way to address / resolve what seems to be a conflict regarding the IMAGE in

.Anchor = Image.CanvasAnchor.TopLeft

that seems to be broken by

    Imports System.Drawing

and the IMAGE in

Image.FromFile( MacroDir & "\Traffic-Grn.jpg" )

that is supported by

    Imports System.Drawing

Thanks.

-- Matt







Best Answer

  • Options
    Answer ✓
    Hi Matt,

    This is a namespace conflict, when the same property exists in different namespaces. One of the solutions to fix that is to use full namespace definition, e.g. "System.Drawing.Image.FromFile(...)" instead of adding "Imports  System.Drawing".

    Yuri

Answers

  • Options
    edited October 2019
    2019-10-11-090939

    Yuri --

    Thank you for your response and your guidance on this.

    I will implement your suggestion.

    -- Matt


Sign In or Register to comment.