相关疑难解决方法(0)

如何使用PowerShell快捷方式中的"默认"颜色启动powershell.exe?

当您从其中一个预安装的快捷方式启动PowerShell窗口时,我会依赖它的漂亮蓝色.但是,如果你手动启动powershell.exe,你没有得到这些颜色,你得到黑/白:(

这是因为默认设置是在快捷方式(.lnk)文件上设置的:

PowerShell快捷方式颜色设置

我在Explorer上下文菜单中有一个"PowerShell Prompt Here"条目,我希望它使用与通常的快捷方式相同的漂亮颜色来启动PowerShell; 黑色很糟糕,而且有不同颜色的窗户会让人感到困惑(特别是当我有一些经常打开的老式指令窗户也是黑色的时候!).

到目前为止,我发现了两个问题:

  1. 在PowerShell中设置颜色似乎只允许某些值(ConsoleColor枚举),它们都不匹配默认快捷方式上的值.
  2. 在PS配置文件中设置颜色只会导致之后写入的文本符合新的背景颜色.添加"cls"会在启动时导致原始颜色的令人讨厌的闪烁.

有没有办法从命令行启动PowerShell(即我可以将其作为资源管理器上下文菜单项嵌入到注册表中),它将使用与快捷方式相同的设置?

shell powershell powershell-3.0

33
推荐指数
5
解决办法
3万
查看次数

我不能通过c#中的句柄设置窗口的透明度?

我试图设置所有窗口的透明度.我有以下代码.

public partial class Form1 : Form
{
    [DllImport("user32.dll")]
    static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

    [DllImport("user32.dll")]
    static extern int GetWindowLong(IntPtr hWnd, int nIndex);

    [DllImport("user32.dll")]
    static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags);

    public const int GWL_EXSTYLE = -20;
    public const int WS_EX_LAYERED = 0x80000;
    public const int LWA_ALPHA = 0x2;

    public Form1()
    {
        InitializeComponent();
        this.Load += new EventHandler(Form1_Load);
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        Process[] processlist = Process.GetProcesses();

        foreach (Process theprocess in …
Run Code Online (Sandbox Code Playgroud)

c# transparency handle

3
推荐指数
1
解决办法
1744
查看次数

标签 统计

c# ×1

handle ×1

powershell ×1

powershell-3.0 ×1

shell ×1

transparency ×1