//来自:http://topic.csdn.net/u/20070105/09/88f3c417-6882-4e26-b622-0f9a0a9a65e0.html

//给你个通用函数,在窗口的OPEN事件中加句 f_resize_object(this)即可。 
//f_resize_object(window   va_window) 
//以下为内容: 
//定义环境变量

environment   ve_hjbl 
dec   vdec_width,vdec_height //宽度比率、高度比率 
integer   vi_return //返回数值 
long   vl_object 
vi_return   =   GetEnvironment(ve_hjbl) 
vdec_width   =   ve_hjbl.ScreenWidth   /   1024 
vdec_height   =   ve_hjbl.ScreenHeight   /   768 
any   vs_object_type

CheckBox   v_CheckBox 
OLECustomControl   V_OLECustomControl 
CommandButton   v_commandButton 
Oval   v_Oval 
DataWindow   v_datawindow 
Picture   v_picture 
DropDownListBox   v_DropDownListBox 
PictureButton   v_PictureButton 
DropDownPictureListBox   v_dropDownPictureListBox 
PictureListBox   v_picTureListBox 
EditMask   v_editmask 
RadioButton   v_radiobutton 
Graph   v_graph 
Rectangle   v_rectangle 
GroupBox   v_groupbox 
RichTextEdit   v_richtextedit 
HScrollBar   v_HScrollBar 
RoundRectangle   v_RoundRectangle 
Line   v_line 
SingleLineEdit   v_SingleLineEdit 
ListBox   v_ListBox 
StaticText   v_statictext 
ListView   v_listView 
Tab   v_tab 
MultiLineEdit   v_MultiLineEdit 
TreeView   v_TreeView 
OLEControl   v_OLEControl 
VScrollBar   v_VSCrollBar 
menu   v_menu 
//调整窗口属性

va_window.x   =   va_window.x   *   vdec_width 
va_window.y   =   va_window.y   *   vdec_height 
//va_window.width   =   va_window.width   *   vdec_width 
//va_window.height   =   va_window.height   *   vdec_height 
va_window.Resize(va_window.width   *   vdec_width,va_window.height   *   vdec_height)

//处理窗口内对象 
for   vl_object   =   1   to   upperBound(va_window.control[]) 
vs_object_type   =   va_window.control[vl_object].typeof()

