VB如何用CreateWindowEx 创建无标题栏无边框窗体?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VB如何用CreateWindowEx 创建无标题栏无边框窗体?相关的知识,希望对你有一定的参考价值。
仅建立窗体,无需移动、最大化、最小化...
请赐予完整代码,我找了好多,总是运行不正确,谢谢!
0 WS_BORDER &H800000 带有一线条边框
1 WS_CAPTION &HC00000 窗口有标题栏
2 WS_CHILD &H40000000 窗口为子窗口
3 WS_SYSMENU &H80000 带有系统菜单,必须有WS_CAPTION
4 WS_CLIPCHILDREN &H2000000
5 WS_CLIPSIBLINGS &H4000000
6 WS_DLGFRAME &H400000 类似对话框的边框,无标题栏
7 WS_GROUP &H20000
8 WS_MAXIMIZEBOX &H10000 最大化
9 WS_MINIMIZEBOX &H20000 最小化
10 WS_OVERLAPPED 0
'Creates an overlapped window. An overlapped window has a title bar and a border.
Same as the WS_TILED style.
11 WS_OVERLAPPEDWINDOW &HCF0000
'Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU,
WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the
WS_TILEDWINDOW style
12 WS_POPUP &H80000000 'Creates a pop-up window. This style cannot be used with the WS_CHILD style.
13 WS_POPUPWINDOW &H80880000
'Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The
WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu
visible.
14 WS_THICKFRAME &H40000 可调整大小的边框
15 WS_DISABLED &H8000000
代码参考1楼
先CreateWindow,接着 i = GetWindowLong(lHandle, GWL_STYLE)返回窗口样式 i 。
将当前样式 i 修改为你想要的样式
添加新样式 i = i Or newWS
删除某样式 i = i And Not (WS)
如 SetWindowLong Handle, GWL_STYLE, i And Not (WS_OVERLAPPEDWINDOW Or WS_POPUPWINDOW Or WS_THICKFRAME)
最后SetWindowLong(lHandle, GWL_STYLE, i)应用新的样式。
最后要显示或刷新窗口
ShowWindow handle, SW_SHOW
UpdateWindow handle本回答被提问者采纳 参考技术B Const WS_EX_STATICEDGE = &H20000
Const WS_EX_TRANSPARENT = &H20&
Const WS_CHILD = &H40000000
Const CW_USEDEFAULT = &H80000000
Const SW_NORMAL = 1
Private Type CREATESTRUCT
lpCreateParams As Long
hInstance As Long
hMenu As Long
hWndParent As Long
cy As Long
cx As Long
y As Long
x As Long
style As Long
lpszName As String
lpszClass As String
ExStyle As Long
End Type
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
Dim mWnd As Long
Private Sub Form_Load()
Dim CS As CREATESTRUCT
mWnd = CreateWindowEx(WS_EX_STATICEDGE Or WS_EX_TRANSPARENT, "STATIC", "Hello World !", WS_CHILD, 0, 0, 300, 50, Me.hwnd, 0, App.hInstance, CS)
Me.Caption = mWnd
ShowWindow mWnd, SW_NORMAL
End Sub
Private Sub Form_Unload(Cancel As Integer)
DestroyWindow mWnd
End Sub
复制进去看看追问
谢谢!但我需要的是建立新的无标题栏无边框窗体,再请赐教!
追答VB本来自己就可以做你想要点窗体为什么还要API去做,我就不知道了。
在vb中人如何用 shape控件画圆?
1、打开VB软件,新建一个标准EXE。
2、建立一个标签按钮。
3、可以改变标签的文字大小类型位置,在右边找到Font属性。我们将字体设为黑体,字形设为粗行,大小改为18。
4、在caption属性的窗口中可以改标签的内容,例如改为"又下雨了"
5、我们还可以改动标签文字的位置,例如左边,中间,还是在右边输出。在Alignment中选择0,1,2。
参考技术A<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false">
<solid android:color="@color/red"/>
<stroke
android:width="1dp"
android:color="@color/white"/>
<size android:width="20dp"
android:height="20dp"/>
</shape>
扩展资料
很多软件中也用图形来丰富用户数据.例如在有名的Word,Excel或者表格控件 比如Spread中经常见到Shape图形,用户可以在一个表单中,可以创建一个星形或者其他图像,用来突出显示数据或者或给用 户指示一些工作表的特定方面。
接下来可以自定义此星形或者图像的尺寸,背景色,旋转角度或者渐变效果等方面。下面是以Spread为例子,给出自定义图形的编程示例:
// 添加一个箭头图形,并设置边框以及背景颜色。
Win.Spread.DrawingSpace.ArrowShape arrow = new FarPoint.Win.Spread.DrawingSpace.ArrowShape();
BackColor = Color.Plum;
ForeColor = Color.Pink;
SetBounds(0,0,200,100);
fpSpread1.ActiveSheet.AddShape(arrow);
参考资料来源:百度百科-Shape控件
参考技术B 先在做窗口中单击鼠标右键选择’添加选项卡‘命令,在命令框中输入‘shape’,这样在工具栏中添加shape控件:然后再设置 shape控件的shape属性值为3-circle ,点击shape,就可以随便画圆了,学习语言一定要敢于大胆尝试,对不同属性,大胆修改看窗体与控件变化,你才能真正学会!!光看理论书是不够的,但却是必须的!!!! 参考技术C 设置 shape控件的shape属性值为circle本回答被提问者采纳以上是关于VB如何用CreateWindowEx 创建无标题栏无边框窗体?的主要内容,如果未能解决你的问题,请参考以下文章
vb60编程中,如何用API函数中的createfile()创建一个文件?