看到最简单的用非Form的控件拖动Form

在运行时通过鼠标拖动移动控件位置(c#) 前些日子因为工作需要想了解有关于在C#下实现运行时鼠标移动控件的方法,Google了一下还真找到了一个帖子,粗略看去代码还真不少,感觉有点复杂的样子,因为当时手头上还有点别的事情,没来得及细看,就把帖子转到了自己的blog里面收藏。周末晚上没事,抽时间看了一下程序,发现只能以Form为容器进行操作(因为使用了Form的一些属性来确定控件位置),不完全符合自己的需要,而且作者的实现代码似乎多了一点, 阅读详情
http://blog.codelphi.com/nil/articles/1483.aspx

只要在 onMouseDown事件里加入
    ReleaseCapture;
    ((Sender as TControl).Owner as TForm).Perform(WM_SYSCOMMAND, $F012, 0);
C#实现运行时控件拖动操作指南 Windows Forms控件分为标准控件和自定义控件。标准控件如Button、Label、TextBox等,是.NET Framework提供的预定义控件。自定义控件可以由开发者根据需要创建和设计,扩展标准控件集的功能。理解控件的基本属性、方法和事件是实现拖动功能的前提。WPF(Windows Presentation Foundation)是微软推出的一种用于构建Windows客户端应用程序的用户界面框架,它采用了XAML(可扩展应用程序标记语言)来定义用户界面。 阅读详情

相关推荐

PyQt5混搭qfluentwidgets实战:用FramelessWindow快速打造现代化界面

本文详细介绍了如何将PyQt5与qfluentwidgets组件库结合,利用FramelessWindow快速打造现代化无边框界面。通过环境配置、核心特性解析、组件混用技巧及高级样式定制,帮助开发者提升桌面应用的用户体验和美观度,特别适合需要现代UI设计的Python开发者。

sugar的博客 969

创建可拖动控件

/**///////////////////////////////////////////////////////////////////////////转自http://longzhaokai.cnblogs.com/archive/2005/09/16/238512.html///文件名称:ControlMove.cs///生成时间:2005.8.2///作    者:龙照凯///功能说

C#的专栏 6260

Android Display Graphics #1 整体框架介绍一

手机屏上显示的内容,2D或3D ,如果是 3D 的,不管是 App 还是游戏,或者简单的图片界面,底层都是通过 GPU、 通过 OpenGL(ES)绘制出来的。是Java层的一个类,提供了一系列API,使用这些API可以实现各种的产品经理要求的效果。显示的不同阶段对这块内存的叫法不同,在上层可以是Window、ANnativeWindow、Surface、SurfaceView、layer、buffer,这些本质上没啥区别,可以广泛意义上理解为用于显示内容的那块内存,只不过各个阶段的操作接口不同。

oDwyane03的博客 1385

C# WinForm实现窗体上控件自由拖动功能示例-OK

C# WinForm实现窗体上控件自由拖动功能示例 更新时间:2017年07月06日 10:14:49 作者:a771948524 我要评论 这篇文章主要介绍了C# WinForm实现窗体上控件自由拖动功能,涉及WinForm控件属性及事件响应相关操作技巧,需要的朋友可以参考下 本文实例讲述了C# WinForm实现窗体上控件自由拖动功能。分享给大家供大家参考,具体如下: ...

cxu123321的博客 2842

Vivado XDMA仿真实战:从配置到链路训练全解析

本文深入解析了Vivado中XDMA IP核的仿真实战流程,重点剖析了PCIe链路训练状态机(LTSSM)的工作原理与调试方法。通过搭建仿真环境、解读日志与波形,手把手指导如何从配置、链路训练(LTSSM)到BAR映射与DMA启动进行全流程分析与问题定位,帮助工程师掌握核心调试技能,确保PCIe链路稳定与数据传输正确。

weixin_29197051的博客 154

从零构建智能监控系统:ZLMediaKit与SpringBoot的RTSP流处理实战

本文详细介绍了如何从零构建智能监控系统,结合ZLMediaKit与SpringBoot实现RTSP流处理。通过多协议支持、高性能架构设计及工业级部署优化,解决传统监控方案的兼容性差、延迟高等问题,适用于物联网和智能安防领域。

weixin_29002209的博客 370

C#:可拖动控件

 练手时发现有一软件上有可以拖动的图片感觉可能是一个可以拖动的控件,于是乎想自己写一个看看无奈很菜,google一下得参考一篇C#创建可以随意拖动的控件(http://blog.sina.com.cn/s/blog_4a1f2422010004hm.html)跟着学习,自己模仿了一个新建工程,c#窗口程序,添加一Button控件,名之button1对此button1处理三个事件:MouseDo

流云轩 1520

OpenClaw:深度学习驱动的智能编程工具实战解析

智能编程工具通过深度学习技术革新传统开发流程,其核心在于代码语义理解与实时协作能力。这类工具采用AI代码补全、错误预测等技术,显著降低开发者认知负荷,尤其适用于复杂业务逻辑开发和遗留系统维护场景。以OpenClaw为例,其智能填充和上下文感知功能可提升40%编码效率,减少65%调试时间。关键技术实现包含自然语言处理、代码静态分析等,在金融科技、电商系统等领域具有广泛应用前景。热词提示:代码理解引擎、智能工作流整合展现了当前AI辅助开发的最新趋势。

chubaisheng8627的博客 320

通过拖动控件来移动窗体

#region 设置鼠标拖动控件 bool isFlag = false;//是否在拖动窗体 int enterX, enterY; /// <summary> /// 在指定的控件上托动窗体 /// </summary> /// <param name="c">指...

dyzeke的博客 266

DRAM 埋入式字线(Buried Wordline)技术深度解析:从二维平面到三维凹槽

埋入式字线(bWL)及其核心的埋入式沟道阵列晶体管(BCAT)架构,无疑是 DRAM 发展史上的一次关键性革命。它在约 40nm 技术节点被行业主流采纳,成功地帮助 DRAM 产业克服了传统平面晶体管的物理缩放极限。力挽狂澜的续命技术:bWL 通过引入三维沟道结构,从根本上解决了由短沟道效应和漏电流失控引发的数据保持危机,为经典的 1T1C(单晶体管 - 单电容)DRAM 单元架构延续了超过十年的生命力。协同优化的基石技术。

m0_37606066的博客 3326

【毕设救星】从0到1打造YOLOv8货架商品检测与可视化系统,让你的毕设脱颖而出

本文介绍了一个基于YOLOv8的货架商品检测系统毕设项目。系统采用YOLOv8模型进行商品检测,包含环境搭建、数据集准备、模型训练与验证等完整流程,并开发了可视化UI界面。项目聚焦智能零售应用场景,技术栈完整且易于实现,适合作为计算机视觉方向的毕业设计。文章详细指导了从数据标注、模型训练到界面开发的全过程,提供代码示例和实用建议,帮助学生快速完成毕设并提升答辩表现。

LXY_LOVE36的博客 103

动态创建可拖动缩放的控件

1. 定义变量private Control downCtrl;//鼠标按下控件private Point  downLoc;//鼠标按下位置bool ctrlMove;//标记拖动状态bool ctrlZoom;//标记缩放状态2. 定义控件的MouseDown事件private void Control_MouseDown(object sender, MouseEventArgs e){  ...

nj2011zy的博客 1024

【项目实战】YOLOV5 +实时吸烟目标检测+手把手教学+开源全部

本原创项目长期更新,旨在完成校园异常行为实时精检测,做到集成+N次开发+优化(不止局限于调包)为止,近期将不断更新以下模型+数据+标注文件+教程。关注博主,Star 一下github,一起开始美妙的目标检测之路吧~~ 文章目录本原创项目长期更新,旨在完成校园异常行为实时精检测,做到集成+N次开发+优化(不止局限于调包)为止,近期将不断更新以下模型+数据+标注文件+教程。关注博主,Star 一下github,一起开始美妙的目标检测之路吧~~一、项目展示二、项目资源共享1:训练图片:香烟图片+吸烟手势+烟雾三、

cv君的博客 13万+

C#拖动移动控件(以拖动panel及包含的控件为例)

这里是通过拖动panel里的名为component的picturebox,来实现整个panel的拖动 有时候panel设计得很紧凑,直接给panel设计拖动是不可行的,因为无法触发点击事件,点击到的只是panel内的控件;panel位置改变,里面的控件也会跟着移动 拖动单个控件的原理是一样的; Point pt; private void component_MouseDown(object sender, MouseEventArgs e) {

weixin_44284194的博客 3162

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Delphi中图片的拖动和缩放

在Form页面(非image控件)的FormMouseWheelUp和FormMouseWheelDown事件中 执行下面的代码可以实现图片缩放功能 即在滚轮事件时调整图片的大小. image1.Width := image1.Width + Integer(Trunc(image1.Width/10)); image1.Height := image1.Height + Integ...

无终街的博客 3027

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

C# WinForm控件的拖动和缩放的实现

原文:http://www.codesky.net/article/200908/127342.html C# WinForm控件的拖动和缩放是个很有用的功能。实现起来其实很简单的,主要是设计控件的MouseDown、MouseLeave、MouseMove事件,下面的几个步骤将逐步实现C# WinForm控件的拖动和缩放的功能。 1、定义一个枚举类型,描述光标状态 private en

每天进步一点点 8918

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

c# 利用 两个TREEVIEW控件完成TEENODE的鼠标拖动操作

c# 利用 两个TREEVIEW控件完成TEENODE的鼠标拖动操作 功能说明:   我们有两个TREEVIEW控件——TREEVIEW1,TREEVIEW2。Treeview1内有三个NODE,Treeview2内有三个NODE。将Treeview1内的NODE...

dff407407787736的专栏 118

C#基础系列:开发自己的窗体设计器(实现控件的拖动)

【转 http://blog.youkuaiyun.com/ronotian/article/details/3168178】 控件移动的关键点就是需要设计一个独立于任何控件的类(UIMoveKnob)来控制控件的移动。我这里实现的方法只针对一个控件,如果需要同时选择多个控件,然后同时移动的话,你需要修改这个类,这里是有点难于控制,我使用的方法严重耦合,所以只在这里给出移动一个控件的办法,具体移...

weixin_30689307的博客 534

无标题栏Form的拖动实现

//首先using一个:using System.Runtime.InteropServices;  //drag forms import#region drag Forms realize  //然后引入dll.        [DllImport("user32.dll")]        public static extern bool ReleaseCapture();    

Sugar_Tiger[糖伯虎]的专栏 882

C#创建可以随意拖动的控件

经常进行图形界面设计的编程者肯定知道,控件在设计的时候才能随意拖动,运行的时候就不能拖动了. 你肯定会问:运行时能随意拖动控件吗?答案是肯定的,我们的项目涉及到了这一点,我已经实现了,实际上很简单的哟.我就拿出来给你们show一下,哈哈,各位高手不要笑我哟. 我们先从简单的入手,一步一步的来吧: 首先,新建一个Form1,拖进去一个label1,text为:鼠标拖动控件练习.接下来...

adjcqbb47379的博客 642

C#如何实现控件移动拖动

1 //在picturebox鼠标移动 2 private void picBox_MouseMove(object sender, MouseEventArgs e) 3 { 4 if (MoveFlag) 5 { 6 picBox.Left += Convert.ToInt16(e.X - xPos);//设置x坐标. 7 picBox.Top += Convert.ToInt16(e.Y - yPos);//设置y坐标. 8 } 9 } ...

zhjmyx的专栏 3952

关于在datagridview中拖动行的问题

因为有这样的需要,所以在网上搜索了一下解决的办法,查到如下一段代码: private void dataGridView_CellMouseMove(object sender, DataGridViewCellMouseEventArgs e)         {             if ((e.Clicks             {                 if ((e.C

hp4123533的专栏 4641

C#实现控件拖动窗口

1. 添加Using 声明 using System.Runtime.InteropServices; 2.在类中加入如下API代码: [DllImport("user32")] private static extern bool ReleaseCapture(); [DllImport("user32")] ...

ancong2859的博客 307

c# groupbox大小,C# 实现可拖动和调整大小的控件

usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Drawing;usingSystem.Windows.Forms;namespaceToolcs{classDragComponent{#region实现窗体内的控件拖动//用法:在Form初始化或者...

weixin_29539039的博客 1073
上一篇: 在sqlserver中存储多媒体数据
下一篇: zt:SQL语句导入导出大全
libra01
博客等级 码龄26年 0粉丝 41原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值