choose   case   vs_object_type 
case   CheckBox! 
v_CheckBox   =   va_window.control[vl_object] 
v_checkBox.x   =   v_checkBox.x   *   vdec_width 
v_checkBox.y   =   v_checkBox.y   *   vdec_height 
v_checkBox.width   =   v_checkbox.width   *   vdec_width 
v_checkbox.height   =   v_checkbox.height   *   vdec_height 
v_checkbox.textsize   =   v_checkbox.textsize   *   vdec_width 
case   OLECustomControl! 
V_OLECustomControl   =   va_window.control[vl_object] 
V_OLECustomControl.x   =   V_OLECustomControl.y   *   vdec_width 
V_OLECustomControl.y   =   V_OLECustomControl.y   *   vdec_height 
V_OLECustomControl.width   =   V_OLECustomControl.width   *   vdec_width 
V_OLECustomControl.height   =   V_OLECustomControl.height   *   vdec_height 
case   CommandButton! 
v_commandButton   =   va_window.control[vl_object] 
v_commandButton.x   =   v_commandButton.x   *   vdec_width 
v_commandButton.y   =   v_commandButton.y   *   vdec_height 
v_commandButton.width   =   v_commandButton.width   *   vdec_width 
v_commandButton.height   =   v_commandButton.height   *   vdec_height 
v_commandButton.textsize   =   v_commandButton.textsize   *   vdec_width 
case   Oval! 
v_Oval   =   va_window.control[vl_object] 
v_Oval.x   =   v_Oval.x   *   vdec_width 
v_Oval.y   =   v_Oval.y   *   vdec_height 
v_Oval.width   =   v_Oval.width   *   vdec_width 
v_Oval.height   =   v_Oval.height   *   vdec_height 
case   DataWindow! 
v_datawindow   =   va_window.control[vl_object] 
v_datawindow.x   =   v_datawindow.x   *   vdec_width 
v_datawindow.y   =   v_datawindow.y   *   vdec_height 
v_datawindow.width   =   v_datawindow.width   *   vdec_width 
v_datawindow.height   =   v_datawindow.height   *   vdec_height 
case   Picture! 
v_picture   =   va_window.control[vl_object] 
v_picture.x   =   v_picture.x   *   vdec_width 
v_picture.y   =   v_picture.y   *   vdec_height 
v_picture.width   =   v_picture.width   *   vdec_width 
v_picture.height   =   v_picture.height   *   vdec_height 
case   DropDownListBox! 
v_DropDownListBox   =   va_window.control[vl_object] 
v_DropDownListBox.x   =   v_DropDownListBox.x   *   vdec_width 
v_DropDownListBox.y   =   v_DropDownListBox.y   *   vdec_height 
v_DropDownListBox.width   =   v_DropDownListBox.width   *   vdec_width 
v_DropDownListBox.height   =   v_DropDownListBox.height   *   vdec_height 
v_DropDownListBox.textsize   =   v_DropDownListBox.textsize   *   vdec_width 
case   PictureButton! 
v_PictureButton   =   va_window.control[vl_object] 
v_PictureButton.x   =   v_PictureButton.x   *   vdec_width 
v_PictureButton.y   =   v_PictureButton.y   *   vdec_height 
v_PictureButton.width   =   v_PictureButton.width   *   vdec_width 
v_PictureButton.height   =   v_PictureButton.height   *   vdec_height 
v_PictureButton.textsize   =   v_PictureButton.textsize   *   vdec_width 
case   DropDownPictureListBox! 
v_dropDownPictureListBox   =   va_window.control[vl_object] 
v_dropDownPictureListBox.x   =   v_dropDownPictureListBox.x   *   vdec_width 
v_dropDownPictureListBox.y   =   v_dropDownPictureListBox.y   *   vdec_height 
v_dropDownPictureListBox.width   =   v_dropDownPictureListBox.width   *   vdec_width 
v_dropDownPictureListBox.height   =   v_dropDownPictureListBox.height   *   vdec_height 
v_dropDownPictureListBox.textsize   =   v_dropDownPictureListBox.textsize   *   vdec_width 
case   PictureListBox! 
v_picTureListBox   =   va_window.control[vl_object] 
v_picTureListBox.x   =   v_picTureListBox.x   *   vdec_width 
v_picTureListBox.y   =   v_picTureListBox.y   *   vdec_height 
v_picTureListBox.width   =   v_picTureListBox.width   *   vdec_width 
v_picTureListBox.height   =   v_picTureListBox.height   *   vdec_height 
v_picTureListBox.textsize   =   v_picTureListBox.textsize   *   vdec_width 
case   EditMask! 
v_editmask   =   va_window.control[vl_object] 
v_editmask.x   =   v_editmask.x   *   vdec_width 
v_editmask.y   =   v_editmask.y   *   vdec_height 
v_editmask.width   =   v_editmask.width   *   vdec_width 
v_editmask.height   =   (v_editmask.height   *   vdec_height )/0.9
v_editmask.textsize   =   v_editmask.textsize   *   vdec_width 
case   RadioButton! 
v_radiobutton   =   va_window.control[vl_object] 
v_radiobutton.x   =   v_radiobutton.x   *   vdec_width 
v_radiobutton.y   =   v_radiobutton.y   *   vdec_height 
v_radiobutton.width   =   v_radiobutton.width   *   vdec_width 
v_radiobutton.height   =   v_radiobutton.height   *   vdec_height 
v_radiobutton.textsize   =   v_radiobutton.textsize   *   vdec_width 
case   Graph! 
v_graph   =   va_window.control[vl_object] 
v_graph.x   =   v_graph.x   *   vdec_width 
v_graph.y   =   v_graph.y   *   vdec_height 
v_graph.width   =   v_graph.width   *   vdec_width 
v_graph.height   =   v_graph.height*   vdec_height 
case   Rectangle! 
v_rectangle   =   va_window.control[vl_object] 
v_rectangle.x   =   v_rectangle.x   *   vdec_width 
v_rectangle.y   =   v_rectangle.y   *   vdec_height 
v_rectangle.width   =   v_rectangle.width   *   vdec_width 
v_rectangle.height   =   v_rectangle.height   *   vdec_height 
case   GroupBox! 
v_groupbox   =   va_window.control[vl_object] 
v_groupbox.x   =   v_groupbox.x   *   vdec_width 
v_groupbox.y   =   v_groupbox.y   *   vdec_height 
v_groupbox.width   =   v_groupbox.width   *   vdec_width 
v_groupbox.height   =   v_groupbox.height   *   vdec_height 
v_groupbox.textsize   =   v_groupbox.textsize   *   vdec_width 
case   RichTextEdit! 
v_richtextedit   =   va_window.control[vl_object] 
v_richtextedit.x   =   v_richtextedit.x   *   vdec_width 
v_richtextedit.y   =   v_richtextedit.y   *   vdec_height 
v_richtextedit.width   =   v_richtextedit.width   *   vdec_width 
v_richtextedit.height   =   v_richtextedit.height   *   vdec_height 
case   HScrollBar! 
v_HScrollBar   =   va_window.control[vl_object] 
v_HScrollBar.x   =   v_HScrollBar.x   *   vdec_width 
v_HScrollBar.y   =   v_HScrollBar.y   *   vdec_height 
v_HScrollBar.width   =   v_HScrollBar.width   *   vdec_width 
v_HScrollBar.height   =   v_HScrollBar.height   *   vdec_height 
case   RoundRectangle! 
v_RoundRectangle   =   va_window.control[vl_object] 
v_RoundRectangle.x   =   v_RoundRectangle.x   *   vdec_width 
v_RoundRectangle.y   =   v_RoundRectangle.y   *   vdec_height 
v_RoundRectangle.width   =   v_RoundRectangle.width   *   vdec_width 
v_RoundRectangle.height   =   v_RoundRectangle.height   *   vdec_height 
case   Line! 
v_line   =   va_window.control[vl_object] 
v_line.beginx   =   v_line.beginx   *   vdec_width 
v_line.beginy   =   v_line.beginy   *   vdec_height 
v_line.endx   =   v_line.endx   *   vdec_width 
v_line.endy   =   v_line.endy   *   vdec_height

