Click here to Skip to main content
15,919,479 members
Home / Discussions / C#
   

C#

 
AnswerRe: CPU Usage Monitoring Pin
Malcolm Smart20-Jul-07 3:46
Malcolm Smart20-Jul-07 3:46 
GeneralRe: CPU Usage Monitoring Pin
Luc Pattyn20-Jul-07 3:58
sitebuilderLuc Pattyn20-Jul-07 3:58 
GeneralRe: CPU Usage Monitoring Pin
Malcolm Smart20-Jul-07 4:43
Malcolm Smart20-Jul-07 4:43 
JokeRe: CPU Usage Monitoring Pin
Luc Pattyn20-Jul-07 5:02
sitebuilderLuc Pattyn20-Jul-07 5:02 
JokeRe: CPU Usage Monitoring Pin
Paul Conrad20-Jul-07 5:47
professionalPaul Conrad20-Jul-07 5:47 
JokeRe: CPU Usage Monitoring Pin
Luc Pattyn20-Jul-07 6:02
sitebuilderLuc Pattyn20-Jul-07 6:02 
GeneralRe: CPU Usage Monitoring Pin
Paul Conrad20-Jul-07 6:14
professionalPaul Conrad20-Jul-07 6:14 
QuestionDrag & Drop trouble Pin
eskape1920-Jul-07 3:24
eskape1920-Jul-07 3:24 
I have an application that loads an image (having the role of a background image) and next to it, in a panel to the right, there are loaded some more images, small ones, representing various objects - those images are loaded each in it's own panel (smaller panels that the one containing them all).

The main picture (the background) is loaded in a PictureBox and it is divided in some regions (I store the pairs of points that define each region in a text file)

The objects should allow to be dragged and dropped over the regions they belong to (at first, when the objects were uploaded, they were each associated to at least one of the regions, the regions being previously defined).

HERE IS MY PROBLEM:
I can't mannage to make the drag and drop operation work the way that i want!!!

My code looks something like this:

private void Panel_MouseDown(object sender, MouseEventArgs e)
{
isDragged = true;
clickX = e.X;
clickY = e.Y;
}

private void Panel_MouseUp(object sender, MouseEventArgs e)
{
isDragged = false;
}

private void Panel_MouseMove(object sender, MouseEventArgs e)
{
Panel p = (Panel)sender;
isDragged == true)
{
if(!pictureBox1.Controls.Contains(p))
{
this.pictureBox1.Controls.Add(p);
}

p.Left = e.X + p.Left - clickX;
p.Top = e.Y + p.Top - clickY;
}
}

This code allows the panel loaded with that object to move anywhere in the window! The issue is that the application is addressed to kindergarden children, so it should be safer to use: this is why I want to limit the movement of the "object-panel" within the PictureBox, so that it couldn't leave its margins!!!

How do I do that???

Do you have any idea how can I check if an "object-panel" is dragged in the right region? Do you know any posibility to determine if an object positioned at the coordinates (x, y) is included inside a certain region (defined through pairs of points as mentioned above)???

I could really use your help!!! Smile | :)

Good gives us the power of creating the future. Use this power with reason.

AnswerRe: Drag & Drop trouble [modified] Pin
BoneSoft20-Jul-07 4:06
BoneSoft20-Jul-07 4:06 
AnswerRe: Drag & Drop trouble Pin
BoneSoft20-Jul-07 5:00
BoneSoft20-Jul-07 5:00 
Question(Exit) Not to continue the execution Pin
-spy-20-Jul-07 3:09
-spy-20-Jul-07 3:09 
AnswerRe: (Exit) Not to continue the execution Pin
Pete O'Hanlon20-Jul-07 3:15
mvePete O'Hanlon20-Jul-07 3:15 
AnswerRe: (Exit) Not to continue the execution Pin
Waleed Eissa29-Aug-07 10:15
Waleed Eissa29-Aug-07 10:15 
Questionsubstituting variables [modified] Pin
KPThor20-Jul-07 2:49
KPThor20-Jul-07 2:49 
AnswerRe: substituting variables Pin
Colin Angus Mackay20-Jul-07 2:53
Colin Angus Mackay20-Jul-07 2:53 
GeneralRe: substituting variables Pin
KPThor20-Jul-07 3:27
KPThor20-Jul-07 3:27 
GeneralRe: substituting variables Pin
Colin Angus Mackay20-Jul-07 4:16
Colin Angus Mackay20-Jul-07 4:16 
QuestionConvert Null db field to string Pin
kallileo20-Jul-07 2:44
kallileo20-Jul-07 2:44 
AnswerRe: Convert Null db field to string Pin
Colin Angus Mackay20-Jul-07 2:50
Colin Angus Mackay20-Jul-07 2:50 
AnswerRe: Convert Null db field to string Pin
Le centriste20-Jul-07 2:54
Le centriste20-Jul-07 2:54 
GeneralRe: Convert Null db field to string Pin
Colin Angus Mackay20-Jul-07 2:56
Colin Angus Mackay20-Jul-07 2:56 
GeneralRe: Convert Null db field to string Pin
Le centriste20-Jul-07 2:58
Le centriste20-Jul-07 2:58 
AnswerRe: Convert Null db field to string [modified] Pin
kallileo20-Jul-07 3:02
kallileo20-Jul-07 3:02 
GeneralRe: Convert Null db field to string Pin
Colin Angus Mackay20-Jul-07 3:16
Colin Angus Mackay20-Jul-07 3:16 
GeneralRe: Convert Null db field to string Pin
Le centriste20-Jul-07 3:56
Le centriste20-Jul-07 3:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.