简体   繁体   English

如何创建任务栏

[英]How do I create a Task Bar

I am working with visual basic. 我正在使用Visual Basic。 How do I get all the .exe files to show as buttons in a panel in my main form ? 如何以我的主要形式将所有.exe文件显示为面板中的按钮? I am currently using a static method that only allows me to launch applications when I click a button with the application icon . 我目前使用的是静态方法,仅当我单击带有应用程序图标的按钮时,才允许我启动应用程序。 all the buttons and functions are set in the code to this method as shown in this code . 如本代码所示,所有按钮和功能都在代码中设置为该方法。

    Public Class AppSelectorMain

    Private Sub MRDButton_Click(sender As Object, e As EventArgs) Handles MRDButton.Click
        Try
            Shell("D:\projects\VisualBasicAFMRD\AFMRD\bin\Debug\AFMRD.exe", vbNormalFocus)

        Catch ex As Exception

            msgbox("app not available")

        End Try
    End Sub
    Private Sub AoFurutusButton_Click(sender As Object, e As EventArgs) Handles AoFurutusButton.Click
        Try
            Shell("D:\projects\VisualBasic\project1\project1\bin\Debug\project1.exe", vbNormalFocus)
        Catch ex As Exception
            msgbox("app not available")

        End Try
    End Sub
End Class

this method is great for some occasions and you can make a very nice App Selection panel . 这种方法在某些情况下非常有用,您可以制作一个非常不错的“应用选择”面板。

I Would like to be able to have all .exe files appear in my form during startup similar to the windows task bar . 我希望能够在启动期间像Windows任务栏一样在我的表单中显示所有.exe文件。 So I'm guessing I will have to create a shortcut .exe file for each application and place them all in 1 main folder. 所以我想我将不得不为每个应用程序创建一个快捷方式.exe文件,并将它们全部放置在1个主文件夹中。 the shortcut exe files is created during the setup of the application by the user and automatically gets placed in the main folder . 快捷方式exe文件是在用户安装应用程序时创建的,并自动放置在主文件夹中。 the main folder is created during the setip of the users first application produduced under my trademarked name "Alternate Futue" once set up all following alternate future applications will find and populate the main folder an exe file for its application. 主文件夹是在以我的商标名称“ Alternate Futue”生产的用户首次使用该应用程序的过程中创建的。一旦设置好,以下所有以后的替代应用程序将在主文件夹中找到并填充该应用程序的exe文件。

how do I now get those exe files to be displayed as buttons that can launch the applications ? 现在如何将那些exe文件显示为可以启动应用程序的按钮? any ideas ? 有任何想法吗 ?

I'm assuming WinForms here, so Just add a ToolStrip control and Dock it to the bottom of your form. 我在这里假设使用WinForms,因此只需添加一个ToolStrip控件并将其停靠在表单底部即可。

Add some ToolStripButtons , set the Image property to something meaningful. 添加一些ToolStripButtons ,将Image属性设置为有意义的值。

Then peform some action when each ToolStripButton is clicked: 然后,在单击每个ToolStripButton时执行一些操作:

Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
    Shell("D:\projects\VisualBasicAFMRD\AFMRD\bin\Debug\AFMRD.exe", vbNormalFocus)
End Sub

If you want to add items dynamically at runtime. 如果要在运行时动态添加项目。 Have a look at this SO question: Adding Items to ToolStrip at RunTime 看看这个SO问题: 在运行时将项目添加到ToolStrip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM