Click here to Skip to main content
15,884,176 members
Home / Discussions / C#
   

C#

 
AnswerRe: ScrollBar in Listview Pin
Abhijit Jana25-Jul-09 9:18
professionalAbhijit Jana25-Jul-09 9:18 
QuestionHelp with WIA scanning control. Pin
CodeBase2525-Jul-09 6:31
CodeBase2525-Jul-09 6:31 
Questiondatabound comboboxes in datagridview. Pin
tonks8425-Jul-09 6:27
tonks8425-Jul-09 6:27 
AnswerRe: databound comboboxes in datagridview. Pin
Omar Akhtar Sheikh25-Jul-09 8:29
Omar Akhtar Sheikh25-Jul-09 8:29 
GeneralRe: databound comboboxes in datagridview. Pin
tonks8425-Jul-09 8:54
tonks8425-Jul-09 8:54 
Question[Message Deleted] Pin
neha_rai25-Jul-09 5:36
neha_rai25-Jul-09 5:36 
Answerwaiting for reply Pin
neha_rai25-Jul-09 9:13
neha_rai25-Jul-09 9:13 
AnswerRe: moving points Pin
Henry Minute25-Jul-09 13:20
Henry Minute25-Jul-09 13:20 
To enable clearing your points simply add a call to Invalidate() to the end of your button2_Click() event handler.

private void button2_Click(object sender, EventArgs e)
{
    points.Clear();
    this.Invalidate();
}


Whilst on the subject of painting, for what you are trying to to do you do not need to override the OnPaint() method, simply handle the Paint event of your form.

As far as moving the points is concerned the procedure will be the same as moving any drawing object.

1) Handle the MouseDown event, in it decide if the mouse location (e.Location) is at a point of interest. If so, make a note of the point1 and then set a boolean flag to true (call the flag something like 'moving' so that its name reminds you of what it's for, and take a note of the current position of the mouse in a class scope field (it will be needed in several places), of type Point, something like this.moveStartPoint = e.Location.

2) Handle the MouseUp event, in it set the flag ('moving') to false, and the moveStartPoint to null and call this.Invalidate()

3) Handle the MouseMove event, in it first check that 'moving' is true (this means that the mouse is still down). If not return. If it is true then set the point that you made a note of in 1)1 to the new location of the mouse. As you are only moving a point you can set it directly but if you were moving a 'shape' fro example, you would have to use something like
storedPoint.X += (e.X - this.moveStartPoint.X);


Take a look at this[^], for a complete example of moving things you have drawn.

Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”

QuestionToolStrip Overflow button event Pin
satsumatable25-Jul-09 3:40
satsumatable25-Jul-09 3:40 
AnswerRe: ToolStrip Overflow button event Pin
satsumatable25-Jul-09 4:01
satsumatable25-Jul-09 4:01 
QuestionHuge amounts of ListView-Items in ListView. Performance? Pin
JackBeauregard25-Jul-09 2:55
JackBeauregard25-Jul-09 2:55 
AnswerRe: Huge amounts of ListView-Items in ListView. Performance? Pin
Eddy Vluggen25-Jul-09 3:17
professionalEddy Vluggen25-Jul-09 3:17 
AnswerRe: Huge amounts of ListView-Items in ListView. Performance? Pin
Jimmanuel25-Jul-09 3:20
Jimmanuel25-Jul-09 3:20 
AnswerRe: Huge amounts of ListView-Items in ListView. Performance? Pin
Adam Maras25-Jul-09 6:41
Adam Maras25-Jul-09 6:41 
QuestionAdd Properties to user control [modified] Pin
gal00025-Jul-09 2:52
gal00025-Jul-09 2:52 
AnswerRe: Add Properties to user control Pin
Henry Minute25-Jul-09 3:06
Henry Minute25-Jul-09 3:06 
AnswerRe: Add Properties to user control Pin
SajjadZare25-Jul-09 9:14
SajjadZare25-Jul-09 9:14 
Questionhow to keep track the browser. Pin
msgreat25-Jul-09 2:03
msgreat25-Jul-09 2:03 
QuestionGpuCV ? Pin
Mohammad Dayyan25-Jul-09 1:09
Mohammad Dayyan25-Jul-09 1:09 
AnswerRe: GpuCV ? Pin
Henry Minute25-Jul-09 3:09
Henry Minute25-Jul-09 3:09 
AnswerRe: GpuCV ? Pin
Mike Hankey25-Jul-09 3:54
mveMike Hankey25-Jul-09 3:54 
QuestionReading from Microsoft FingerPrint Pin
SimpleData25-Jul-09 1:08
SimpleData25-Jul-09 1:08 
AnswerRe: Reading from Microsoft FingerPrint Pin
Harvey Saayman25-Jul-09 1:30
Harvey Saayman25-Jul-09 1:30 
QuestionObject reference not set to an instance of an object. Pin
svt gdwl25-Jul-09 0:57
svt gdwl25-Jul-09 0:57 
AnswerRe: Object reference not set to an instance of an object. Pin
Henry Minute25-Jul-09 3:12
Henry Minute25-Jul-09 3:12 

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.