case   SingleLineEdit! 
v_SingleLineEdit   =   va_window.control[vl_object] 
v_SingleLineEdit.x   =   v_SingleLineEdit.x   *   vdec_width 
v_SingleLineEdit.y   =   v_SingleLineEdit.y   *   vdec_height 
v_SingleLineEdit.width   =   v_SingleLineEdit.width   *   vdec_width 
v_SingleLineEdit.height   =   v_SingleLineEdit.height   *   vdec_height 
v_SingleLineEdit.textsize   =   v_SingleLineEdit.textsize   *   vdec_width 
case   ListBox! 
v_ListBox   =   va_window.control[vl_object] 
v_ListBox.x   =   v_ListBox.x   *   vdec_width 
v_ListBox.y   =   v_ListBox.y   *   vdec_height 
v_ListBox.width   =   v_ListBox.width   *   vdec_width 
v_ListBox.height   =   v_ListBox.height   *   vdec_height 
v_ListBox.textsize   =   v_ListBox.textsize   *   vdec_width 
case   StaticText! 
v_statictext   =   va_window.control[vl_object] 
v_statictext.x   =v_statictext.x   *   vdec_width 
v_statictext.y   =   v_statictext.y   *   vdec_height 
v_statictext.width   =   v_statictext.width   *   vdec_width 
v_statictext.height   =  ( v_statictext.height   *   vdec_height )/0.8
v_statictext.textsize   =   v_statictext.textsize   *   vdec_width 
case   ListView! 
v_listView   =   va_window.control[vl_object] 
v_listView.x   =   v_listView.x   *   vdec_width 
v_listView.y   =   v_listView.y   *   vdec_height 
v_listView.width   =   v_listView.width   *   vdec_width 
v_listView.height   =   v_listView.height   *   vdec_height 
v_listView.textsize   =   v_listView.textsize   *   vdec_width

