private void BusModule_ControlMoveEvent(object sender, ControlMoveEventArgs e) { _pb.Image = bitmap; m_g = Graphics.FromImage(bitmap); m_g.Clear(this.BackColor); bool bDrawHLine = false; foreach (var member in Controls) { ControlBase control = member as ControlBase; if (control != null) { if (bDrawHLine == false) { bDrawHLine = true; m_g.DrawLine(new Pen(m_hcLine.PenColor, m_hcLine.LineWidth), new PointF(m_hcLine.Left, m_hcLine.Top), new PointF(m_hcLine.Left + m_hcLine.Width, m_hcLine.Top)); } DrawLine(control); } } m_g.Flush(); m_g.Dispose(); _pb.Image = bitmap; }
private void RefushLine(object sender, ControlMoveEventArgs e) { if (e.info == "LeftMouseDown") { m_image = new Bitmap(this.Width, this.Height); Graphics g = Graphics.FromImage(m_image); g.Clear(this.BackColor); foreach (var member in this.Controls) { ControlBase control = member as ControlBase; if (control != null && control != (ControlBase)sender) { DrawLine(control, g); } } g.Dispose(); this.BackgroundImage = m_image; } else if (e.info == "LeftMouseUp") { m_image = new Bitmap(this.Width, this.Height); Graphics g = Graphics.FromImage(m_image); g.Clear(this.BackColor); foreach (var member in this.Controls) { ControlBase control = member as ControlBase; if (control != null) { DrawLine(control, g); } } g.Dispose(); this.BackgroundImage = m_image; } else if (e.info == "LeftMouseMove") { ControlBase controlBase = sender as ControlBase; controlBase.Left += e.MoveX; controlBase.Top += e.MoveY; } }