这个VB事件怎么没用呀

honghuige 2003-08-21 09:18:40
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Text1.Text = "aaaaa"
End Sub

DragDrop这个事件不是拖放事件吗,,我拖到明天好像也没有触发事件呀,,,难道是我的VB有问题吗
...全文
64 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
danielinbiti 2003-08-23
  • 打赏
  • 举报
回复
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Text1.Text = "aaaaa"
End Sub

Private Sub Form_Load()
Text1.DragMode = 1
End Sub
qifanghcy 2003-08-23
  • 打赏
  • 举报
回复
dragmode才两个属性,一个手工,一个自动的,你看花眼了吧???
honghuige 2003-08-23
  • 打赏
  • 举报
回复
现在明白了一些,,那大家可以讲明白一些吗,,,
手动指的是什么,,自动又指的是什么,,,,
是不是手动指的是控件在拖动过程中有一个虚框,可以引发DragDROP和DragOver事件,,,对吗,,,,,,,

那自动又是什么,,控件会自动移动吗,,,
踏平扶桑 2003-08-22
  • 打赏
  • 举报
回复
是text1的一个以m开头的属性
呵呵~~
忘了怎么拼写了,反正它只有两个值,true和false,在text1属性窗口里设置,就是vb屏幕右边中间。
踏平扶桑 2003-08-22
  • 打赏
  • 举报
回复
是text1的一个叫m开头的属性
呵呵~~
忘了怎么拼写了。反正它就有两个值,true和false,在属性窗口里设置。
honghuige 2003-08-22
  • 打赏
  • 举报
回复
怎么设置,,,是哪个属性呀
qingming81 2003-08-22
  • 打赏
  • 举报
回复
楼上的说M开头的属性,大概是指.movable属性,可是这个属性如果设置为false,则按住标题栏也拖不动。控件拖动要用到的属性是.dragmode,应设置为0。如果是窗体,不是这样用的。
qingming81 2003-08-22
  • 打赏
  • 举报
回复
DragOver Event Example
This example demonstrates one way to indicate a valid drop target. The pointer changes from the default arrow to a special icon when a TextBox control is dragged over a PictureBox control. The pointer returns to the default when the source is dragged elsewhere. To try this example, paste the code into the Declarations section of a form that contains a small TextBox and a PictureBox. Set the TextBox control's DragMode property to 1, and then press F5 and drag the TextBox over the PictureBox.

Private Sub Picture1_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
Select Case State
Case vbEnter
' Load icon.
Source.DragIcon = LoadPicture("ICONS\ARROWS\POINT03.ICO")
Case vbLeave
Source.DragIcon = LoadPicture() ' Unload icon.
End Select
End Sub

Private Sub Picture1_DragDrop (Source As Control, X As Single, Y As Single)
Source.DragIcon = LoadPicture() ' Unload icon.
End Sub

qingming81 2003-08-22
  • 打赏
  • 举报
回复
什么M开头的属性?不是这样用的。看MSDN的


Visual Basic Reference

DragDrop Event


Occurs when a drag-and-drop operation is completed as a result of dragging a control over an object and releasing the mouse button or using the Drag method with its action argument set to 2 (Drop).

Syntax

Private Sub Form_DragDrop(source As Control, x As Single, y As Single)

Private Sub MDIForm_DragDrop(source As Control, x As Single, y As Single)

Private Sub object_DragDrop([index As Integer,]source As Control, x As Single, y As Single)

The DragDrop event syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
index An integer that uniquely identifies a control if it's in a control array.
source The control being dragged. You can include properties and methods in the event procedure with this argument — for example, Source.Visible = 0.
x, y A number that specifies the current horizontal (x) and vertical (y) position of the mouse pointer within the target form or control. These coordinates are always expressed in terms of the target's coordinate system as set by the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties.


Remarks

Use a DragDrop event procedure to control what happens after a drag operation is completed. For example, you can move the source control to a new location or copy a file from one location to another.

When multiple controls can potentially be used in a source argument:

