用拇指拖动wpf窗口:可以透明吗?
我一直在测试 Blu 并且我注意到我可以拖动窗口。 这个窗口是透明的。 我尝试用拇指做同样的事情,但我不知道如何使其透明。 窗口的其余部分是透明的,但拇指不是。
有没有办法让拇指透明,或者我应该使用其他技术?
我使用这个活动:
private void DragThumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
Canvas.SetLeft(this, Canvas.GetLeft(this) + e.HorizontalChange);
Canvas.SetTop(this, Canvas.GetTop(this) + e.VerticalChange);
}
谢谢
I've been testing Blu and I noticed that I could drag the window. This window is transparent. I tried to do the same with a Thumb, but I don't know how to make it transparent. The rest of the window is transparent, but the thumb is not.
Is there any way to make the thumb transparent, or should I use another technique?
I use this event:
private void DragThumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
Canvas.SetLeft(this, Canvas.GetLeft(this) + e.HorizontalChange);
Canvas.SetTop(this, Canvas.GetTop(this) + e.VerticalChange);
}
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用不透明度属性将拇指控件设为不可见。
Opacity="1"(完全可见)
或
Opacity="0"(不可见)
来自我的应用程序的示例
You can turn a thumb control invisible with the Opacity attribute.
Opacity="1" (full visible)
or
Opacity="0" (not visible)
Sample from my application
不确定我是否正确理解您的问题,但是要拖动 wpf 窗口,您需要在表单(或表单本身)上的组件的单击事件处理程序中键入:
无需自己实现拖动功能。
更新:小例子:创建一个窗口,在其中放置一个按钮。 将窗口的 MouseDown 和按钮的 Click 连线如下:
工作完美,您可以拖动窗口,按钮继续工作...
Not sure if I understand your question correctly, but to drag a wpf window, all you need to type in the click event handler of a component on the form (or the form itsself) is:
There is no need to implement the dragging functionality yourself.
Update: small example: Create a window, place a button in it. Wire the MouseDown of the window and the Click of the button as:
Works perfectly, you can drag the window, and the button continues to work...
或者,您可以将 Thumb 控件的控件模板设置为“透明”,如下代码片段:
DragDelta 事件:
< img src="https://i.sstatic.net/3rLw0.png" alt="在此处输入图像描述">
Optionally, you can set control template of Thumb control as 'Transparent', as following snippet code:
DragDelta event: