如何避免图像被按钮隐藏
我在位按钮的右上角保留了一个 TImage 组件。在加载表单时,图像的某些部分被按钮隐藏,如图像中所示。如何避免这种情况。?还告诉我如何找到按钮的一角,以便我可以正确放置图像,以便在动态加载按钮的情况下正确显示通知。
您的 Rakesh。
I have kept an TImage component at the Top-right corner of a bitbutton.While loading of Form some part of image is Hidden by Button as like in image .How to avoid this.? and also tell me how to find corner of a Button such that i can place my image correctly to show notification correctly in case of Dynamically loaded buttons.
Yours Rakesh.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
TImage 不能放在 TBitButton 前面,因为 BitButton 是窗口控件 (TWinControl)。您可以使用不是 TWinControl 派生的控件(如 TSpeedButton)来代替 TBitBtn 或 TButton。
按钮的右上角位于 (Button.Left + Button.Width, Button.Top)。
A TImage cannot be brought in front of a TBitButton since a BitButton is a windowed control (TWinControl). Instead of a TBitBtn or a TButton, you can use a control which does not descend from TWinControl, like a TSpeedButton.
The top-right corner of a button is at (Button.Left + Button.Width, Button.Top).
TBitButton 拥有一个窗口句柄,并且只有具有自己的窗口句柄的控件才能放置在它的前面。您可以将位图放在 TPanel 上(TPanel 继承自 TWinControl 并具有窗口句柄),并且可以将此面板放在任何其他控件的前面。将面板的BorderStyle设置为bsNone,这样它就只起到容器的作用,不可见。
PS如果你的位图像你的例子中的那样简单,你可以直接在面板上书写并相应地设置颜色。
A TBitButton owns a window handle and only controls with an own window handle can be placed in front of it. You could place your bitmap on a TPanel (TPanel inherits from TWinControl and has a window handle), and this panel you can bring in front of any other control. Set the BorderStyle of the panel to bsNone, so it only works as a container and is not visible.
P.S. If your bitmap is as simple as the one in your example, you could directly write onto the panel and set the colors accordingly.