Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 如何使用像素布局GUI_Visual Studio_User Interface_Editor_Labwindows - Fatal编程技术网

Visual studio 如何使用像素布局GUI

Visual studio 如何使用像素布局GUI,visual-studio,user-interface,editor,labwindows,Visual Studio,User Interface,Editor,Labwindows,我不确定当以像素为单位进行测量时,如何布局GUI,例如按钮、编辑框、文本等 正如微软的GUI指南一样,所有细节都是以像素的距离给出的。在使用除Microsoft编辑器外的其他编辑器时,如何将其转换为实际距离 感谢对话框窗口的尺寸、对话框窗口中所有元素的尺寸及其位置是以对话框单位(DLU)而不是像素定义的,请参见 因此,对话框的像素大小不是固定的。大小取决于为对话框设置的字体。在*.rc文件中,您可以看到一个对话框的字体,该对话框位于带有关键字BEGIN的行上方 另见和 因此,如果您没有使用资源编

我不确定当以像素为单位进行测量时,如何布局GUI,例如按钮、编辑框、文本等

正如微软的GUI指南一样,所有细节都是以像素的距离给出的。在使用除Microsoft编辑器外的其他编辑器时,如何将其转换为实际距离


感谢

对话框窗口的尺寸、对话框窗口中所有元素的尺寸及其位置是以对话框单位(DLU)而不是像素定义的,请参见

因此,对话框的像素大小不是固定的。大小取决于为对话框设置的字体。在*.rc文件中,您可以看到一个对话框的字体,该对话框位于带有关键字BEGIN的行上方

另见和

因此,如果您没有使用资源编辑器,而是使用文本编辑器直接在*.rc文件中编辑对话框资源,那么您肯定会遇到问题。我只能建议不要这样做。

对于LabWindows/CVI:

编辑以更正函数名称:

在LabWindows/CVI开发环境中,您可以使用一系列函数(也可以通过函数面板访问),这些函数提供面板和控件(如位置/大小/颜色等)的状态和控制,称为用户界面库。函数,如
getCtrlatAttribute()
setCtrlatAttribute()
GetPanelAttribute()
,和
SetPanelAttribute()
。其中每一个都使用预定义参数的枚举列表来访问要控制的许多属性中的哪一个

例如,要设置面板在显示器上显示时的大小和位置,可以使用以下方法:

SetPanelAttribute(panelHandle, ATTR_HEIGHT, height);//where height is in pixels, 0 to 32767  

SetPanelAttribute(panelHandle, ATTR_WIDTH, width);//where width is in pixels, 0 to 32767  

SetPanelAttribute(panelHandle, ATTR_TOP, top);//in pixels, 0 to 32767
//The vertical offset (in pixels) of the panel   
//relative to the origin of the screen   
//(for top-level windows) or the parent panel (for child panels).
//The screen origin is the upper-left corner of the screen.  
//The origin of a parent panel is the upper-left corner of   
//the panel below the title bar and to the right of the panel frame.  

SetPanelAttribute(panelHandle, ATTR_LEFT, left);//in pixels, 0 to 32767
//The horizontal offset (in pixels) of the panel relative to 
//the origin of the screen (for top-level windows) or the 
//parent panel (for child panels).
//The screen origin (0,0) is the upper-left corner of the screen.
//The origin of a parent panel is the upper-left corner of the 
//panel below the title bar and to the right of the panel frame.  
可以使用这四个函数设置或检索更多属性(属性),例如背景色、面板/控件是否处于活动状态、是否变灰、帧颜色等


如前所述,同一系列控件中有一组类似的函数为所有控件属性提供控件。

这完全取决于什么类型的GUI。什么?没道理。你想用什么编辑器?答案的质量取决于这一点,因为每个答案的技巧都不同。例如,LabWindows/CVI具有专门用于控制和缩放用户界面对象的广泛库。