网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
12月12日漏签0天
wpf吧 关注:3,846贴子:8,166
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 17回复贴,共1页
<<返回wpf吧
>0< 加载中...

请问WPF在Blend 4中怎么实现对无边框的窗体拖动。会请详细点哦…

  • 只看楼主
  • 收藏

  • 回复
  • wendygeo
  • 小有名气
    4
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
单单一个图片之类的我已经可以实现拖动了。。。我制作了一个界面实现了3D旋转(双击下旋转到另一个界面去),但现在就是有一个问题,它居然实现不了窗体界面拖动了,我也用了这个代码MouseDown(object sender, MouseButtonEventArgs e)
{ if (e.LeftButton == MouseButtonState.Pressed),是不是因为弄了一个3D旋转界面,所以不能拖动了?请帮我找到解决的关键。。。


  • 小小已然
  • 小有美名
    5
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
添加鼠标左键单机事件,e.dragmove();


2025-12-12 18:09:10
广告
不感兴趣
开通SVIP免广告
  • 小小已然
  • 小有美名
    5
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
添加鼠标左键单机事件,e.dragmove();


  • 小小已然
  • 小有美名
    5
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
添加鼠标左键单机事件,e.dragmove();


  • 小小已然
  • 小有美名
    5
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
添加鼠标左键单机事件,e.dragmove();


  • 小小已然
  • 小有美名
    5
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
好像还的设置一个属性允许它能拖动


  • wendygeo
  • 小有名气
    4
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
我使用了右击,显示了错误。。生成项目: Mainwin.sln,目标: Build
__________________________________________________
项目“C:\Users\user\Desktop\Mainwin - 副本\Mainwin.sln”(Build 个目标): __________________________________________________
项目“C:\Users\user\Desktop\Mainwin - 副本\Mainwin.sln”正在生成“C:\Users\user\Desktop\Mainwin - 副本\Rotation\Rotation.csproj”(默认目标): Rotation -> C:\Users\user\Desktop\Mainwin - 副本\Rotation\bin\Debug\Rotation.exe
已成功完成生成。
未处理的异常: System.InvalidOperationException: 只能在按下主鼠标按钮时调用 DragMove。
在 System.Windows.Window.DragMove()
在 Rotation.Window1.Image_MouseDown(Object sender, MouseButtonEventArgs e) 位置 c:\Users\user\Desktop\Mainwin - 副本\Rotation\Window1.xaml.cs:行号 52
在 System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
在 System.Windows.Input.InputManager.ProcessStagingArea()
在 System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
在 System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
在 System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
在 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
在 System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
在 System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
在 System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
在 System.Windows.Threading.Dispatcher.Run()
在 System.Windows.Application.RunDispatcher(Object ignore)
在 System.Windows.Application.RunInternal(Window window)
在 System.Windows.Application.Run(Window window)
在 System.Windows.Application.Run()
在 Rotation.App.Main() 位置 c:\Users\user\Desktop\Mainwin - 副本\Rotation\obj\Debug\App.g.cs:行号 0



  • 小小已然
  • 小有美名
    5
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
private void Window_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
this.DragMove();
}
}
这样不行吗


2025-12-12 18:03:10
广告
不感兴趣
开通SVIP免广告
  • 忘了5555
  • 大名鼎鼎
    14
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
用API 很好解决 在能收到鼠标按下的消息的时候
SendMessage(this.handle,WM_NCLBUTTONDOWN,HTCAPTION,0);
收到鼠标释放的消息的时候
SendMessage(this.handle,WM_NCLBUTTONUP,HTCAPTION,0);
以上纯属手打,可能有记错的地方


  • interboboy
  • 默默无闻
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼


  • mm_325
  • 默默无闻
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
WPF如何将ComboBox绑定的值转换为bool类型啊啊啊啊


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 17回复贴,共1页
<<返回wpf吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示