private void Draw(object[] stringArray, Color clientColor) { using (Graphics graphics = Graphics.FromImage(DrawBox.Image)) { if (stringArray[4].ToString() == "True") { graphics.DrawLine(new Pen(Color.White, 1), new Point(Convert.ToInt32(stringArray[0]), Convert.ToInt32(stringArray[1])), new Point(Convert.ToInt32(stringArray[2]), Convert.ToInt32(stringArray[3]))); } else { graphics.DrawLine(new Pen(clientColor, 1), new Point(Convert.ToInt32(stringArray[0]), Convert.ToInt32(stringArray[1])), new Point(Convert.ToInt32(stringArray[2]), Convert.ToInt32(stringArray[3]))); } } foreach (StreamWriter streamWriter in streamWriters) { if (stringArray[4].ToString() == "True") { string dataString = stringArray[0] + "." + stringArray[1] + "." + stringArray[2] + "." + stringArray[3] + "." + Color.White.Name; streamWriter.WriteLine(dataString); } else { string dataString = stringArray[0] + "." + stringArray[1] + "." + stringArray[2] + "." + stringArray[3] + "." + clientColor.Name; streamWriter.WriteLine(dataString); } Thread.Sleep(1); streamWriter.Flush(); } DrawBox.Invalidate(); }
private void Draw(object[] stringArray) { using (Graphics graphics = Graphics.FromImage(DrawBox.Image)) { graphics.DrawLine(new Pen(Color.FromName((string)stringArray[4]), 1), new Point(Convert.ToInt32(stringArray[0]), Convert.ToInt32(stringArray[1])), new Point(Convert.ToInt32(stringArray[2]), Convert.ToInt32(stringArray[3]))); } DrawBox.Invalidate(); }
private void DrawLine(Factory.IAbstractFactory factory) { Brush.IBrush brush = factory.CreateBrush(); brush.SetGraph(g); brush.SetColor(currentColor); brush.SetSize(size); brush.Draw(g, prevPoint, currentPoint); DrawBox.Invalidate(); }
private void DrawBox_MouseMove(object sender, MouseEventArgs e) { if (isMouseDown == true && originPoint != null) { SendData(originPoint.X.ToString(), originPoint.Y.ToString(), e.Location.X.ToString(), e.Location.Y.ToString()); DrawBox.Invalidate(); originPoint = e.Location; } }
/// <summary> /// Updates particles and cleans up particle array /// </summary> public void ParticleLifeCycle() { try { for (;;) { Thread.Sleep(20); _manager.UpdateParticles(); Invoke((MethodInvoker)(() => { DrawBox.Invalidate(); DrawBox.Update(); })); } } catch (ThreadAbortException ex) { Debug.Print("Particle display Thread aborted."); } }