将TPopupMenu对齐到窗体的右侧? [英] Align a TPopupMenu to the right hand side of the form?

查看:104
本文介绍了将TPopupMenu对齐到窗体的右侧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TPopupMenu如何与表单的右侧对齐?问题是,在调用 Popup(X,Y:Integer)之前,似乎没有办法获取弹出菜单的宽度。



我试图得到类似于Chrome中系统菜单的行为。



解决方案

你也可以设置 对齐 paRight 并使用ClientToScreen调用

  Point(ClientWidth  -  1,0))do 
Popup(X,Y);


How can a TPopupMenu be aligned to the right hand side of a form? The problem is that there doesn't seem to be a way to get the width of the Popup menu before you call Popup(X, Y: Integer).

I'm trying to get a behavior similar to that of the system menu in Chrome.

解决方案

You could also just set Alignment to paRight and call

with ClientToScreen(Point(ClientWidth - 1, 0)) do
  Popup(X, Y);

这篇关于将TPopupMenu对齐到窗体的右侧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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