Public Declare Function DrawFocusRect Lib "user32" (ByVal hdc As Long, lpRect As RECT) As Long
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
解决方案 »
- Visual Basic 9.0 概述==>摘要:本文概述支持数据密集型编程的新的 Visual Basic 语言特性和新的语言扩展。
- 怎么使MDI窗口的picture里的图片居中?
- 一个简单的数据操作实例请教各位高手,不胜感谢!
- 如何捕获VB并口直接打印的错误?
- 急问大虾,ActiveX DLL, ActiveX EXE 和 ActiveX控件三者有什么关系?
- 本人想在VB中的一个窗体中加入网页做导航页面,如何点击网页上的超连接控制VB应用程序?
- 问个菜问题:如何调试COM
- 急求下拉控件问题??????
- OCX和activeX dll有什么区别?
- 一个奇怪的问题
- 请问怎样用代码设置 vsPrinter7的页面边距。请帮帮我。谢谢
- 如何在DATAGRID上加DATACOMBO
i_hwnd = GetDC(Picture1.hWnd)
DrawFocusRect i_hwnd, grect
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDc Lib "user32" Alias "ReleaseDC" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private grect As RECTPrivate Sub Form_Load()
With grect
.Bottom = 0
.Left = 0
.Top = 0
.Right = 0
End With
End SubPrivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i_hwnd As Long
Dim i_rec As Long
If Button = 1 Then
i_hwnd = GetDC(Picture1.hwnd)
DrawFocusRect i_hwnd, grect
grect.Left = X
grect.Top = Y
i_rec = ReleaseDc(Picture1.hwnd, i_hwnd)
End IfEnd Sub
Private originPosX As Integer
Private originPosY As Integer
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
originPosX = X
originPosY = Y
With Me.Shape1
.Left = X
.Top = Y
.Visible = True
End With
End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)If Button <> 1 Then
Exit Sub
End IfWith Me.Shape1
If X > originPosX Then
.Width = X - originPosX
Else
.Width = originPosX - X
.Left = X
End If
If Y > originPosY Then
.Height = Y - originPosY
Else
.Height = originPosY - Y
.Top = Y
End If
DoEvents
End With
End Sub
Dim LDown As Boolean
Private Sub Form_Load()
LDown = False
Picture1.DrawStyle = 2End SubPrivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
LDown = True
BegX = X
BegY = Y
End IfEnd SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If LDown = True Then
Picture1.Cls
Picture1.Line (BegX, BegY)-(BegX, Y), , B
Picture1.Line (BegX, BegY)-(X, BegY), , B
Picture1.Line (X, Y)-(X, BegY), , B
Picture1.Line (X, Y)-(BegX, Y), , B
EndX = X
EndY = Y
End If
End SubPrivate Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
LDown = False
End Sub
我现在也正在学VB,希望能跟向你请教!!
你的QQ能告诉我吗!?
我的是9172547,请加我吧!!!