perl - 如何从 Perl 完全改变 Win32 标题栏的外观?

标签 perl titlebar win32gui

我正在学习使用 Win32::GUI 将 GUI 添加到我的 Perl 程序中。现在我可以使用以下命令更改 Win32 标题栏的图标:

$myicon = new Win32::GUI::Icon('myicon.ico');
$myclass=new Win32::GUI::Class(
-name=>'myclass',                     
-icon=>$myicon,  
    );  
$mydialogbox = new Win32::GUI::DialogBox(
  -name         => 'mydialogbox',
  -class        => $myclass,
  );

但是其他的东西呢,比如背景颜色、最小化按钮的外观和感觉?

我用谷歌搜索了这个主题,找到了几篇可能相关的文章。他们谈论诸如非客户区绘画等内容,但代码片段似乎都是用 C 编写的,我对此不太熟悉。

我想知道这里是否有人可以分享一些用 Perl 编写的处理类似情况的代码片段?或者,是否有一个 Perl 模块可以帮助完成这项任务?

感谢您的指导:)

****更新1****

我可以先让标题栏消失,然后在原来标题栏所在的位置添加一个标签,然后添加一些其他按钮来最小化和关闭对象吗?

现在的问题是:当鼠标位于标签上时,如何移动 Window 对象?

****更新2****

我发现了一些 VB 代码片段,它们应该能够完成我想要在 Perl 中完成的工作。有人可以帮我用 Win32::GUI 重写它们吗? 以下VB代码来自here :

    Option Explicit

' API functions
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long

' Constants for above API calls
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1

Private Sub Form_Load()
  Dim retVal As Long

  retVal = SetWindowText(Me.hwnd, Label1)
End Sub

Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  ReleaseCapture
  SendMessage hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End Sub 

最佳答案

窗口装饰是由操作系统根据用户的喜好绘制的。它们(理想情况下)在所有应用程序中都是标准化的,并且可以快速轻松地学习新应用程序。

此外,一些用户会调整 window 装饰的外观来弥补视力不佳或旧设备等问题。

有一个非常出色且非常关键的writeup of QuickTime 4.0 on the UI Hall of Shame其中涉及一些细节,解释了为什么覆盖默认操作系统的外观和感觉很糟糕,以及它可能导致什么样的问题。

The decision to eschew the existing interface controls provided by the operating system creates a variety of problems. The decision not to provide a title bar, for example, resulted in the loss of the standard window management controls. Windows users will find the the player offers no visual indication as to how to move, minimize, or maximize the player window ...

关于perl - 如何从 Perl 完全改变 Win32 标题栏的外观?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2129830/

相关文章:

perl - 我的 Linux 守护进程如何知道 Windows 程序何时停止写入我通过 SAMBA 访问的文件?

r - 如何从 R 运行带有特定模块的 perl 脚本?

c++ - win32应用程序、windows窗体应用程序和控制台应用程序有什么区别?

abap - 如何更改程序标题栏?

c++ - Win32 GDI 画一个圆?

multithreading - File::Tee 的线程安全替代方案?

java - 在 Perl 中使用 Inline::Java 和线程

android - 无法隐藏 Nexus 7 上的标题顶部栏

python - wxWindows/wxPython 中没有标题栏的窗口