case   MultiLineEdit! 
v_MultiLineEdit   =   va_window.control[vl_object] 
v_MultiLineEdit.x   =   v_MultiLineEdit.x   *   vdec_width 
v_MultiLineEdit.y   =   v_MultiLineEdit.y   *   vdec_height 
v_MultiLineEdit.width   =   v_MultiLineEdit.width   *   vdec_width 
v_MultiLineEdit.height   =   v_MultiLineEdit.height   *   vdec_height 
v_MultiLineEdit.textsize   =   v_MultiLineEdit.textsize   *   vdec_width 
case   TreeView! 
v_TreeView   =   va_window.control[vl_object] 
v_TreeView.x   =   v_TreeView.x   *   vdec_width 
v_TreeView.y   =   v_TreeView.y   *   vdec_height 
v_TreeView.width   =   v_TreeView.width   *   vdec_width 
v_TreeView.height   =   v_TreeView.height   *   vdec_height 
v_TreeView.textsize   =   v_TreeView.textsize   *   vdec_width 
case   OLEControl! 
v_OLEControl   =   va_window.control[vl_object] 
v_OLEControl.x   =   v_OLEControl.x   *   vdec_width 
v_OLEControl.y   =   v_OLEControl.y   *   vdec_height 
v_OLEControl.width   =   v_OLEControl.width   *   vdec_width 
v_OLEControl.height   =   v_OLEControl.height   *   vdec_height 
case   VScrollBar!   
v_VSCrollBar   =   va_window.control[vl_object] 
v_VSCrollBar.x   =   v_VSCrollBar.x   *   vdec_width 
v_VSCrollBar.y   =   v_VSCrollBar.y   *   vdec_height 
v_VSCrollBar.width   =   v_VSCrollBar.width   *   vdec_width 
v_VSCrollBar.height   =   v_VSCrollBar.height   *   vdec_height 
case   menu!

end   choose

next 
//窗口居中 
long   ll_ScreenH,ll_ScreenW 
ll_ScreenH   =   PixelsToUnits(ve_hjbl.ScreenHeight,   YPixelsToUnits!) 
ll_ScreenW   =   PixelsToUnits(ve_hjbl.ScreenWidth   ,   XPixelsToUnits!)

va_window.Y   =   (ll_ScreenH   -   va_window.Height)   /   2 
va_window.X   =   (ll_ScreenW   -   va_window.Width   )   /   2

