Click here to Skip to main content
15,886,689 members
Home / Discussions / C#
   

C#

 
GeneralRe: Null error when adding custom control Pin
Christian Graus8-Jan-04 9:29
protectorChristian Graus8-Jan-04 9:29 
GeneralRe: Null error when adding custom control Pin
KingTermite8-Jan-04 9:50
KingTermite8-Jan-04 9:50 
GeneralRe: Null error when adding custom control Pin
Christian Graus8-Jan-04 9:52
protectorChristian Graus8-Jan-04 9:52 
GeneralRe: Null error when adding custom control Pin
KingTermite8-Jan-04 10:49
KingTermite8-Jan-04 10:49 
QuestionHow to use PING utility in my program Pin
HAHAHA_NEXT8-Jan-04 8:34
HAHAHA_NEXT8-Jan-04 8:34 
AnswerRe: How to use PING utility in my program Pin
Kentamanos8-Jan-04 9:18
Kentamanos8-Jan-04 9:18 
GeneralGDI grab handles and mouse move Pin
Miles Roberts8-Jan-04 7:10
Miles Roberts8-Jan-04 7:10 
GeneralRe: GDI grab handles and mouse move Pin
Heath Stewart8-Jan-04 7:36
protectorHeath Stewart8-Jan-04 7:36 
Miles Roberts wrote:
1.Develop Code which allows shape objects to be dragged (moved) and resized by implementing grab handles. Write a key handler such as when the delete key is pushed the shape dissapears.

In order to do this, each shape will have to be an object so that you can individually manage it. In your MouseDown event, determine if a shape exists under the mouse and begin tracking that shape (perhaps a private field that represents the currently dragging shape). In the handler for MouseMove determine if the mouse is down and if an object is being dragged. If so, shift the coordinates of the object be dragged and call Refresh to invalidate your form and repaint those regions (it would actually be better to invalidate the region previously occupied to the whole form doesn't have to repaint). In your MouseUp handler set he new position of the shape and clear the field that tracks the currently dragging shape.

Miles Roberts wrote:
2.Add advanced features such as current co-ordinate position of the mouse.

Actually, this is pretty easy. The MouseEventHandler passed to you in the handler for the MouseMove event contains the X and Y coordinates of the mouse in the coordinate space of the control that raised the event (such as a Form or Panel onto which you're painting your custom shapes). Just use those and display them in a StatusBar or something:
private void myForm_MouseMove(object sender, MouseEventArgs e)
{
  this.statusBar.Text = string.Format("X={0}, Y={1}", e.X, e.Y);
}


 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: GDI grab handles and mouse move Pin
leppie8-Jan-04 8:13
leppie8-Jan-04 8:13 
GeneralDO NOT HELP THIS PERSON WITH HIS HOMEWORK! Pin
leppie8-Jan-04 9:47
leppie8-Jan-04 9:47 
GeneralNon-rectangular Windows :: the 24-bit issue [advanced] Pin
nibmike8-Jan-04 7:07
nibmike8-Jan-04 7:07 
GeneralRe: Non-rectangular Windows :: the 24-bit issue [advanced] Pin
Heath Stewart8-Jan-04 7:29
protectorHeath Stewart8-Jan-04 7:29 
GeneralRe: Non-rectangular Windows :: the 24-bit issue [advanced] Pin
leppie8-Jan-04 8:17
leppie8-Jan-04 8:17 
GeneralGenerating strings that are matched by a regex Pin
bnieland8-Jan-04 6:34
bnieland8-Jan-04 6:34 
GeneralRe: Generating strings that are matched by a regex Pin
Kentamanos8-Jan-04 6:58
Kentamanos8-Jan-04 6:58 
GeneralRe: Generating strings that are matched by a regex Pin
leppie8-Jan-04 7:04
leppie8-Jan-04 7:04 
GeneralRe: Generating strings that are matched by a regex Pin
bnieland8-Jan-04 7:25
bnieland8-Jan-04 7:25 
GeneralMicrosoft Animation Control Pin
obelisk298-Jan-04 4:13
obelisk298-Jan-04 4:13 
GeneralRe: Microsoft Animation Control Pin
Niels Penneman8-Jan-04 6:19
Niels Penneman8-Jan-04 6:19 
GeneralRe: Microsoft Animation Control Pin
Heath Stewart8-Jan-04 6:23
protectorHeath Stewart8-Jan-04 6:23 
GeneralRe: Microsoft Animation Control Pin
obelisk298-Jan-04 10:45
obelisk298-Jan-04 10:45 
GeneralInheriting from DirectX problem ! Pin
pahluwalia8-Jan-04 2:49
pahluwalia8-Jan-04 2:49 
GeneralRe: Inheriting from DirectX problem ! Pin
obelisk298-Jan-04 4:17
obelisk298-Jan-04 4:17 
GeneralRe: Inheriting from DirectX problem ! Pin
pahluwalia8-Jan-04 5:51
pahluwalia8-Jan-04 5:51 
GeneralRe: Inheriting from DirectX problem ! Pin
Kentamanos8-Jan-04 5:52
Kentamanos8-Jan-04 5:52 

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.