»áÔ±£º ÃÜÂ룺 ¡¡Ãâ·Ñ×¢²á | Íü¼ÇÃÜÂë | »áÔ±µÇ¼ ÍøÒ³¹¦ÄÜ£º ¼ÓÈëÊÕ²Ø ÉèΪÊ×Ò³ ÍøÕ¾ËÑË÷  
 °²È«¼¼Êõ¼¼ÊõÎĵµ
  ¡¤ °²È«ÅäÖÆ
  ¡¤ ¹¤¾ß½éÉÜ
  ¡¤ ºÚ¿Í½Ìѧ
  ¡¤ ·À»ðǽ
  ¡¤ Â©¶´·ÖÎö
  ¡¤ ÆƽâרÌâ
  ¡¤ ºÚ¿Í±à³Ì
  ¡¤ ÈëÇÖ¼ì²â
 °²È«¼¼ÊõÂÛ̳
  ¡¤ °²È«ÅäÖÆ
  ¡¤ ¹¤¾ß½éÉÜ
  ¡¤ ·À»ðǽ
  ¡¤ ºÚ¿ÍÈëÇÖ
  ¡¤ Â©¶´¼ì²â
  ¡¤ Æƽⷽ·¨
  ¡¤ É±¶¾×¨Çø
 °²È«¼¼Êõ¹¤¾ßÏÂÔØ
  ¡¤ É¨Ã蹤¾ß
  ¡¤ ¹¥»÷³ÌÐò
  ¡¤ ºóÃÅľÂí
  ¡¤ ¾Ü¾ø·þÎñ
  ¡¤ ¿ÚÁîÆƽâ
  ¡¤ ´úÀí³ÌÐò
  ¡¤ ·À»ðǽ
  ¡¤ ¼ÓÃܽâÃÜ
  ¡¤ ÈëÇÖ¼ì²â
  ¡¤ ¹¥·ÀÑÝʾ
¼¼ÊõÎĵµ > VBÎĵµ > ´°Ìå½çÃæ
ÓÃVBÖÆ×÷Èí¼üÅÌ
·¢±íÈÕÆÚ£º2003-06-23 00:00:00×÷Õߣº¶ ³ö´¦£º  

¿´¼û΢ÈíÖÇÄÜÆ´ÒôÊäÈë·¨µÄС¼üÅÌÁËÂð£¿ÄǶ«¶«¿ÉÒÔÔÚÊäÈëµÄʱºòÓôúÌæ¼üÅÌ¡£

µ±²»Ï£Íû²Ù×÷ԱʹÓüüÅ̵Äʱºò£¬ÄÇôÄã¾ÍÒª¿¼ÂÇΪËý»òËûÌṩÈí¼üÅÌÁË¡£ÏÂÃæÎÒÃǾÍÓÃVBÀ´×öÕâ

¸öÈí¼üÅÌ¡£

×¼±¸¹¤×÷£º

ÏÈ»­Á½¸ö´°ÌåForm1ºÍForm2,Form2ÊÇ×÷Ϊ½ÓÊÕ°´¼ü²âÊÔÓõģ¬ÔÚÉÏÃæ·ÅÒ»¸öÎı¾¿òText1£¬°Ñ

Text1µÄMultiLineÊôÐÔÉèΪTrue,ScrollBarsÉèΪ3-Both,È»ºóдÈëÈçÏ´úÂ룺

Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal 

fEnable As Long) As Long

Private Sub Form_Load()

'µ÷Õû´óС

Me.Width = Screen.Width * 0.9

Me.Height = Screen.Height * 0.9

Form1.Show

'½ûÖ¹Êó±êºÍ¼üÅÌÊäÈë

EnableWindow Text1.hwnd, False

End Sub

Private Sub Form_Resize()

'µ÷ÕûÎı¾¿ò´óС

Text1.Top = 0

Text1.Left = 0

Text1.Width = Me.ScaleWidth

Text1.Height = Me.ScaleHeight