PB窗口根据分辨率的大小调整窗口大小的更多相关文章

  1. C# 强行锁定 第三方 外部 应用程序窗体窗口的分辨率尺寸大小 禁止鼠标拖拽改变窗口大小

    我们也许会有一些奇怪的需求,比如说禁止一个外部程序的窗口大小更改. 如果我们没法修改外部程序的代码,那要怎么做呢? 当然,我们可以通过DLL注入目标程序的方式去Hook或registry一个事件来检测 ...

  2. 【】opencv窗口创建、大小调整等问题

    opencv窗口创建.大小调整等问题 图像最开始大小可能为1280*720或者其他大小的: 使用cv::resizeWindow函数之后,不同的参数感觉窗口大小没有多少改变,看不出来: 使用cv::s ...

  3. 用 Javascript 获取页面大小、窗口大小和滚动条位置

    页面大小.窗口大小和滚动条位置这三个数值在不同的浏览器例如 Firefox 和 IE 中有着不同的实现.即使在同一种浏览器例如 IE 中,不同版本也有不同的实现. 本文给出两个能兼容目前所有浏览器的 ...

  4. Android窗口管理服务WindowManagerService计算Activity窗口大小的过程分析

    来自http://blog.csdn.net/luoshengyang/article/details/8479101 在Android系统中,Activity窗口的大小是由WindowManager ...

  5. PyQt:无边框自定义标题栏及最大化最小化窗体大小调整

    环境 Python3.5.2 PyQt5 陈述 隐藏掉系统的控制栏,实现了自定义的标题控制栏,以及关闭/最大化/最小化的功能,自由调整窗体大小的功能(跟随一个大佬学的),代码内有详细注释 只要把Mai ...

  6. Mac如何让调整窗口大小更简单

    在使用Mac的时候,你能把鼠标的光标悬停在任何程序的边缘,当光标自动变成箭头样式后,按住鼠标左键你将能随意拖动来改变程序窗口的大小.但是,这里有个问题,我们有时候很难控制把鼠标光标移动在正确的窗口边缘 ...

  7. OS X 使用技巧——轻松地调整窗口大小

    如果你想调整窗口大小,只需要把鼠标指针悬停在窗口边框上.当它变成双向箭头时,点击并拖动鼠标即可完成这一操作. 但在实际操作中,迅速把鼠标指针定位到边框上比较困难. 解决的办法是:在终端输入以下命令: ...

  8. xib view frame 大小调整

    1.IOS - xib(Interface Builder,view) - can't change view size(view不能改变大小问题) 很多时候,我们自定义tableview.colle ...

  9. VC获取屏幕分辨率及大小相关(转)

    vc得到屏幕的当前分辨率方法: 1.Windows API调用 int width = GetSystemMetrics ( SM_CXSCREEN );  int height= GetSystem ...

随机推荐

  1. BeanUtils接口和类

      Jakarta Commons项目提供了相当丰富的API,我们之前了解到的Commons Lang只是众多API的比较核心的一小部分而已.Commons下面还有相当数量的子项目,用于解决各种各样不 ...

  2. 关于163发邮件报错535 Error:authentication failed解决方法

    关于发邮件报错535 Error:authentication failed解决方法 调用163邮箱服务器来发送邮件,我们需要开启POP3/SMTP服务,这时163邮件会让我们设置客户端授权码,这个授 ...

  3. a.vim 插件

    引用自  https://blog.csdn.net/zhangsming/article/details/42652695 vim插件之快速切换头(.h)/源(.c,.cpp,.cc)文件——a.v ...

  4. Django之如何预防csrf功能的方式 form提交与ajax提交

    1. 什么是csrf认证: 主要是防止别人恶意登录你的账户信息用的: 2. csrf认证在django的实现方式: 分为两种, 一种是from表单提交的方式,另一种是ajax提交实现方式 前端: &l ...

  5. linux下启动tomcat服务

     Linux下tomcat服务的启动.关闭与错误跟踪,使用PuTTy远程连接到服务器以后,通常通过以下几种方式启动关闭tomcat服务:切换到tomcat主目录下的bin目录(cd usr/local ...

  6. 网站加入QQ在线客服

    <!-- qq客服 --> <div class="QQFloat" > <div class="qq"> <div ...

  7. javascript正则表达式中 (?=exp)、(?<=exp)、(?!exp)

     (?=exp) 百度百科给的解释:非获取匹配,正向肯定预查,在任何匹配pattern的字符串开始处匹配查找字符串,该匹配不需要获取供以后使用.例如,“Windows(?=95|98|NT|2000) ...

  8. MFC笔记8

    1.在循环使用数组时需要清理数组 CString str; memset(str,0,strlen(str)); 判断两个字符串包含数字大小是否相等 CString str="22" ...

  9. 微信小程序页面跳转 的几种方式

    最近在做微信小程序,碰到页面跳转的问题,总结一下页面之间跳转的方式 一.wx.navigateTo(OBJECT) 这是最普遍的一种跳转方式,其官方解释为:“保留当前页面,跳转到应用内的某个页面” 类 ...

  10. Java虚拟机 内存区域划分

    (图片来自https://www.cnblogs.com/whgk/p/6138522.html) 先从线程私有区开始介绍 虚拟机栈 Java虚拟机栈是由一个个栈帧组成的,当一个方法被调用时,代表这个 ...