To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
MSDN Subscribers: Download the VS 2010 Release Candidate
MSDN Subscribers: Download the VS 2010 Release Candidate
Sell Your Code and Make Money?
Creating your own Tetris game using VB.NET
Article :: Improving Software Economics, Part 4 of 7: Top 10 Principles of Iterative Software Management



Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier

Reply Post New Thread
 
Thread Tools Search this Thread Display Modes
Old Apr 21st, 2005, 06:56 PM   #1
jeffow
New Member
 
Join Date: Apr 05
Posts: 8
jeffow is an unknown quantity at this point (<10)
Oval UserControl

I would like to create a VB usercontrol that contains an oval shape. I want a dragover event to occur when the source touches the oval shape rather than the rectangular extent of themy usercontrol. It this possible? Many thanks in advance

Jeffow
jeffow is offline   Reply With Quote
Old Apr 21st, 2005, 07:03 PM   #2
Joacim Andersson
Guru
 
Joacim Andersson's Avatar
 
Join Date: Jan 99
Location: Interactive Medica
Posts: 10,747
Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)
Re: Oval UserControl

I can think of two ways to handle this. The first one is very easy but requries the oval to be in one solid colour. The second requires some math calculation to check if the mouse X and Y position is inside the shape.

Let me know if you have the shape filled with a solid color or not.
__________________
Joacim Andersson
Microsoft MVP, MCSD, MCSE, Sun Certified Java Programmer
If anyones answer has helped you please show your appreciation by rating that answer.
I'd rather run ScriptBrix...
Joacim's view on stuff.
Joacim Andersson is offline   Reply With Quote
Old Apr 21st, 2005, 07:18 PM   #3
moeur
Old Member
 
moeur's Avatar
 
Join Date: Nov 04
Location: In Hiding.... Weather: sizzzzlin'........ Code: Secret
Posts: 2,681
moeur is a glorious beacon of light (400+)moeur is a glorious beacon of light (400+)moeur is a glorious beacon of light (400+)moeur is a glorious beacon of light (400+)moeur is a glorious beacon of light (400+)
Re: Oval UserControl

see if this helps
http://www.vbforums.com/showthread.p...highlight=oval
moeur is offline   Reply With Quote
Old Apr 22nd, 2005, 06:47 AM   #4
jeffow
New Member
 
Join Date: Apr 05
Posts: 8
jeffow is an unknown quantity at this point (<10)
Re: Oval UserControl

In reply to the question raised by Joacim - yes, the shape will always be solid filled, so I would like to hear your idea.

many Thanks

Jeffow
jeffow is offline   Reply With Quote
Old Apr 22nd, 2005, 07:03 AM   #5
Joacim Andersson
Guru
 
Joacim Andersson's Avatar
 
Join Date: Jan 99
Location: Interactive Medica
Posts: 10,747
Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)
Re: Oval UserControl

Quote:
Originally Posted by jeffow
In reply to the question raised by Joacim - yes, the shape will always be solid filled, so I would like to hear your idea.
In that case you could simply check the the color of the point the mouse is over in the MouseMove event.
VB Code:
  1. If UserControl.Point(X, Y) = Shape1.FillColor Then
  2.     'do whatever
  3. End If
__________________
Joacim Andersson
Microsoft MVP, MCSD, MCSE, Sun Certified Java Programmer
If anyones answer has helped you please show your appreciation by rating that answer.
I'd rather run ScriptBrix...
Joacim's view on stuff.
Joacim Andersson is offline   Reply With Quote
Old Apr 22nd, 2005, 07:07 AM   #6
Max_aka_NOBODY
Addicted Member
 
Max_aka_NOBODY's Avatar
 
Join Date: Jul 04
Location: Amman, Jordan
Posts: 179
Max_aka_NOBODY is on a distinguished road (10+)
Re: Oval UserControl

But if he uses an antialiased picture of the oval in an image control for example that won't work completely. Nonetheless, it wouldn't be much of a problem.
Max_aka_NOBODY is offline   Reply With Quote
Old Apr 22nd, 2005, 07:15 AM   #7
Joacim Andersson
Guru
 
Joacim Andersson's Avatar
 
Join Date: Jan 99
Location: Interactive Medica
Posts: 10,747
Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)
Re: Oval UserControl