End Sub

Private Sub Form_Unload(Cancel As Integer)

End

End Sub

Form1×÷ΪС¼üÅÌÓ㬰ÑËüµÄBorderStyleÉèΪ3-Fixed Dialog,°ÑControlBoxÊôÐÔÉè

ΪFalse£¬ÕâÑùС¼üÅ̾ÍûÓбêÌâÀ¸ÁË¡£Form1µÃ¸ú΢ÈíÖÇÄÜÆ´ÒôÊäÈë·¨µÄС¼üÅÌÍêÈ«Ò»ÑùµÄ´óС

µÄ´°Ì壬¾­±ÊÕߵļÆË㳤¡Á¸ßÊÇ5310¡Á2130¡£È»ºó·ÅÉÏ10¸ö°´Å¤£¬ÆäÖоŸöµÄCaption·Ö±ðÊÇ

Tab¡¢Caps¡¢¡üShift¡¢Ins¡¢Del¡¢(¿Õ¸ñ)¡¢Esc¡¢EnterºÍ¡û(Í˸ñ)¡£ËüÃǵÄλÖúʹóСÈçÏÂÉè

Öãº

Caption Top Left Height Width Name

¡üShift 1230 0 400 840 Command1

Caps 828 0 400 560 Command2

Tab 410 0 400 480 Command3

Ins 1640 0 400 570 Command4

Del 1640 870 400 550 Command5

(¿Õ¸ñ) 1640 1400 400 2565 Command6

Esc 1640 4670 400 550 Command7

Enter 820 4590 400 630 Command9

¡û(Í˸ñ) 820 4590 400 630 Command10

½ÓÏÂÀ´×öÒ»¸öHeightΪ400¡¢WidthΪ360µÄ°´Å¤Command8,CaptionΪA a£¨×¢ÒâÖмäÊÇÁ½¸ö¿Õ

¸ñ£¬ÕâÒ»µã·Ç³£ÖØÒª£¡£©£¬ÓÉÓÚ°´Å¤Ì«Ð¡£¬ÏµÍ³»á×Ô¶¯»»ÐУ¬¿´ÉÏÈ¥AÔÚaµÄÉÏÃæ¡£¸´ÖƸð´Å¤£¬È»

ºóÔÚ´°ÌåÉÏÕ³Ìù£¬³ÌÐò»áÌáʾÄãÊÇ·ñ²úÉú¿Ø¼þÊý×飬ѡÔñÊÇ£¬Command8±ä³ÉÁËCommand8(0),вú

ÉúµÄ°´Å¤ÎªCommand8(1),Ò»Ö±Õ³Ìù£¬Ö±µ½Command8(46)£¬ÐÞ¸ÄËüÃǵÄCaptionʹ֮Óë¼üÅÌÉϵÄÆä

Ëü¼üÒ»Ñù¡£ÕâÀïҪעÒ⼸µã£º

1¡¢°´Å¤µÄ×ÖÌåΪ¡°Ð¡Î塱£¬Óм¸¸ö¼üÏÔʾµÄ½á¹ûÊÇ×ÝÏò²¢ÅÅ£¬¿É°Ñ×ÖÌåÉèΪ¡°ÁùºÅ¡±£¬Ê¹Ö®ºáÏò

²¢ÅÅ£¬×ÖÌåʹÓÃËÎÌ壬·ñÔò¡üºÍ¡ûÏÔʾµÄ²»Æ¯ÁÁ¡£

2¡¢&·ûºÅҪʹÓÃÁ½¸ö£¬¼´ && 7(&&Óë7Ö®¼äÖ»ÓÐÒ»¸ö¿Õ¸ñ)£¬È·±£Ã¿¸ö°´Å¤µÄCaptionµÄ³¤¶ÈΪËÄ

¸ö×Öĸ¡£

3¡¢°Ñ´°ÌåµÄMousePointerÉèΪ15 - Size All£¬ÒÔ±ãÔÚÔËÐеÄʱºòÒƶ¯Ð¡¼üÅÌ¡£

