如何锁定窗口拉大拉小?

zhengyukong 2008-06-01 04:23:38
如何锁定窗口拉大拉小?
...全文
351 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 CityBird 的回复:]
我猜是B,理由是楼主他爸爸姓郑,他妈妈姓孔,两个人走到了一起于是就有了他,所以他叫“郑遇孔”

^_^
[/Quote]
samtyty 2008-06-04
  • 打赏
  • 举报
回复
Form 对象的 BorderStyle 属性设置值如下:

常数 设置值 描述
vbBSNone 0 无(没有边框或与边框相关的元素)。
vbFixedSingle 1 固定单边框。可以包含控制菜单框,标题栏,“最大化”按钮,和“最小化”按钮。只有使用最大化和最小化按钮才能改变大小。
vbSizable 2 (缺省值)可调整的边框。可以使用设置值1列出的任何可选边框元素重新改变尺寸。
vbFixedDouble 3 固定对话框。可以包含控制菜单框和标题栏,不能包含最大化和最小化按钮,不能改变尺寸。
vbFixedToolWindow 4 固定工具窗口。不能改变尺寸。显示关闭按钮并用缩小的字体显示标题栏。窗体在 Windows 95 的任务条中不显示。
vbSizableToolWindow 5 可变尺寸工具窗口。可变大小。显示关闭按钮并用缩小的字体显示标题栏。窗体在 Windows 95 的任务条中不显示。

只要设置成1就不能改变大小了,如果设置成3,也是不能改变大小的,但是任务栏的图标也消失了
现在还是人类 2008-06-03
  • 打赏
  • 举报
回复
猜错了,-_-!!!!
zhengyukong 2008-06-02
  • 打赏
  • 举报
回复
答案:郑宇坤
vansoft 2008-06-02
  • 打赏
  • 举报
回复
如果只是简单的不能拉伸大小,
设置一下窗体的style属性就OK了。
tim_zhang 2008-06-02
  • 打赏
  • 举报
回复
设置BorderStyle属性
波导终结者 2008-06-02
  • 打赏
  • 举报
回复
'窗体
Option Explicit

' This constant is used to refer to the Message Handling function in a given window
Private Const GWL_WNDPROC = (-4)
Private Sub Form_Load()

' First, we need to store the address of the existing Message Handler
OldWindowProc = GetWindowLong(Me.hwnd, GWL_WNDPROC)

' Now we can tell windows to forward all messages to out own Message Handler
Call SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf SubClass1_WndMessage)

End Sub
Private Sub Form_Unload(Cancel As Integer)

' We must return control of the messages back to windows before the program exits
Call SetWindowLong(Me.hwnd, GWL_WNDPROC, OldWindowProc)

End Sub

'模块





' * * * * * * * * * * Caution * * * * * * * * * * * * *
' Changes made to the functions contained herein can cause VB to crash!
' SAVE YOUR CHANGES BEFORE RUNNING THIS PROGRAM IN THE VB IDE!
' DO NOT ENTER BREAK MODE! DOING SO WILL CRASH VB!
' * * * * * * * * * * Caution * * * * * * * * * * * * *









Option Explicit
Public OldWindowProc As Long ' Original window proc

' Function to retrieve the address of the current Message-Handling routine
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
' Function to define the address of the Message-Handling routine
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
' Function to copy an object/variable/structure passed by reference onto a variable of your own
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As Any, pSource As Any, ByVal ByteLen As Long)
' Function to execute a function residing at a specific memory address
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

' This is the message constant
Public Const WM_GETMINMAXINFO = &H24

' This is a structure referenced by the MINMAXINFO structure
Type POINTAPI
x As Long
y As Long
End Type

' This is the structure that is passed by reference (ie an address) to your message handler
' The key items in this structure are ptMinTrackSize and ptMaxTrackSize
Type MINMAXINFO
ptReserved As POINTAPI
ptMaxSize As POINTAPI
ptMaxPosition As POINTAPI
ptMinTrackSize As POINTAPI
ptMaxTrackSize As POINTAPI
End Type
Public Function SubClass1_WndMessage(ByVal hwnd As Long, ByVal Msg As Long, ByVal wp As Long, ByVal lp As Long) As Long

' Watch for the pertinent message to come in
If Msg = WM_GETMINMAXINFO Then

Dim MinMax As MINMAXINFO

' This is necessary because the structure was passed by its address and there
' is currently no intrinsic way to use an address in Visual Basic
CopyMemory MinMax, ByVal lp, Len(MinMax)

' This is where you set the values of the MinX,MinY,MaxX, and MaxY
' The values placed in the structure must be in pixels. The values
' normally used in Visual Basic are in twips. The conversion is as follows:
' pixels = twips\twipsperpixel
MinMax.ptMinTrackSize.x = 3975 \ Screen.TwipsPerPixelX
MinMax.ptMinTrackSize.y = 1740 \ Screen.TwipsPerPixelY
MinMax.ptMaxTrackSize.x = Screen.Width \ Screen.TwipsPerPixelX \ 2
MinMax.ptMaxTrackSize.y = 3480 \ Screen.TwipsPerPixelY

' Here we copy the datastructure back up to the address passed in the parameters
' because Windows will look there for the information.
CopyMemory ByVal lp, MinMax, Len(MinMax)

' This message tells Windows that the message was handled successfully
SubClass1_WndMessage = 1
Exit Function

End If

' Here, we forward all irrelevant messages on to the default message handler.
SubClass1_WndMessage = CallWindowProc(OldWindowProc, hwnd, Msg, wp, lp)

End Function
三楼の郎 2008-06-02
  • 打赏
  • 举报
回复
我猜是B,理由是楼主他爸爸姓郑,他妈妈姓孔,两个人走到了一起于是就有了他,所以他叫“郑遇孔”

^_^
现在还是人类 2008-06-02
  • 打赏
  • 举报
回复
看见一个猜名游戏,呵呵
A、郑宇孔
B、郑遇孔
C、郑雨空
搂主,是哪个?
现在还是人类 2008-06-02
  • 打赏
  • 举报
回复
这个问题可深可浅,都不知怎么答
深点的方法就是用钩子
浅点的方法就是用属性
不幸的是都给人答了,呵呵
xixihaha_2011_098 2008-06-01
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 CityBird 的回复:]
将Form的BorderStyle属性设置为1或3,窗体就不可以拉大拉小了
[/Quote]

这个方法就好使啊
Soyokaze 2008-06-01
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 fj182 的回复:]
子类化窗体处理WM_GETMINMAXINFO消息
http://faq.csdn.net/read/18623.html
[/Quote]
还加上 WM_SIZING、WM_SIZE
zzyong00 2008-06-01
  • 打赏
  • 举报
回复
sub form_resize
if me.windowstate=vbminized then exit sub
me.width=1000
me.height=1000
end sub
三楼の郎 2008-06-01
  • 打赏
  • 举报
回复
将Form的BorderStyle属性设置为1或3,窗体就不可以拉大拉小了
波导终结者 2008-06-01
  • 打赏
  • 举报
回复
1楼所说的才是解决之道。
2楼所说的属性不知道是哪里的,至少我VB6里的窗体没找到。
cyranosky 2008-06-01
  • 打赏
  • 举报
回复
将窗体的属性MaximumSize和MinimumSize的值设置为一样大小就可以了。
可以给分结贴了。
fj182 2008-06-01
  • 打赏
  • 举报
回复
子类化窗体处理WM_GETMINMAXINFO消息
http://faq.csdn.net/read/18623.html

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