Click to See Complete Forum and Search --> : help, CreateGrahics not functioning correctly


hcj
June 25th, 2005, 07:37 AM
Hi all,
my sir give me a sample source code of drag and drop, but what i found is, after the first drag and drop, its not functioning correctly, it seems to be a problem cause by the CreateGraphics method, i wil attached the source code along with the post, can anyone teach me what is the actual problem and how to solve it?

Thank you, any help will be appreciated.

darwen
June 25th, 2005, 07:02 PM
Have you ever thought about debugging your code yourself ?

All you need to do is to put breakpoints in the code and then after setting the build to "debug" hit F5.

To put a breakpoint on a line of code hit F9. To clear all breakpoints (in VS2003) I believe it's ctrl-shift-F9. Or Ctrl+Alt+B will bring up the breakpoint window.

The code will stop at your breakpoints and then you'll be able to solve this yourself.

And in answer to your question it's very, very unlikely that CreateGraphics will cause a problem in drag and drop.

Consider each task as a series of sub-tasks. I.e. get your application to do what it needs to do first, then add drag and drop support.

One aspect of programming is prioritisation - i.e. one thing must be done before another thing can happen.

If necessary draw diagrams for yourself... but you should be using object oriented design to write C# applications and if you don't you'll get really messed up.

Darwen.

hcj
June 25th, 2005, 11:19 PM
than you drawen,
yeah, its actually not the problem from CreateGraphics I found now, its seems to be after using the translate method, the region original coordinate seems doesn't changed.. Am I right?

I have check with my lecturer, he said this source code are copy from a book.

i'm not very sure what the translate do, i have check the msdn, but still not very sure, is it mean its just switch the image from inside but remain the cordinates un change?

hcj
June 25th, 2005, 11:35 PM
Sorry, my mistake, its seems not the translate method fault also, still looking through it.

hcj
June 26th, 2005, 12:14 AM
Sorry, i think it may be cause by the graphicspath, since i use Rectangle in the region then everything works find, but is there anyway to solved it if i want a triangle shape (polygon) to be done here?