4¡¢°ÑËùÓа´¼üµÄMousePointer¶¼ÉèΪ99 - Custom,¶øMouseIconÉèΪÊÖÐÎÖ¸Õë¡£

5¡¢ÓÉÓÚҪָʾShiftÊÇ·ñ°´Ï£¬Command1µÄStyleÊôÐÔÉèÖÃΪ1-Graphical¡£

6¡¢Form2µÄStartUpPositionÊôÐÔÉèÖÃΪ2-ÆÁÄ»ÖÐÐÄ¡£

ÎÒÃÇ°ÑCommand8(x)µÄÕâЩ¼üÔÝʱ½Ð×ö¡°ÆÕͨ¼ü¡±¡£ÓÉÓÚÇ°ÃæÒѾ­¶¨Î»ÁË9¸öÌØÊâ¼ü£¬ËùÒÔ¿ÉÒÔͨ

¹ý²Ëµ¥À¸µÄ¡°¸ñʽ¡±ÀïÃæµÄ¡°¶¥¶Ë¶ÔÆ롱¡¢¡°Ïàͬˮƽ¼ä¾à¡±µÈÑ¡ÏîºÜÈÝÒ׵ذÑ47¸öÆÕͨ¼ü·Åµ½Óë

¼üÅ̶ÔÓ¦µÄλÖÃÉÏ¡£ÁíÍ⣬ΪÁËÏÔʾCAPS LOCKµÄ״̬£¬ÎÒÃÇÔÚ´°ÌåÉϼÓÒ»¸ö±êÇ©Label1£¬°ÑËüµÄ

AutoSizeÊôÐÔÉèΪTrue,CaptionÊôÐÔÉèΪ¡ñ£¬ËüµÄTop¡¢Left¡¢HeightºÍWith·Ö±ðΪ1340¡¢

4800¡¢180ºÍ180¡£

½ÓÏÂÀ´ÊÇд´úÂëÁË£¬ÕâÀïÖ÷ÒªÓÃÁËSendMessage·¢ËÍÏûÏ¢µÄAPIº¯Êý£¬ÓÉÓÚ°´Å¤CAPTIONÉèÖõÄÇÉ

ÃËùÒÔ47¸öÆÕͨ¼üµÄ´úÂë¾ÍÓõĺÜÉÙ¡£ËùÓдúÂëÈçÏ£º

'APIÉùÃ÷

Private Declare Function ReleaseCapture Lib "user32" () As Long

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal 

hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long

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)

Private Declare Sub GetKeyboardStateByString Lib "user32" 

Alias "GetKeyboardState" (ByVal pbKeyState As String)

Private Declare Sub SetKeyboardStateByString Lib "user32" 

Alias "SetKeyboardState" (ByVal lppbKeyState As String)

'³£Êý

Const VK_CAPITAL = &H14

Const WM_CHAR = &H102

Const HTCAPTION = 2

Const WM_NCLBUTTONDOWN = &HA1

Const WM_KEYDOWN = &H100

Const VK_DELETE = &H2E

Const VK_INSERT = &H2D

'¶¨Òå±äÁ¿

Dim rc as Long

Private Sub Command1_Click()

'Shift¼ü

If Command1.BackColor = &H8000000B Then

Command1.BackColor = &H80000005

Else

Command1.BackColor = &H8000000B

End If

End Sub

'Í˸ñ¼ü

Private Sub Command10_Click()

rc = SendMessage(Form2.Text1.hwnd, WM_CHAR, 8, 1)

End Sub

'´óСдת»»¼ü

Private Sub Command2_MouseDown(Button As Integer, Shift As Integer, X As 

Single, Y As Single)

Dim CAPITALKey As String * 256

CAPITALKey = Space$(256)

GetKeyboardStateByString (CAPITALKey)

If Label1.ForeColor = vbBlack Then