Use the TypeOf keyword with the If statement to determine the type of control used with source.


Use the control's Tag property to identify a control, and then use a DragDrop event procedure.
Note Use the DragMode property and Drag method to specify the way dragging is initiated. Once dragging has been initiated, you can handle events that precede a DragDrop event with a DragOver event procedure.


--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.


DragDrop Event Example
This example demonstrates the visual effect of dropping a PictureBox control onto another PictureBox control. To try this example, paste the code into the Declarations section of a form that contains three PictureBox controls. Set the DragMode property for Picture1 and Picture2 to 1 (Automatic). Use the Picture property to assign bitmaps to Picture1 and Picture2, and then press F5 and drag Picture1 or Picture2 over Picture3.

Private Sub Picture3_DragDrop (Source As Control, X as Single, Y As Single)
If TypeOf Source Is PictureBox Then
' Set Picture3 bitmap to same as source control.
Picture3.Picture = Source.Picture
End If
End Sub

honghuige 2003-08-22
  • 打赏
  • 举报
回复
到底是哪一个M开头的属性呀,,我找不到
honghuige 2003-08-22
  • 打赏
  • 举报
回复
dragmode这个属性有十几个选项,,,,还有,,根本不能设置为零
踏平扶桑 2003-08-21
  • 打赏
  • 举报
回复
要把拖放设置为true才行.
honghuige 2003-08-21
  • 打赏
  • 举报
回复
DrogOver这个也一样
里面所含的内容有: 1、vb6MDPlay重复播放.txt 2、vb6MsgBox消息窗口.txt 3、vb6text自动换行.txt 4、vb6保存(读取)数据到注册表里.txt 5、vb6背景色透明.txt 6、vb6打开任意类型的文件.txt 7、vb6打开网页.txt 8、vb6单击按钮复制文本框内的内容.txt 9、vb6单击按钮最小化窗体.txt 10、vb6点击最大化最小化和关闭(有上角的)触发什么事件.txt 11、vb6调用API函数模拟按下Alt键.txt 12、vb6读写txt内容.txt 13、vb6根据MDPlay设计进度框.txt 14、vb6后台发送邮件.txt 15、vb6获取鼠标当前位置.txt 16、vb6检测程序是否运行.txt 17、vb6检测键盘的输入.txt 18、vb6检测文件是否存在.txt 19、vb6进度条的使用A.txt 20、vb6进度条的使用B.txt 21、vb6禁止改变窗口大小(允许最大化和最小化).txt 22、vb6模拟按键.txt 23、vb6模拟键盘输入的N种方法.txt 24、vb6判断鼠标左键被按下.txt 25、vb6屏幕任意截图.txt 26、vb6全局键盘钩子.txt 27、Vb6如何注册OCX控件.txt 28、vb6什么是键盘虚拟键?.txt 29、vb6使控件大小随窗体的变化而变化.txt 30、vb6使用ShellExecute调用RAR进行解压.txt 31、vb6释放资源文件.txt 32、vb6提取包含特定字符的行的内容.txt 33、vb6托盘+气泡(不用模块).txt 34、vb6拖动text文本框.txt 35、vb6拖动没有标题栏的窗口.txt 36、vb6信息收发软件的制作.txt 37、vb6循环整数的运用.txt 38、vb6用MDPlay播放音乐.txt 39、vb6用代码解压缩rar文件.txt 40、vb6用代码添加资源文件.txt 41、vb6在程序中调用资源文件.txt 42、vb6在数据库中保存变量.txt 43、vb6怎么生成不带引号的字符.txt 44、vb6制作时钟(时针、分针、秒针).txt 45、vb6中的text中输入的内容存为txt文本.txt 46、vb6中多个简单的命令.txt 47、vb6中怎样加载背景图片,能随窗体大小变化? .txt 以上内容纯属作者本人整理,内容的可靠性也经本作者亲手证实,请放心使用,珍惜作者的劳动成果。

7,763

社区成员

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

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