菜鸟问题,vb.net 窗体禁止拖动 通过什么属性怎么设置? 解决立即给分,先到先得。

shanbingch 2006-04-13 09:07:47
如题,呵呵~~~

...全文
495 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
shanbingch 2006-04-13
  • 打赏
  • 举报
回复
laviewpbt(人一定要靠自己)
我用的是vb.net 2003 里面的确没有“Me.Moveable ”这个属性
laviewpbt 2006-04-13
  • 打赏
  • 举报
回复
In the .NET Framework, this property no longer exists.
shanbingch 2006-04-13
  • 打赏
  • 举报
回复
peilianhai(网侠)

设置formmove属性
me.left=100
me.top=100
用鼠标拖的时候会闪,效果不好
*************************************************
laviewpbt(人一定要靠自己)
vb.net里面没有这个属性,vb里面有,我就是想找vb.net中有没有这个属性。
peilianhai 2006-04-13
  • 打赏
  • 举报
回复
设置formmove属性
me.left=100
me.top=100
laviewpbt 2006-04-13
  • 打赏
  • 举报
回复
http://www.codeproject.com/vb/net/immoveableform.asp这里有源代码下载。
shanbingch 2006-04-13
  • 打赏
  • 举报
回复
我还想要标题栏,如果重写鼠标事件,写哪个事件?
laviewpbt 2006-04-13
  • 打赏
  • 举报
回复
http://www.codeproject.com/vb/net/immoveableform.asp



Introduction
In Visual Basic 6, a form had a Moveable property. In the .NET Framework, this property no longer exists. This was possibly removed because restricting a user from moving a form is considered a bad UI design or maybe they just didn't get around to it. Regardless of whether it is a good idea to do something or not, I believe it should at least be possible.

Background
My personal, and potentially controversial, reason for needing this feature is that I like most applications on my PC to fill the screen. Unfortunately, too often the developer has coded the application to remember its size and position but not whether it was last maximized or not. As such I have developed the habit of resizing a window to fill the screen without maximizing it. This, maybe bad, habit has found its way into some of the software I have developed. I often size the main window of an application to fill the screen working area but unlike a maximized window, an accidental click and drag can move the window out of place and putting back is a hassle.

I use a .NET class library that I have developed with a class that inherits from System.Windows.Forms.Form and includes all the extra behaviour that I ever use in any application I build. I have extracted the code snippets responsible for implementing the Moveable property so that you can easily integrate it into any existing code you have without needing to inherit from my class.

Using the code
Whether you inherit from an extended form or you paste the code directly into a form with the rest of your code, it is very easy to use. Simply set the Moveable to False to disable both mouse dragging and the Move option on the system menu. Ideally you would set this in the Sub New method or in the Load event. You can set the property with the form designer too. The code is designed so that you can toggle the Moveable property at any point during run-time.

Friend Class Form1
Inherits ImmoveableForm
Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

'This disables the user's ability to move this form
Me.Moveable = False
End Sub
'usual Visual Studio designer code here
End Class
Points of Interest
The resulting code for the ImmoveableForm is really quite simple as you can see in the source. Unfortunately for me, reaching this stage was not quite so straightforward. I have never written a Windows application in C/C++ or any language that requires accessing the Windows API directly so I spent a lot of time wading through the mass of API documentation provided by the MSDN Library. Once I had discovered that the only reliable way to achieve an immoveable form was to intercept window messages I was on my way to serious progress.

Disabling dragging the window caption was quite straightforward, as was ignoring selection of the Move item on the system menu. Actually preventing a selection of the Move menu item in the first place was interesting. My first thought was to delete the Move menu item from the system menu but the Windows standard tends to be greying and disabling menu items. Deleting also makes it difficult to restore the menu when the Moveable property changes from False to True without disturbing any other potential system menu changes made by this class or a subclass.

There were some problems with setting the Move menu item to disabled from within Moveable property handler. The call to disable the menu seemed to be completely ignored and a quick Google confirmed that I wasn't the only person having trouble with this. In the end I found that the answer was to trap the WM_INITMENUPOPUP window message for the system menu and make the call to disable the Move menu there. It took a while to find the documentation for the WM_INITMENUPOPUP message because it is oddly located under Keyboard Accelerators section in the Platform SDK documentation rather than the Menus section.

hero0045 2006-04-13
  • 打赏
  • 举报
回复
将窗体的FormBorderStyle设为None
shanbingch 2006-04-13
  • 打赏
  • 举报
回复
有属性设定么?
sx_lxh 2006-04-13
  • 打赏
  • 举报
回复
重写鼠标事件;或不要标题栏。
内容概要:本文系统研究了基于粒子群算法(PSO)的微网优化调度方法,并重点引入需求响应机制以提升微电网运行的经济性与可靠性。研究构建了一个综合考虑风能、光伏、储能、柴油发电机、燃气轮机等多种布式能源的微电网模型,建立了以最小化系统综合运行成本为目标,涵盖燃料成本、环境污染惩罚、购售电费用及需求响应激励成本的多目标优化模型。文中详细阐述了粒子群算法的数学原理及其在求解此类非线性、多维度、带约束的复杂优化问题中的独特优势,通过Matlab编程实现了完整的算法流程与仿真析,验证了所提方法在有效降低系统运行成本、平抑负荷波动、提高可再生能源消纳率以及增强微网应对需求侧变化灵活性方面的显著效果。; 适合人群:具备一定电力系统、优化理论基础和Matlab编程能力的高校研究生、从事新能源、智能电网及相关领域研究的科研人员,以及致力于微电网规划与运行优化的工程技术人员。; 使用场景及目标:①用于教学与科研,深入理解微网优化调度的核心挑战、数学建模方法及智能优化算法的应用;②为实际微电网项目的规划设计、运行策略制定提供可靠的算法工具和技术参考;③作为智能优化算法(如PSO)在综合能源系统中成功应用的典型案例,推动先进算法在能源互联网领域的研究与实践。; 阅读建议:建议读者在学习过程中,务必结合文中的Matlab代码进行上机实践,重点关注目标函数的设计逻辑、各类物理约束(如功率平衡、设备出力、储能容量等)的数学表达,以及PSO算法中关键参数(如种群规模、惯性权重、学习因子)的设置与调优技巧,可通过改变参数或扩展模型(如加入更多能源形式或转化为多目标优化)来加深理解和掌握。
2026年,法学硕士工程师的实际收入是多少?每天使用人工智能工具会给你带来更多回报还是让你付出代价?5000个人工智能和数据科学角色,解码。 经典的数据科学薪酬数据集在人工智能工具时代之前就停止了。这是为它而建的:27列,涵盖职位、经验水平、就业类型、公司规模、公司所在地、员工居住地、远程比率、行业、教育、主要语言、经验年限、美元工资、股权和奖金、每周工作时间、每日人工智能工具使用和工作时间、证书、面试机会、工作转换、技能提升时间以及自我报告的自动化恐惧数。5000行,零缺失值——工资真正受到资历、市场、公司规模、行业和远程设置的影响,因此回归模型实际上学到了一些东西。 让你开始的想法: -构建一个薪酬回归模型——哪个特征的权重最大? -远程比率是伴随着薪酬溢价还是减薪? -LLM/AI头衔是否比经典的数据科学家职位更受欢迎,以及赚多少钱? -按国家绘制薪酬图——一旦你控制了资历,市场差距有多大? -谁最害怕自动化?将析师与ML工程师进行比较。 -在你控制多年的经验后,是否有博士学位溢价? -日常使用人工智能工具是否与满意度、工作时间或薪酬相关?

16,718

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