Label1.ForeColor = vbGreen

Mid$(CAPITALKey, VK_CAPITAL + 1, 1) = Chr$(1)

Else

Label1.ForeColor = vbBlack

Mid$(CAPITALKey, VK_CAPITAL + 1, 1) = Chr$(0)

End If

Call SetKeyboardStateByString(CAPITALKey)

End Sub

'TAB¼ü

Private Sub Command3_Click()

rc = SendMessage(Form2.Text1.hwnd, WM_CHAR, 9, 1)

End Sub

'Ins¼ü

Private Sub Command4_Click()

rc = SendMessage(Form2.Text1.hwnd, WM_KEYDOWN, VK_INSERT, &H510001)

End Sub

'Del¼ü

Private Sub Command5_Click()

rc = SendMessage(Form2.Text1.hwnd, WM_KEYDOWN, VK_DELETE, 1)

End Sub

'¿Õ¸ñ¼ü

Private Sub Command6_Click()

rc = SendMessage(Form2.Text1.hwnd, WM_CHAR, 32, 1)

End Sub

'Esc¼ü

Private Sub Command7_Click()

rc = SendMessage(Form2.Text1.hwnd, WM_CHAR, 27, 1)

End Sub

'ÆÕͨ¼ü

Private Sub Command8_Click(Index As Integer)

Dim keyx As Integer

If Command1.BackColor = &H80000005 Xor Label1.ForeColor = vbGreen Then

keyx = Asc(Mid(Command8(Index).Caption, 1, 1))

Else

keyx = Asc(Mid(Command8(Index).Caption, 4, 1))

End If

rc = SendMessage(Form2.Text1.hwnd, WM_CHAR, keyx, 1)

Command1.BackColor = &H8000000B

End Sub

'»Ø³µ¼ü

Private Sub Command9_Click()

rc = SendMessage(Form2.Text1.hwnd, WM_CHAR, 13, 1)

End Sub

'ÈÃС¼üÅÌÔÚ×îÇ°Ãæ

Private Sub Form_Load()

  rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)

End Sub

'Òƶ¯Ã»ÓбêÌâµÄС¼üÅÌ

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y 

As Single)

If Button = 1 Then

   Dim ReturnVal As Long

   X = ReleaseCapture()

   ReturnVal = SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)

End If

End Sub

×îºóÒªÌáÐÑÄúµÄÊÇ£ºÈç¹ûÄãÒªÓÃÓÚ¶à¸öTextÒª×öÈçÏÂÁ½²½£º

1¡¢°ÑFORM2ÖеÄEnableWindow Text1.hwnd, FalseÈ¥µô¡£

2¡¢°ÑÈí¼üÅÌ´úÂëÖÐËùÓеÄForm2.Text1.Hwnd»»³ÉÈçÏ´úÂ룺Form2.ActiveControl.hwnd

ÇÆ£¬³¬¿áµÄС¼üÅ̾ÍÕâÑù×ö³ÉÁË£¡¸Ã³ÌÐòÔÚVB6+WIN98ÏÂÔËÐÐͨ¹ý£¬Èç¹ûÄãÐèÒª±¾ÊÂÀýµÄÔ´´úÂ룬

ÇëÔÚ±¾Îļû±¨ºóµ½µÚÒ»VBÂÛ̳µÄÊ×Ò³ÏÂÔØ°É£¡ÍøÖ·ÊÇhttp://www.vbgood.com

¡¾·µ»Ø¶¥²¿¡¿ ¡¾´òÓ¡±¾Ò³¡¿ ¡¾¹Ø±Õ´°¿Ú¡¿

¹ØÓÚÎÒÃÇ / ¸øÎÒÁôÑÔ / °æȨ¾Ù±¨ / Òâ¼û½¨Òé / ÍøÕ¾±à³ÌQQȺ   
Copyright ©2003- 2024 Lihuasoft.net webmaster(at)lihuasoft.net ¼ÓÔØʱ¼ä 0.00166