SWT无标题栏的窗口移动

Pywinauto Recorder:Windows GUI自动化脚本录制与生成实战指南 GUI自动化是软件测试与流程自动化领域的核心技术,它通过模拟用户操作实现界面交互的自动化执行。其原理基于操作系统提供的UI自动化API,能够识别和操作桌面应用程序中的各种控件元素。这项技术的核心价值在于将人力从重复性高的手工测试和操作中解放出来,提升效率并降低错误率,广泛应用于软件测试、日常办公自动化、数据录入等场景。在Windows平台,Pywinauto作为成熟的Python GUI自动化库,结合其录制工具Pywinauto Recorder,能够实现“所见即所得”的脚本自动生成,大幅降低自动化门槛。本 阅读详情

当我们想用SWT做自定义风格的窗口时,最容易想到的就是去除Shell的Title,但是默认情况下没有Title的Shell是不能拖动的。以下代码实现无Title窗口的拖动:

[java]  view plain copy
  1. Listener listener = new Listener() {  
  2.     int startX, startY;  
  3.     public void handleEvent(Event e) {  
  4.         if (e.type == SWT.MouseDown && e.button == 1) {  
  5.             startX = e.x;  
  6.             startY = e.y;  
  7.         }  
  8.         if (e.type == SWT.MouseMove && (e.stateMask & SWT.BUTTON1) != 0) {  
  9.             Point p = shell.toDisplay(e.x, e.y);  
  10.             p.x -= startX;  
  11.             p.y -= startY;  
  12.             shell.setLocation(p);  
  13.         }  
  14.     }  
  15. };  
  16. shell.addListener(SWT.MouseDown, listener);  
  17. shell.addListener(SWT.MouseMove, listener);  
SWT无边框窗体实现鼠标拖动移动 SWT无边框窗体实现鼠标拖动移动,并添加右键菜单关闭功能 立即下载

相关推荐

kettle8.2 windows与linux白屏问题解决.docx

linux系统安装kettle,点击connect,出现白板,在linux系统解决此问题 windows系统安装kettle,点击connect,出现白板,在windows系统解决此问题

SWT高级主题第一部分

SWT高级主题(Standard Widget Toolkit)第一部分在SWT基础中,我们简要的了解了SWT的产生背景,开发SWT应用程序的基本要求以及基本的SWT组件以及部分事件监听器。本部分内容将介绍一些高级的组件,布局管理器等高级主题。高级组件:Tables:Table组件用于显示图片或者字符串的列表,并且在被选择的时候可以弹出提示。Table table1 = new T

NCNC 5540

带最小化、最大化、关闭按钮的titlewindow

重写titlewindow,带最小化、最大化、关闭按钮,方便前端使用

SWT之五:窗体展示

// TODO Auto-generated method stub   Display display = new Display();   //获得该Display的一个Shell类的实例   Shell shell = new Shell(display);   //为窗口设置大小   shell.setSize(200, 200);   //为窗口设置标题栏文字   shel

freellf的专栏 937

高质量水下垃圾数据集解析与应用实践

计算机视觉在环保领域的应用日益广泛,其中目标检测技术是关键支撑。通过深度学习模型对水下垃圾进行精准识别,需要高质量标注数据集作为基础。1962幅水下垃圾数据集采用专业预处理流程,包括色彩校正、去雾增强等技术,有效解决了水下图像的光照不均、水体浑浊等典型问题。该数据集覆盖12类常见海洋垃圾,标注错误率低于2%,显著提升了模型训练效果。在工程实践中,该数据集特别适合用于水下机器人实时检测系统和海洋垃圾分布热力图生成等场景,通过优化模型架构和数据增强策略,可实现更高效的环境监测与保护。

weixin_42616115的博客 260

【无标题】IP804A参考资料和管脚作用图

3.3V内置led控制内置EEPROM接口,用于哑应用ip804a,可集成为4X N端口PSE稳压器内置支持外部设备。多个系统和IC总线用于从每个IP804A收集PD电源状态,以支持全局电源管理。多个ip804a可以构建一个具有成本效益的PHY级PSE系统以支持PD分类和电源管理,而无需主机。基于LLDP(IEEE标准8023AT-2009的一部分),可以实时维护PSE和PD之间的动态电源管理,以提高电源效率。IP804A是一款用于POE(以太网供电)系统的4端口PSE(电源设备)控制器IC。

2301_78055735的博客 1062

自定义的顶部标题栏

标题栏一直是使用次数非常多的一个东西,所以把标题栏模块化,更能加快我们的开发效率 本文将自定义一个标题栏,用于复用,只是一个基本的小架子,不过思路很重要,有了这个思路,相信都能做出一个漂亮的模块化的标题栏 首先 在Valus文件夹下面新建一个atts文件,使用styleable来定义我们的需要实现的一些自定义的属性,name中放置属性的名字,frormat设置属性的类型,比如左边的textv

Big_Sweet 1851

基于大模型的围术期谵妄防控系统研究报告

围术期谵妄是一种急性脑功能障碍综合征,通常发生在手术前后一段时间内。患者会出现意识障碍、注意力不集中、认知功能紊乱、睡眠 - 觉醒周期失调等症状,严重者甚至会出现幻觉、妄想和攻击行为 。这种病症不仅会给患者自身带来极大的痛苦,还会对其术后康复产生严重的负面影响。从患者角度来看,围术期谵妄会显著延长患者的住院时间,增加患者的医疗费用负担。有研究表明,发生谵妄的患者住院时间平均比未发生者延长 2 - 3 天。长时间的住院不仅会影响患者的生活质量,还可能导致患者错过最佳的康复时机,影响身体机能的恢复。同时,谵妄还

