显示消息框以使用Powershell脚本从中复制代码部分 [英] Display Message Box to copy code section from it using Powershell script

查看:134
本文介绍了显示消息框以使用Powershell脚本从中复制代码部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Nuget pacakge构建 install.ps1 脚本,并希望在结束时打开弹出消息并显示一些消息,我已经通过遵循以下步骤实现了.

I am building install.ps1 script for Nuget pacakge and would like to open popup message at the end with some message , i have already achieved by following.

[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[Windows.Forms.MessageBox]::Show("Test message ", "Test", [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Information)

它将打开弹出消息,如下图所示.

It will open popup message as per shown in below fig.

我想在这里放一些配置代码,用户可以按照下面的图从框中复制

Instead of this i would like put some config code here that user can copy from box as per below fig

如果有人曾经做过类似的弹出框,请建议我!

Please suggest me if anyone has done similar popup box before!

推荐答案

您将无法自定义Windows.Forms.MessageBox来添加所需的内容.为了完成您想要的工作,您需要创建一个自定义表单.一种简单的方法是使用Primal Forms Community Edition,该版本可在此处找到.您需要免费注册才能下载.有付费版本,因此请不要将其与免费的CE版本混淆.该工具为您提供了一个类似于Visual Studio的窗体编辑器,您可以在其中将控件拖放到窗体上并保存Powershell脚本.您需要为复制到文本到剪贴板按钮创建一个事件处理程序.保存PrimalForms CE生成的代码后,您将需要对其进行编辑以添加事件处理程序的代码. 此处.

You won't be able to customize Windows.Forms.MessageBox to add what your looking for. In order to do what your looking for you'll need to create a custom form. An easy way of doing this is to use Primal Forms Community Edition which can be found here. You'll need to register for free to reach the download. There's a paid for version to so don't confuse that with the free CE edition. This tool gives you a Visual Studio like forms editor where you can drag and drop controls to a form and save the Powershell script. You'll need to create an event handler for the copy to text to clipboard button. After you saved the code generated by PrimalForms CE you will need to edit it to add the code for the event handlers. An example of how you can set the clip board with Powershell can be found here.

这篇关于显示消息框以使用Powershell脚本从中复制代码部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