图形控件与图形方法
- 格式:ppt
- 大小:1.14 MB
- 文档页数:46
巧用图形控件提升WPS表格交互性的技巧大家都知道,WPS表格作为常用的办公软件之一,在处理数据和制作表格方面有着强大的功能和灵活的操作性。
但是,有时候我们可能会觉得传统的表格形式显得有些呆板,缺乏一些新颖的交互方式。
那么,有没有什么方法可以巧妙运用图形控件,让WPS表格更加具有趣味性和交互性呢?下面就让我们一起来探讨一些技巧吧。
1.添加按钮控件在WPS表格中,我们可以通过添加按钮控件来实现一些简单的交互功能。
比如,我们可以添加一个按钮,然后通过设置按钮的点击事件,让其执行某些操作,比如筛选数据、跳转到指定单元格等。
这样一来,不仅可以提升表格的交互性,还可以让操作更加便捷。
2.制作进度条如果我们需要在表格中展示某个任务的进度,那么可以通过图形控件制作一个进度条来直观展示。
只需简单设置其数值,结合条件格式,就可以实现进度的动态显示。
这种方式不仅美化了表格的展示,还让数据更加生动有趣。
3.切换按钮控件另一个提升WPS表格交互性的技巧是利用切换按钮控件。
通过设置不同状态下的显示内容,可以实现在不同选项之间进行切换,比如显示不同图表、展示不同数据等。
这种方法非常适合在需要比对不同信息时使用,同时也增加了表格的可操作性。
4.制作动态图表除了静态的图形控件,WPS表格还支持插入动态图表。
利用这一功能,我们可以创建一些带有动画效果的图表,比如实时更新的数据图表、交互式地图等。
这不仅提升了表格的吸引力,还让数据的呈现更加生动突出。
5.设计交互式表格要想让WPS表格真正具有高级的交互性,可以尝试设计一些交互式表格。
通过设置条件格式、数据验证等功能,让表格可以自动响应用户的操作,比如输入特定数值后自动计算结果、显示相应的提示信息等。
这些小技巧可以让表格变得更加智能和便捷。
巧用图形控件确实可以有效地提升WPS表格的交互性,让数据处理不再枯燥乏味,而是充满趣味和实用性。
希望以上技巧能够帮助大家在日常办公中更好地利用WPS表格,提升工作效率。
VB中PictureBox控件使用教程PictureBox对象可以说是任何对象的原始型态,它可以加载图片、显示文字、画图外,它还能与Frame对象一样,在自己本身里头加载其它的对象而自成一个小群组,用PictureBox 可以仿真出任何对象的外观,PictureBox是VB基本控件里变化最多,功能最多,也是令人最想去征服它的一个物件。
●PictureBox与Frame对象一样,本身都能装载其它的对象而自己形成一个对象群组。
●如果要拿PictureBox装载对象时,可以把它视为Frame来使用。
●与Image对象一样在设计阶段时,以Picture属性来加载图片。
●与Image对象一样都是在属性对话窗口按一下〝...〞钮后,跳出〝加载图片〞对话框,选择所要的图档,然后加载。
●在执行阶段,可以用VB的函数来帮PictureBox加载图片:Command1_Click()= LoadPicture("E:\MyGif\")End Sub●在设计阶段,若后悔加载图片,想把它消除时,可以把PictureBox按Delete键删掉,然后从工具箱拖曳一个新的PictureBox,或是在属性对话框里的Picture属性,把〝(位图)〞这几个反白,或是移到〝(〞的最前端,按一下键盘的Delete键即可移除图片。
●若在执行阶段,想把PictureBox内的图片移除,可再用LoadPicture函数,并且传空字符串给它:Private Sub Command1_Click()= LoadPicture("")End Sub--------------------------------------------------------------------------------●在PictureBox里画图:●PSet方法:PSet不只是用在PictureBox上,也可以用在窗体上,PSet最主要功用用就是在某一点位置上画一个点,用法是(X,Y), Color:Private Sub Command1_Click() (500,260),RGB(128,0,255)'RGB函数是以红色、绿色、蓝色来表示颜色,详情请到函数指令参考End Sub●若颜色省略,则以PictureBox预设的颜色。
pythonGUI库图形界⾯开发之PyQt5树形结构控件QTreeWidget详细使⽤⽅法与实例PyQt5树形结构控件QTreeWidget简介QTreeWidget 类根据预设的模型提供树形显⽰控件。
QTreeWidget 使⽤类似于 QListView 类的⽅式提供⼀种典型的基于 item 的树形交互⽅法类,该类基于QT的“模型/视图”结构,提供了默认的模型来⽀撑 item 的显⽰,这些 item 类为 QTreeWidgetItem 类。
如果不需要灵活的“模型/视图”框架,可以使⽤QTreeWidget 来创建有层级关系的树形结构。
当把标准 item 模型结合QTreeView 使⽤时,可以得到更灵活的使⽤⽅法,从⽽把“数据”和“显⽰”分离开。
QTreeWidget类中的常⽤⽅法⽅法描述setColumnWidth(int column,int width)将指定列的宽度设置为给定的值Column:指定的列width:指定的宽度insertTopLevelItems()在视图的顶层索引中引⼊项⽬的列表expandAll()展开所有节点的树形节点invisibleRootItem()返回树形控件中不可见的根选项(Root Item)selectionItems()返回所有选定的⾮隐藏项⽬的列表内QTreeWidgetItem类中常⽤的⽅法⽅法描述addChild()将⼦项追加到⼦列表中setText()设置显⽰的节点⽂本Text()返回显⽰的节点⽂本setCheckState(column.state)设置指定列的选中状态:Qt.Checked:节点选中Qt.Unchecked:节点没有选中setIcon(column,icon)在指定的列中显⽰图标QTreeWidget树形结构控件的实例树形结构是通过QTreeWidget和QTreeWidgetItem类实现的,其中QTreeWidgetItem类实现了节点的添加,其完整代码如下import sysfrom PyQt5.QtWidgets import *from PyQt5.QtGui import QIcon, QBrush, QColorfrom PyQt5.QtCore import Qtclass TreeWidgetDemo(QMainWindow):def __init__(self, parent=None):super(TreeWidgetDemo, self).__init__(parent)self.setWindowTitle('TreeWidget 例⼦')self.tree=QTreeWidget()#设置列数self.tree.setColumnCount(2)#设置树形控件头部的标题self.tree.setHeaderLabels(['Key','Value'])#设置根节点root=QTreeWidgetItem(self.tree)root.setText(0,'Root')root.setIcon(0,QIcon('./images/root.png'))# todo 优化2 设置根节点的背景颜⾊brush_red=QBrush(Qt.red)root.setBackground(0,brush_red)brush_blue=QBrush(Qt.blue)root.setBackground(1,brush_blue)#设置树形控件的列的宽度self.tree.setColumnWidth(0,150)#设置⼦节点1child1=QTreeWidgetItem()child1.setText(0,'child1')child1.setText(1,'ios')child1.setIcon(0,QIcon('./images/IOS.png'))#todo 优化1 设置节点的状态child1.setCheckState(0,Qt.Checked)root.addChild(child1)#设置⼦节点2child2=QTreeWidgetItem(root)child2.setText(0,'child2')child2.setText(1,'')child2.setIcon(0,QIcon('./images/android.png'))#设置⼦节点3child3=QTreeWidgetItem(child2)child3.setText(0,'child3')child3.setText(1,'android')child3.setIcon(0,QIcon('./images/music.png'))#加载根节点的所有属性与⼦控件self.tree.addTopLevelItem(root)#TODO 优化3 给节点添加响应事件self.tree.clicked.connect(self.onClicked)#节点全部展开self.tree.expandAll()self.setCentralWidget(self.tree)def onClicked(self,qmodeLindex):item=self.tree.currentItem()print('Key=%s,value=%s'%(item.text(0),item.text(1))) if __name__ == '__main__':app = QApplication(sys.argv)tree = TreeWidgetDemo()tree.show()sys.exit(app.exec_())初始运⾏图如下优化⼀:设置节点的状态这⾥添加了child1的选中状态child1.setCheckState(0,Qt.Checked)优化⼆:设置节点的背景颜⾊这⾥设置了根节点的背景颜⾊brush_red=QBrush(Qt.red)root.setBackground(0,brush_red)brush_blue=QBrush(Qt.blue)root.setBackground(1,brush_blue)优化三:给节点添加响应事件点击,会在控制台输出当前地key值与value值self.tree.clicked.connect(self.onClicked)def onClicked(self,qmodeLindex):item=self.tree.currentItem()print('Key=%s,value=%s'%(item.text(0),item.text(1)))系统定制模式实例在上⾯的例⼦中,QTreeWidgetItem类的节点是⼀个个添加上去的,这样有时很不⽅便,特别是窗⼝产⽣⽐较复杂的树形结构时,⼀般都是通过QTreeView类来实现的,⽽不是QTreeWidget类,QTreeView和QTreeWidget类最⼤的区别就是,QTreeView类可以使⽤操作系统提供的定制模式,⽐如⽂件系统盘的树列表import sysfrom PyQt5.QtWidgets import *from PyQt5.QtGui import *if __name__ == '__main__':app=QApplication(sys.argv)#window系统提供的模式model=QDirModel()#创建⼀个QTreeView的控件tree=QTreeView()#为控件添加模式tree.setModel(model)tree.setWindowTitle('QTreeView例⼦')tree.resize(640,480)tree.show()sys.exit(app.exec_())本⽂主要讲解了PyQt5树形结构控件QTreeWidget详细使⽤⽅法与实例,更多关于PyQt5控件使⽤知识请查看下⾯的相关链接。
Qt图形图像开发之QT滚动区控件(滚动条)QScrollArea的详细⽅法⽤法图解与实例QT滚动区控件(滚动条控件)QScrollArea简介滚动区域控件QScrollArea⽤于显⽰⼀个画⾯中的⼦部件的内容。
如果部件超过画⾯的⼤⼩,视图可以提供滚动条,这样就可以看到部件的整个区域。
QScrollArea属于控件容器类,可以直接在ui中拖出来。
对于QScrollArea,最难搞懂的就是:如何控制它,才能让它在我们想要出现滚动条的时候出现滚动条。
我们拖⼊⼀个QScrollArea,再向他⾥⾯拖⼊4个button,观察信息如下:可以发现,4个button并不是直接位于QScrollArea中的,⽽是位于它的成员scorllAreaWidgetContents中的,这个成员的类型也是控件类型QWidget,也就是说,QScrollArea这个容器本⾝就套了两层,我们放⼊的按钮等控件,都处在scrllAreaWidgetContents层,下⽂中我把QScrollArea.widget统⼀称之为“内部容器”或者"内容层",内部容器是QScrollArea这个控件的⼦控件。
"内容层"相当于⼀块很⼤的幕布,按钮、label等控件都被绘制在了幕布上,⽽QScrollArea相当于⼀个⼩窗⼝,透过这个⼩窗⼝我们看⼀看到幕布上的⼀⼩部分内容,拖动滚动条相当于在窗⼝后⾯移动幕布,这样我们就能透过窗⼝看到幕布上不同位置的内容。
这个幕布本质上就是⼀个QWidget,如果QScrollArea是从UI设计师界⾯拖出来的,那么QT会⾃动为我们创建这个幕布,如果你是⽤代码new出来的QScrollArea,那么不要忘记同时new⼀个幕布widget,并通过QScrollArea::setWidget(QWidget *)把幕布和QScrollArea关联起来。
这⾥有⼀个坑,如果你写了⼀个功能更强的QScrollArea的⼦类,假设叫QScrollAreaEx(⾥⾯⾃带幕布,幕布中⾃带⼀些按钮什么的),在ui设计师界⾯把QScrollArea提升为QScrollAreaEx的时候,你会发现,按钮并没有显⽰出来,why?因为QT ⾃动⽣成的ui代码中,new了⼀个幕布控件,并把这个空的幕布赋给了QScrollAreaEx对象,这真是太坑了。
python图形开发GUI库pyqt5的详细使用方法及各控件的属性与方法PyQt5是一个流行的Python图形用户界面(GUI)开发库,它基于Qt框架开发。
PyQt5提供了丰富的控件和工具,用于创建各种GUI应用程序。
本文将介绍PyQt5的使用方法,包括创建窗口、添加控件、设置属性和绑定事件等。
首先需要确保已经安装了PyQt5库。
可以使用以下命令在命令行中安装PyQt5:```pip install pyqt5```接下来,可以开始使用PyQt5来创建GUI应用程序。
以下是PyQt5的基本模板:```pythonimport sysfrom PyQt5.QtWidgets import QApplication, QWidgetif __name__ == '__main__':app = QApplication(sys.argv)#创建窗口window = QWidgetwindow.setGeometry(100, 100, 300, 200) # 设置窗口位置和大小window.setWindowTitle('PyQt5 Window')#添加控件window.showsys.exit(app.exec_()```上述代码首先导入了必要的模块,然后创建了一个应用程序对象`QApplication`和一个窗口对象`QWidget`。
`setGeometry(`方法用于设置窗口的位置和大小,`setWindowTitle(`方法设置窗口的标题。
然后,调用`show(`方法显示窗口。
最后,`app.exec_(`用于启动应用程序事件循环。
```pythonfrom PyQt5.QtWidgets import QPushButton, QLabel, QLineEdit #添加按钮button = QPushButton('Click me!', window)button.setGeometry(50, 50, 100, 30) # 设置按钮位置和大小label = QLabel('Label', window)#添加文本框line_edit = QLineEdit(window)line_edit.setGeometry(50, 150, 200, 30) # 设置文本框位置和大小```对于每个控件,都有一些常用的属性和方法。
AnyCAD.Net Graphics ComponentUser Manual(R2014UR1)2014.5Contents1.Overview (4)1.1.Capabilities (4)1.1.1.Modeling (4)1.1.2.Data exchange (4)1.1.3.Visualization (5)2.Get Start (6)2.1.Add assembly DLLs (6)2.2.Add the visualization control (6)3.Modeling (7)3.1.Modeling (7)3.2.Visualization geometry (7)3.3.Explore the TopoShape (8)3.4.Get Common Geometry Property (8)3.5.Curve information (8)3.6.Surface information (8)3.7.Face triangulation (9)4.Visualization (11)4.1.View settings (11)4.1.1.Background color (11)4.1.2.Show/Hide drawing grid (11)4.1.3.Set the camera view (11)4.1.4.Set Display Mode (12)4.1.5.Set Pick Mode (12)4.2.Scene Management (13)4.2.1.Visualize TopoShape Geometry (13)4.2.2.Create Group Node (13)4.2.3.Set Node Style (13)4.2.4.Query selected geometry (14)4.3.Point Conversion (14)4.3.1.World point to screen point (3D->2D) (14)4.3.2.Screen point to world point (2D – 3D) (14)5.Data Exchange (16)6.Reference (17)1.OverviewAnyCAD .Net Graphics Component is the professional graphics SDK for .Net developers, which can help you create 3D applications rapidly. This rapid graphics framework is focusing on 3d modeling, visualization and data exchange.Our goal is to help our customers to make great 3D applications. If you have any issues, please contact us:support@1.1.Capabilities1.1.1.ModelingFeatures of 3d modeling:Primitive geometry modeling for point, line, polyline, spline, arc, circle, sphere, box, cylinder, cone, surface from points etc…Compound: wire, shell, solid, compound.Modeling methods for extrude, sweep, loft, revole, chamfer, fillet, projection, rotate, move, scale, etc…Boolean operation for union, cut, common.1.1.2.Data exchangeThe standard AnyCAD .Net Graphics Component supports the following STEP,IGES,STL,DXF formats.STEPSupport import and export. You can get the “tree”structure of STEP file with shapenames.IGESSupport import and export.STLSupport import and export. You can control the triangulation precision when exporting.DXF (beta)Support import DXF.1.1.3.VisualizationAnyCAD .Net Graphics Component contains the visualization control for WinForm and WPF, which can help you to add the 3D control to you Form easily.Features of visualization:Default Camera operationZ oom in/out, fit window, rotation, pan… and no coding required.Selection managementPick by mouse.Add to object to selection/Clear selection set.Query selected node and geometry, including sub Face/Edge/Vertex.Set selection filter for node, group, face, edge, vertex…Scene node managementAdd, delete, find by id.Create node group.Render StyleCustomize the face, edge, vertex styles, including color, line width, point size, and facematerials.Display modeWireframe, shading, shading with edge…Gradient background color settingsPrint current view to PDFExport current view to images, such as jpg/png.2.Get Start2.1.Add assembly DLLsYou need the following two assembly dlls to your project: .dll.dll2.2.Add the visualization control Please reference the sample code of AnyCAD.Basic project.Now, you can run your application and enjoy the 3D world.3.Modeling3.1.ModelingThe modeling APIs is implemented by class BrepTools which returns the TopoShape Object. Please reference the AnyCAD .Net online documentation for more modeling APIs.You can access the global BrepTools instance by GlobalInstance.BrepTools.3.2.Visualization geometry3.3.Explore the TopoShapeTopoExplor is used to explore the sub shapes of a TopoShape, such as vertex, edge, face, shell, solid.3.4.Get Common Geometry PropertyTopoShapeProperty is used to get the geometry information:Edge lengthSurface AreaSolid VolumeCenter of the shape mass3.5.Curve informationGeomeCurve is used to get the curve parameters, and use the parameter to get the point and derivative data.3.6.Surface informationGeomeSurface is used to get the face uv parameters, and use the parameters to get the point, normal and derivative data.3.7.Face triangulationYou can triangulate the Face to meshes via FaceTriangulation API, and visualization the mesh,4.Visualization4.1.View settingsThere are many settings can help you to make your 3D application looks different.The related APIs are RenderWindow3d and View3d, you can access the View3d instance via the property of RenderWindow3d::View3d.4.1.1.Background color4.1.2.Show/Hide drawing grid4.1.3.Set the camera view4.1.4.Set Display Mode4.1.5.Set Pick ModeYou can set to pick the whole object, then you need to set RF_SceneNode|RF_Edge:RF_Face; You can also set to pick the a group of objects (GroupSceneNode), you need to set RF_ GroupSceneNode |RF_Edge:RF_Face.4.2.Scene Management4.2.1.Visualize TopoShape Geometry4.2.2.Create Group NodeYou can create a group of node to set the visible/style/selection…4.2.3.Set Node StyleYou canset the face style, line style and vertex style for a SceneNode/GroupSceneNode,Set an Id/name4.2.4.Query selected geometryAfter pressing the mouse button, you can use QuerySelectedElementContext to check selectedYou can use the node id to find other data in your database.4.3.Point Conversion4.3.1.World point to screen point (3D->2D)Using View3d::WorldPoint2ScreenPoint you can convert the 3D world point to screen 2D point4.3.2.Screen point to world point (2D – 3D)You can’t convert screen 2d point to 3d world point directly, but the SDK provides you function toThe RenderWindow3d control provides the function to compute the 3D point on the working5.Data ExchangeWe provide two samples for the data exchange model, you get the source code by the links: StpViewerdxfViewer6.Reference●Official web site: ●Online API document: /help/AGP2014/●WinForm and WPF Sample codes: https:///anycad/anycadnetsdkpro。
VB常用控件的属性及功能(转帖)控件目录:Form(窗体)、PictureBox(图片框)、Label(标签)、TextBox(文本框)、Frame(框架)、CommandButton (命令按钮)、OptionButton(选项按钮)、ListBox(列表框)、Hscrollbar(水平滚动条)Vscrollbar(垂直滚动条)、Timer(时钟)、Shape(形状)、Line(直线)、Image(图片框)、OLE Container(OLE容器)Form(窗体) 的常用属性及功能1. name (窗体名称):为窗体指定一个名字。
2. Appearance:设置一个窗体是否运行时以3D效果显示。
0—Flat:窗体以平面的形式显示,1—3D:窗体以3D的形式显示(默认值)。
3. AutoRedraw:控制窗体的重画。
True:若其他窗口覆盖当前窗体再返回该再返回该窗体时,VB将重画该窗体内的所有图形False:VB必须调用一个事件过程才能完成重画。
4. BackColor:设置对象中文本和图形的背景色。
5. ForeColor:设置对象中文本和图形的前景色。
6. BorderStyle:为窗体等对象设置边框的式样。
0—None:窗体无边框1—FixedSingle:程序运行后窗体大小不被改变,单线边框2—Sizable:程序运行后窗体大小可以被改变,双线边框3—FixedDouble:程序运行后窗体大小不被改变,双线边框4—FixedToolWindo:程序运行后窗体大小可以被改变,单线边框5—SizableToolWindow:程序运行后窗体大小可以被改变。
7. Caption:设置窗体标题栏显示的文本。
8. Clipcontrols:设置Paint事件的绘图方法—是重画整个对象还是重画新显示的区域。
True:重画整个对象False:重画新显示的区域。
9. ControlBox:运行程序时该属性有效。
pythonGUI库图形界⾯开发之PyQt5切换按钮控件QPushButton详细使⽤⽅法与实例PyQt5切换按钮控件QPushButton简介QAbstractButton类为抽象类,不能实例化,必须由其他的按钮类继承QAbstractButton类,来实现不同的功能和表现形式,常见的按钮QPushButton,QToolButton,QRadioButton和QCheckBox这些按钮均继承⾃QAbstractButton类,根据各⾃的使⽤场景通过图形显⽰出来QAbstractButton提供的状态如下表状态含义isDown()提⽰按钮是否已按下isChecked()提⽰按钮是否已经标记isEnable()提⽰按钮是否可以被⽤户点击isCheckAble()提⽰按钮是否为可标记的setAutoRepeat()设置按钮是否在⽤户长按时可以⾃动重复执⾏QAbstractButton提供的信号如下表信号含义Pressed当⿏标指针在按钮上并按下左键时触发该信号Released当⿏标左键被释放时触发该信号Clicked当⿏标左键被按下然后释放时,或者快捷键被释放时触发该信号Toggled当按钮的标记状态发⽣改变时触发该信号QPUshButton类中的常⽤⽅法⽅法描述setCheckable()设置按钮是否已经被选中,如果设置True,则表⽰按钮将保持已点击和释放状态toggle()在按钮状态之间进⾏切换setIcon()设置按钮上的图标setEnabled()设置按钮是否可以使⽤,当设置为False时,按钮变成不可⽤状态,点击它不会发射信号isChecked()返回按钮的状态,返回值为True或者FalsesetDefault()设置按钮的默认状态setText()设置按钮的显⽰⽂本text()返回按钮的显⽰⽂本为QPushButton设置快捷键通过按钮名字能为QPushButton设置快捷键,⽐如名字为‘&Download'的按键,它的快捷键是‘Alt+D'。