Quote:
Originally Posted by Max_aka_NOBODY
But if he uses an antialiased picture of the oval in an image control for example that won't work completely. Nonetheless, it wouldn't be much of a problem.
No it wouldn't. But he doesn't so it doesn't matter. I just provided a very simple solution without going in to any APIs or advanced mathematical code.

Another solution would be to simply set the BackStyle of the UserControl to Transparant, since the mouse move event will not be fired while the mouse is over a transparent part.
__________________
Joacim Andersson
Microsoft MVP, MCSD, MCSE, Sun Certified Java Programmer
If anyones answer has helped you please show your appreciation by rating that answer.
I'd rather run ScriptBrix...
Joacim's view on stuff.
Joacim Andersson is offline   Reply With Quote
Old Apr 22nd, 2005, 09:09 AM   #8
Mc Brain
Need-a-life Member
 
Mc Brain's Avatar
 
Join Date: Apr 00
Location: Buenos Aires, Argentina
Posts: 6,808
Mc Brain will become famous soon enough (50+)
Re: Oval UserControl

Quote:
Originally Posted by Joacim Andersson
No it wouldn't. But he doesn't so it doesn't matter. I just provided a very simple solution without going in to any APIs or advanced mathematical code.

Another solution would be to simply set the BackStyle of the UserControl to Transparant, since the mouse move event will not be fired while the mouse is over a transparent part.
Apparently, if you set the BackStyle to transparent... none of the components in it are visible (similar as if the usercontrol was invisible). Is there anything else that needed to be set to avoid this??
__________________
Emiliano F. Martín


If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.


MP3 Organizer: Freeware to logically organize all your MP3s.
Mc Brain is offline   Reply With Quote
Old Apr 22nd, 2005, 09:14 AM   #9
Joacim Andersson
Guru
 
Joacim Andersson's Avatar
 
Join Date: Jan 99
Location: Interactive Medica
Posts: 10,747
Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)
Re: Oval UserControl

Quote:
Originally Posted by Mc Brain
Apparently, if you set the BackStyle to transparent... none of the components in it are visible (similar as if the usercontrol was invisible). Is there anything else that needed to be set to avoid this??
That's not true. Put a Shape control on a usercontrol, set the BackStyle to transparent and see for yourself. The Shape is still visible.

EDIT: See the attached image, as you can see the UserControl is transparent but the Shape control is visible.
Attached Images
 
__________________
Joacim Andersson
Microsoft MVP, MCSD, MCSE, Sun Certified Java Programmer
If anyones answer has helped you please show your appreciation by rating that answer.
I'd rather run ScriptBrix...
Joacim's view on stuff.

Last edited by Joacim Andersson; Apr 22nd, 2005 at 09:18 AM.
Joacim Andersson is offline   Reply With Quote
Old Apr 22nd, 2005, 10:18 AM   #10
Mc Brain
Need-a-life Member
 
Mc Brain's Avatar
 
Join Date: Apr 00
Location: Buenos Aires, Argentina
Posts: 6,808
Mc Brain will become famous soon enough (50+)
Re: Oval UserControl

Ok, you're right. I opened a new project and was able to do it. I don't know why but I couldn't on the other one. However, if you use an Image (with transparent backgound), the effect is not seen.
__________________
Emiliano F. Martín


If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.


MP3 Organizer: Freeware to logically organize all your MP3s.
Mc Brain is offline   Reply With Quote
Old Apr 25th, 2005, 06:17 PM   #11
jeffow
New Member
 
Join Date: Apr 05
Posts: 8
jeffow is an unknown quantity at this point (<10)
Re: Oval UserControl [closed]

Many Thanks for all the input. I think I now consider this resolved.

jeffow
jeffow is offline   Reply With Quote
Old Apr 25th, 2005, 07:14 PM   #12
Joacim Andersson
Guru
 
Joacim Andersson's Avatar
 
Join Date: Jan 99
Location: Interactive Medica
Posts: 10,747
Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)
Re: Oval UserControl

When a question has been resolved please edit your origional post in the thread and add the word [RESOLVED] to the title. You should also use the green checkmark as the post icon.
__________________
Joacim Andersson
Microsoft MVP, MCSD, MCSE, Sun Certified Java Programmer
If anyones answer has helped you please show your appreciation by rating that answer.
I'd rather run ScriptBrix...
Joacim's view on stuff.
Joacim Andersson is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:52 PM.




To view more projects, click here

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.