WPF:将鼠标悬停在特定控件上时,增加其大小并与其他控件重叠
我希望每当用户将鼠标悬停时增加控件的大小。
大小增加不应重新调整其他控件,而当前控件应与相邻控件重叠,如下所示的 google 搜索(图像选项卡)的情况:
带有红色边框的图像与其他图像重叠。
I wish to increase the size of a control whenever the user hovers the mouse.
The size increase should not readjust the other controls, rather the current control should overlap the neighboring controls as is the case with google search (images tab) shown below:
The image with red border overlaps the other images.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在 IsMouseOver 的 RenderTransform 中使用 ScaleTransform。如果您希望从控件中心完成缩放,可以使用 RenderTransformOrigin="0.5,0.5" 。另外,您可能需要在触发器中设置 ZIndex,以确保它显示在其他控件的顶部。 TextBlock 示例
更新
像这样尝试一下
You could use ScaleTransform in RenderTransform on IsMouseOver. If you want the Scaling to be done from the Center of the Control you can use
RenderTransformOrigin="0.5,0.5"
. Also, you'll probably need to set the ZIndex in the Trigger to make sure it is displayed on top of the other Controls. Example with a TextBlockUpdate
Try it like this
为了获得阴影效果,同时为图像提供水平对齐:
For a shadowing effect, along with giving the image a horizontal alignment:
@Meleak...当您将多个 TextBlock 堆叠在一起时,您将无法获得所需的效果...
例如检查此:
@Meleak... You would not get the required effect when you have multiple TextBlocks stacked together....
for e.g. check this :