可以直接用API改变textbox的扩展样.doc_第1页
可以直接用API改变textbox的扩展样.doc_第2页
可以直接用API改变textbox的扩展样.doc_第3页
可以直接用API改变textbox的扩展样.doc_第4页
可以直接用API改变textbox的扩展样.doc_第5页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

可以直接用API改变textbox的扩展样可以直接用API改变textbox的扩展样式VERSION 5.00 Begin VB.Form Form1 Caption = Form1 ClientHeight = 6135 ClientLeft = 165 ClientTop = 735 ClientWidth = 7080 LinkTopic = Form1 ScaleHeight = 6135 ScaleWidth = 7080 StartUpPosition = 3 Windows Default Begin VB.CommandButton Command2 Caption = Command2 Height = 375 Left = 4800 TabIndex = 4 Top = 5040 Width = 1455 End Begin VB.PictureBox Pic1 BorderStyle = 0 None Height = 495 Left = 960 ScaleHeight = 495 ScaleWidth = 2655 TabIndex = 5 Top = 2880 Width = 2655 End Begin VB.Timer Timer1 Interval = 10 Left = 240 Top = 3120 End Begin VB.CheckBox Check1 Caption = 选择,再看按钮的文字,然后不要选择 Height = 855 Left = 960 TabIndex = 1 Top = 3600 Width = 4575 End Begin VB.CommandButton Command1 Caption = 歪歪的VB技巧演示 Height = 1695 Left = 360 TabIndex = 0 Top = 960 Width = 5295 End Begin VB.TextBox Text1 Height = 495 Left = 1080 MultiLine = -1 True TabIndex = 3 Top = 5040 Width = 2415 End Begin VB.Label Label1 Caption = Label1 Height = 375 Left = 600 TabIndex = 2 Top = 240 Width = 1215 End Begin VB.Menu mnuChange Caption = 改变样式(&C) Begin VB.Menu mnuFlash Caption = FlashWindow(&F) End End End Attribute VB_Name = Form1 Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False 这是我机子中的一个例子,包含了你说的那个功能,我想就没必要再改了,凑合着看看应该可以吧:) Private Declare Function SetWindowPos Lib user32 (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Alignment constants Private Const BS_CENTER& = &H300& Private Const BS_LEFT& = &H100& Private Const BS_RIGHT& = &H200& Private Const BS_TOP& = &H400& Private Const GWL_STYLE& = (-16) Private Const GWL_EXSTYLE = (-20) Private Const WS_EX_TRANSPARENT = &H20& Private Const WS_THICKFRAME = &H40000 Private Const WS_BORDER = &H400000 Private Const WS_EX_CLIENTEDGE = &H200& Dim FlashYn As Boolean, Yn As Boolean API Calls Private Declare Function GetWindowLong& Lib user32 Alias GetWindowLongA (ByVal hwnd As Long, ByVal nIndex As Long) Private Declare Function SetWindowLong& Lib user32 Alias SetWindowLongA (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) Private Declare Function FlashWindow Lib user32 (ByVal hwnd As Long, ByVal bInvert As Long) As Long Const SWP_DRAWFRAME = &H20 Const SWP_NOMOVE = &H2 Const SWP_NOSIZE = &H1 Const SWP_NOZORDER = &H4 Const SWP_FRAMECHANGED = &H20 The frame changed: send WM_NCCALCSIZE Private Sub Check1_Click() Declare Variables Dim tmpValue&, ret& Dim Align& Check if the state is checked If Check1.Value = Checked Then Yes fAlignment& = BS_LEFT tmpValue& = GetWindowLong&(Command1.hwnd, GWL_STYLE) And Not BS_RIGHT ret& = SetWindowLong&(Command1.hwnd, GWL_STYLE, tmpValue& Or fAlignment&) Command1.Refresh Else No fAlignment& = BS_CENTER tmpValue& = GetWindowLong&(Command1.hwnd, GWL_STYLE) And Not BS_RIGHT Or BS_LEFT ret& = SetWindowLong&(Command1.hwnd, GWL_STYLE, tmpValue& Or fAlignment&) Command1.Refresh End If End Sub Private Sub Command2_Click() Declare Variables Dim tmpValue&, ret& Dim Align& Check if the state is checked tmpValue& = (GetWindowLong&(Text1.hwnd, GWL_EXSTYLE) Or WS_EX_CLIENTEDGE) And Not WS_BORDER ret& = SetWindowLong&(Text1.hwnd, GWL_EXSTYLE, tmpValue&) tmpValue& = (GetWindowLong&(Text1.hwnd, GWL_STYLE) Or WS_THICKFRAME) And Not WS_BORDER ret& = SetWindowLong&(Text1.hwnd, GWL_STYLE, tmpValue&) SetWindowPos Text1.hwnd, Me.hwnd, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOZORDER Or SWP_DRAWFRAME Text1.Refresh End Sub - VB WorkShop 2000 Private Sub Form_Load() Dim tmpValue&, ret& FlashYn = False: Yn = False tmpValue& = GetWindowLong&(Me.hwnd, GWL_EXSTYLE) ret& = SetWindowLong&(Me.hwnd, GWL_EXSTYLE, tmpValue& Or WS_EX_TRANSPARENT) tmpValue& = GetWindowLong&(Check1.hwnd, GWL_EXSTYLE) ret& = SetWindowLong&(Check1.hwnd, GWL_EXSTYLE, tmpValue& Or WS_EX_TRANSPARENT) Command1.Refresh Che

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论