private void surfaceDessin_MouseMove(object sender, MouseEventArgs e) { Point p = e.GetPosition(surfaceDessin); textBlockPosition.Text = Math.Round(p.X) + ", " + Math.Round(p.Y) + "px"; if (clicked) { DrawingAttributes attributes = new DrawingAttributes(); // get attributes StylusPoint stylusPoint = new StylusPoint(p.X, p.Y, (float)0.5); StylusTip stylusTip = this.surfaceDessin.DefaultDrawingAttributes.StylusTip; Color color = this.surfaceDessin.DefaultDrawingAttributes.Color; double width = this.surfaceDessin.DefaultDrawingAttributes.Width; double height = this.surfaceDessin.DefaultDrawingAttributes.Height; // send to server ImagePoint pCoord = new ImagePoint(p.X, p.Y); string action = ""; DrawPoint_Server segment = null; if (GlobalUser.OutilSelectionnee == "crayon" || GlobalUser.OutilSelectionnee == "efface_segment") { action = "ADD"; this.trait.Add(p); segment = new DrawPoint_Server("DRAW", action, this.traits.Count, new PointParams(stylusTip.ToString(), color.ToString(), width, height), pCoord); } else { action = "DEL"; int index = 0; foreach (var elem in traits) { foreach (var po in elem) { if (p.X >= po.X - 6 && p.X <= po.X + 6 && p.Y >= po.Y - 6 && p.Y <= po.Y + 6) { segment = new DrawPoint_Server("DRAW", action, index, new PointParams(stylusTip.ToString(), color.ToString(), width, height), pCoord); this.surfaceDessin.Strokes[index].DrawingAttributes.Color = System.Windows.Media.Color.FromArgb(255, 255, 255, 255); break; } } index++; } } if (segment != null && !activateTuto) { var image = JsonConvert.SerializeObject(segment); SocketService.MySocket.Emit("draw", image); } } }