嵌入式毕设/课设资料清单(速查手册·文档模板·题库,持续更新)→ 见最新文章 1076

swt 常用样式

SWT.BORDER //建立一个有边框但没有标题栏的窗口 SWT.CLOSE //建立一个只有关闭按钮的窗口 SWT.MIN //建立一个不能最大化的窗口 SWT.MAX, //建立一个可以最大化最小化的窗口 SWT.NO_TRIM //建立一个没有任何边界和标题栏的窗口...

chihe8232的博客 203

Pytorch.nn.Linear 解析(数学角度)

pytorch.nn.Linear 是一个类,下面是它的一些初始化参数 in_features : 输入样本的张量大小 out_features : 输出样本的张量大小 bias : 偏置 它主要是对输入数据做一个线性变换。 y=xAT+b y=xA^T+b y=xAT+b 这里A是权重矩阵,b是偏置。他们都是根据 in_features 生成 测试代码: m = torch.nn.Linea...

Medlen 1万+

ECharts 实现世界地图

效果图 源代码(仅供参考) <template> <div class="echarts"> <div class="className" id="id" style="width: 100%; height: 450px" ref="myEchart" ></div> </div> </template> <script lang="ts"> imp

EsquireY的博客 4878

SWT无标题栏窗口的拖动

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34117522的博客 248

手把手教你用STM32标准库写一个能OTA升级的Bootloader(附完整代码)

本文详细介绍了如何使用STM32标准库开发支持OTA无线升级的Bootloader系统,包括Flash分区规划、Bootloader核心实现、无线升级流程及安全校验机制。通过实战代码示例,帮助开发者快速掌握STM32固件升级技术,提升物联网设备的远程维护能力。

weixin_30181209的博客 267

如何拖动无标题窗体

最近用到了无标题的窗体,想实现的功能总不能实现,郁闷。。。。。。。。。中间碰到了移动无标题的问题,纯属误打误撞。但是对于原本想实现的功能没有什么启发。但是这个还是保留一下吧。 新建一个窗体将FormBorderStyle设置为None。就能演练了        [DllImport("user32.dll")]        public static extern bool Re

一路采撷 1960

UNet 改进(39):结合残差连接与CBAM注意力机制的unet模型

本文提出了一种改进的UNet架构,通过融合残差连接和CBAM注意力机制来增强医学图像分割性能。该网络保留UNet的U形结构,但将基础模块替换为ResidualBlock和CBAM的组合:残差块通过快捷连接解决梯度消失问题,CBAM模块结合通道和空间注意力机制突出重要特征。整体架构采用编码器-解码器设计,包含5个下采样和上采样阶段,通过跳跃连接融合多尺度特征。实验表明,这种改进显著提升了原始UNet的性能,特别适用于需要精细边界的医学图像分割任务。

2401_82355416的博客 1051

《模型轻量化-剪枝蒸馏量化系列》YOLOv5无损剪枝(附源码)

无损剪枝模型到几百kb~

cv君的博客 3万+

无标题窗体移动事件

public Point exe;         //当鼠标点击事件         private void Form1_MouseDown(object sender, MouseEventArgs e)         {             exe = new Point(e.X,e.Y);//获取当前窗体位置         }         //当鼠

第七秒 667

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

实现无标题栏窗口的拖动

SWT窗口程序默认是带标题栏的,窗口栏有最小化、最大化、关闭按钮,我们可以拖动标题栏实现窗口的移动此时窗口不能拖动了,只能通过加监听事件实现当我们加入下面这段代码,就能实现窗口的拖动了,如果窗口的上方没有任何控件覆盖,这时窗口的任何地方都能产生拖动效果,如果有覆盖,则覆盖的地方不能产生拖动效果。 如果想让shell上方的控件也能产生拖动窗口拖动效果,只需要给对应的控件加上监听就行,如:.........

qq_62719995的博客 901

vb 6.0并口开发操作实例

vb6并口开发,简体中文,试例内有inpout32.dll动态链接库

InTheHand.Net.Personal+BlueTooth4,蓝牙开发

项目中有蓝牙开发的必备dll,现在网上相关的文档博客不少,有的说的多有的说少,但是却很少有这两个dll,分享一下。

java 隐藏标题栏_java隐藏标题栏并且可以移动例子

import java.awt.event.mouseadapter;import java.awt.event.mousemotionlistener;import java.awt.borderlayout;import java.awt.component;import java.awt.point;import java.awt.event.actionevent;import java....

weixin_36296983的博客 230

深度学习工具包 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")

SWT基础(二)

窗口小部件:widget 部件的外观是通过绘制显示出来的,通过绘制操作来维持部件的状态。用户可以通过界面交互和代码控制的方式,改变部件的状态,部件的状态一旦改变,就会立即重绘。   shell SWT.BORDER //建立一个有边框但没有标题栏的窗口 SWT.CLOSE //建立一个只有关闭按钮的窗口 SWT.MIN  //建立一个不能最大化的窗口 SWT.MAX, //建立...

leng1987021的博客 238
上一篇: swt 关闭对话框 关闭dialog
下一篇: 设置SWT包中的Label背景透明的方法
linuxchyu
博客等级 码龄17年 28粉丝 178原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址