使用Delphi我想添加另一个按钮到边框图标按钮;关闭,最大化,最小化。任何想法如何做到这一点?添加边框图标到表格
5
A
回答
5
这在Windows Aero之前很容易做到。您只需收听WM_NCPAINT
和WM_NCACTIVATE
消息以在字幕栏顶部绘制,并且类似地,您可以使用其他WM_NC*
消息来响应鼠标点击等,特别是WM_NCHITTEST
,WM_NCLBUTTONDOWN
和WM_NCLBUTTONUP
。
例如,绘制标题栏上的绳子,你只有做
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
protected
procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT;
procedure WMNCActivate(var Msg: TWMNCActivate); message WM_NCACTIVATE;
private
procedure DrawOnCaption;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.WMNCActivate(var Msg: TWMNCActivate);
begin
inherited;
DrawOnCaption;
end;
procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);
begin
inherited;
DrawOnCaption;
end;
procedure TForm1.DrawOnCaption;
var
dc: HDC;
begin
dc := GetWindowDC(Handle);
try
TextOut(dc, 20, 2, 'test', 4);
finally
ReleaseDC(Handle, dc);
end;
end;
end.
现在,这并不启用Aero的工作。不过,还有一种方法可以在标题栏上绘图;我已经这样做了,但它要复杂得多。查看this article作为一个工作示例。
1
是的,将表单的边框样式属性设置为bsNone,并使用您喜欢的所有按钮和自定义行为实现您自己的标题栏。
2
Chris Rolliston写了一个关于creating a custom title bar on Vista and Windows 7的详细博客。
他还写了follow up article并在CodeCentral上贴出示例代码。
相关问题
- 1. 向表格单元格添加边框
- 2. 添加边框到文本视图添加java编码在表格布局
- 3. 如何添加边框到表单框?
- 4. 在jasperreports中添加表格边框
- 5. 在折叠单元格边框并添加浮动图片时向表格添加双边框
- 6. 如何向Xamarin表格标签添加边框?
- 7. 将边框添加到圆形图像
- 8. 将边框添加到圆形图像
- 9. 将边框添加到图片
- 10. jQuery的添加边框表
- 11. Javascript将数组添加到带有边框的表格
- 12. 如何添加表格边框到Word文档使用Python Docx
- 13. 将边框添加到AlertDialog
- 14. 将边框添加到flash.display.Loader
- 15. 将边框添加到ImageButton
- 16. 添加边框
- 17. 将左右边距添加到UITableViewController里面的表格视图
- 18. 空格添加到X轴值的两边 - 微软图表
- 19. Silverlight:在网格周围添加边框
- 20. 添加图标列表框中vb.net
- 21. 添加边框环绕引导标签
- 22. 在鼠标悬停上添加边框
- 23. 下列标题添加边框QTableWidget的
- 24. 格框添加到列表里
- 25. Swing - JTable JScrollPane删除下边框或添加标题边框
- 26. 如何将图标\缩略图添加到wpf列表框
- 27. html添加边框
- 28. 以zend格式在标签旁边添加文本框
- 29. Kendo网格 - 将组合框和图标添加到同一列
- 30. 添加到光标内的表格