| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1022 人关注过本帖
标题:在窗体上所画圆的边界上按下鼠标左键,拖动鼠标到圆心处松开鼠标左键,以松 ...
只看楼主 加入收藏
prk
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-4-17
收藏
 问题点数:0 回复次数:3 
在窗体上所画圆的边界上按下鼠标左键,拖动鼠标到圆心处松开鼠标左键,以松开鼠标左
在窗体上所画圆的边界上按下鼠标左键,拖动鼠标到圆心处松开鼠标左键,以松开鼠标左键到按下鼠标左键位置之间为半径,画出圆。
搜索更多相关主题的帖子: 鼠标 左键 拖动 圆心 窗体 
2005-04-17 20:43
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 

Option Explicit

Private Type POINT X As Long Y As Long End Type

Dim MouseDownFlag As Boolean Dim OldPos As POINT Dim Pos1 As POINT, Pos2 As POINT

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then MouseDownFlag = True Pos1.X = X Pos1.Y = Y End If End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If MouseDownFlag = True Then Me.Line (Pos1.X, Pos1.Y)-(OldPos.X, OldPos.Y), Me.BackColor Me.Line (Pos1.X, Pos1.Y)-(X, Y), Me.ForeColor OldPos.X = X OldPos.Y = Y End If End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then Pos2.X = X Pos2.Y = Y Call DrawCircle(Pos1, Pos2) End If MouseDownFlag = False End Sub

Private Sub DrawCircle(Pos1 As POINT, Pos2 As POINT) Me.Circle (Pos2.X, Pos2.Y), ((Pos1.X - Pos2.X) * (Pos1.X - Pos2.X) + (Pos1.Y - Pos2.Y) * (Pos1.Y - Pos2.Y)) ^ 0.5 End Sub


天津网站建设 http://www./
2005-04-17 22:21
prk
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-4-17
收藏
得分:0 
谢谢版主啊
2005-04-18 12:49
doudouhan
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2005-3-13
收藏
得分:0 
版主同志:
    我还要问一下,如果我只想让这个圆显示一下,然后马上删掉,丢失所说的状态线框该如何实现呢?
2005-05-01 15:03
快速回复:在窗体上所画圆的边界上按下鼠标左键,拖动鼠标到圆心处松开鼠标左键, ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024791 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved