Visiblewindows Is Behind My Windows Form フォローする

0
Avatar
Legacy Poster

I have a simple Windows Form program that I wrote in Visual Basic in Visual Studio 2010. I reference the COM Bartend.exe. I then add a form to the project with a simple button on it.

When I click the button the code below fires.

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try

            Dim btApp As New BarTender.Application
            Dim btFormat As New BarTender.Format

            btFormat = btApp.Formats.Open("C:\Temp\oper-to-stock-addr.btw", False, "")

            Dim strNamedSubstringValues = btFormat.NamedSubStrings.GetAll(":", ";")
            btFormat.Printer = "PDF-XChange 4.0"

            btApp.TopMost = True
            btApp.VisibleWindows = 2

            btFormat.PrintOut(False, False)

            btFormat.Close(1) '(bartender.BtSaveOptions.btDoNotSaveChanges)
            btApp.Quit(1) '(btDoNotSaveChanges)
            System.Runtime.InteropServices.Marshal.ReleaseComObject(btApp)
            btApp = Nothing
            MsgBox("Done")
        Catch ex As Exception
            MsgBox(ex.Message)            
        End Try
    End Sub

 

My problem is the Dialog box that pops up from the Bartender label is behind my Windows form. Any idea on how to get the Dialog box in front of the windows form??

1 コメント

0
Avatar
Legacy Poster
コメントアクション Permalink

Found my problem. I had the form1.TopMost = true. Therefore it was trumping the btapp.TopMost.

Before printing I set the form1.topmost = false and then set it back to true at the end.

ログインしてコメントを残してください。