Click here to Skip to main content
16,014,650 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cursor position Pin
Agyeman7-Oct-05 9:01
Agyeman7-Oct-05 9:01 
GeneralRe: Cursor position Pin
XRaheemX7-Oct-05 9:05
XRaheemX7-Oct-05 9:05 
GeneralRe: Cursor position Pin
XRaheemX7-Oct-05 9:06
XRaheemX7-Oct-05 9:06 
GeneralRe: Cursor position Pin
Agyeman7-Oct-05 9:11
Agyeman7-Oct-05 9:11 
GeneralRe: Cursor position Pin
XRaheemX7-Oct-05 9:13
XRaheemX7-Oct-05 9:13 
GeneralRe: Cursor position Pin
Agyeman7-Oct-05 9:28
Agyeman7-Oct-05 9:28 
GeneralRe: Cursor position Pin
XRaheemX7-Oct-05 9:31
XRaheemX7-Oct-05 9:31 
GeneralRe: Cursor position Pin
XRaheemX7-Oct-05 10:14
XRaheemX7-Oct-05 10:14 
Just so everybody else sees the resolution in case they are trying the same. You were trying to get the mouse position of a click point within a control, and then create a new control over the top of that control on the form. To do this I recommended the following that seemed to work:

global declarations of MouseCoords:
private int Control1MouseX;
private int Control1MouseY;

Form is called Form1
Main control is called Control1
New Control is call NewControl1

in the MouseDown event of Control1 do the following:

<code>
   Point p = this.Form1.PointToClient(this.Control1.PointToScreen(new Point(e.X,e.Y)));
   this.Control1MouseX = p.X;
   this.Control1MouseY = p.Y;
</code>


then when creating and placing the new Control use this:

<code>
   Control NewControl1 = new Control();
   NewControl1.Location = new Location(this.Control1MouseX,this.Control1MouseY);
   Form.Controls.Add(NewControl1);
</code>

AnswerRe: Cursor position Pin
Wjousts7-Oct-05 7:07
Wjousts7-Oct-05 7:07 
GeneralRe: Cursor position Pin
XRaheemX7-Oct-05 7:21
XRaheemX7-Oct-05 7:21 
QuestionCustom Controls and events Pin
Red_Wizard_Shot_The_Food7-Oct-05 3:46
Red_Wizard_Shot_The_Food7-Oct-05 3:46 
AnswerRe: Custom Controls and events Pin
XRaheemX7-Oct-05 5:37
XRaheemX7-Oct-05 5:37 
GeneralRe: Custom Controls and events Pin
Red_Wizard_Shot_The_Food7-Oct-05 5:56
Red_Wizard_Shot_The_Food7-Oct-05 5:56 
GeneralRe: Custom Controls and events Pin
XRaheemX7-Oct-05 6:55
XRaheemX7-Oct-05 6:55 
GeneralRe: Custom Controls and events Pin
therealmccoy7-Oct-05 5:50
therealmccoy7-Oct-05 5:50 
QuestionSystem.Diagnostic.Process question/problem Pin
XRaheemX7-Oct-05 3:28
XRaheemX7-Oct-05 3:28 
AnswerRe: System.Diagnostic.Process question/problem Pin
therealmccoy7-Oct-05 7:59
therealmccoy7-Oct-05 7:59 
GeneralRe: System.Diagnostic.Process question/problem Pin
XRaheemX7-Oct-05 8:02
XRaheemX7-Oct-05 8:02 
GeneralRe: System.Diagnostic.Process question/problem Pin
therealmccoy7-Oct-05 8:57
therealmccoy7-Oct-05 8:57 
Questionaccessing a C DLL with C# Long/Int problem Pin
CalvinB7-Oct-05 3:26
CalvinB7-Oct-05 3:26 
AnswerRe: accessing a C DLL with C# Long/Int problem Pin
mav.northwind7-Oct-05 4:15
mav.northwind7-Oct-05 4:15 
GeneralRe: accessing a C DLL with C# Long/Int problem Pin
CalvinB7-Oct-05 4:59
CalvinB7-Oct-05 4:59 
GeneralRe: accessing a C DLL with C# Long/Int problem Pin
leppie7-Oct-05 7:25
leppie7-Oct-05 7:25 
QuestionData Access &amp; Tab Control Pin
rich_wenger7-Oct-05 2:49
rich_wenger7-Oct-05 2:49 
QuestionSoftware Architecture - HELP! Pin
trjones17-Oct-05 1:44
trjones17-Oct-05 1:44 

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.