C#WPF进入窗口 [英] C# WPF getting into the window

查看:68
本文介绍了C#WPF进入窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有执行此操作的程序示例,autodesk在窗口的拖动部分中放置了一个按钮,goold chome在其中添加了TABS !,我想知道我该怎么做,我想知道如何在可拖动的窗口内容中添加按钮选项卡以及更多内容,可以帮上什么忙吗?

there are examples of prgrams that have done this, autodesk put a button in the dragging part of the window, goold chome put TABS in it!, I want to know how i can do stuff like that, I want to know how to add buttons tabs and more on to the draggable window stuff, can some one help?

推荐答案

您的问题不是很清楚,但据我了解,您想要才能在wpf窗口中拖动东西".

您需要
1)处理MouseLeftButtonDown事件;存储当前鼠标位置并捕获鼠标
2)处理MouseMove事件;计算水平和垂直变化并相应地移动项目,如果项目位于Canvas中,则更容易完成此操作,因此可以使用Canvas.SetLeftCanvas.SetTop.最后存储鼠标的当前位置.
3)处理MouseLeftButtonUp事件;释放鼠标捕获.

WPF可拖动标签 [在画布中拖动元素 [
Your question is not very clear, but as far as I understand you want to be able to drag "stuff" around in a wpf window.

You''ll need to
1) handle the MouseLeftButtonDown event; store the current mouse position and capture the mouse
2) handle the MouseMove event; calculate the horizontal and vertical change and move the item accordingly this is more easily done if the items is in a Canvas, so you can use Canvas.SetLeft and Canvas.SetTop. And finally store the current position of the mouse.
3) handle the MouseLeftButtonUp event; Release the mouse capture.

WPF Draggable Label[^] the article doesn''t explain this very well but you might be able to use the code, also it doesn''t seem like he uses the approach I just suggested which I beleave to be the best.

Dragging Elements in a Canvas[^] This one is probably better, haven''t read it myself but I have the utmost respect for Josh, he knows what he''s talking about.


这篇关于C#WPF进入窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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