public LedSubareaHolder(LedSubarea pSubarea) { this.InitializeComponent(); this.subarea = pSubarea; this.lblLocation.Text = string.Empty; this.lblLocation.Visible = false; this.lblSize.Text = string.Empty; this.lblSize.Visible = false; this.moveType = LedSubareaMoveType.All; this.nowZoom = formMain.Ledsys.SelectedPanel.Zoom; this.maxWidth = (int)(formMain.Ledsys.SelectedPanel.Width * this.nowZoom); this.maxHeight = (int)(formMain.Ledsys.SelectedPanel.Height * this.nowZoom); this.ChangeZoom(); }
private void picSubarea_MouseUp(object sender, MouseEventArgs e) { this.tsmiDeleteSubarea.Text = formMain.ML.GetStr("UserControl_LedSubareaHolder_DeleteSubarea"); this.tsmiRefresh.Text = formMain.ML.GetStr("UserControl_LedSubareaHolder_Refresh"); this.picSubarea.Visible = true; this.lblLocation.Text = string.Empty; this.lblLocation.Visible = false; this.lblSize.Text = string.Empty; this.lblSize.Visible = false; if (this.isChangingSize) { this.HolderEvent(LedContentEventType.ChangeSize, this); this.Redraw(); } else if (this.isMoving && this.isMoved) { this.isMoved = false; this.HolderEvent(LedContentEventType.Moving, this); } this.isChangingSize = false; this.isMoving = false; this.moveType = LedSubareaMoveType.All; this.ResetHolderPosition(); }
private void picSubarea_MouseMove(object sender, MouseEventArgs e) { if (!this.isActivated) { this.Cursor = Cursors.Default; return; } if (e.Button == MouseButtons.Left) { this.picSubarea.Visible = false; this.lblLocation.Visible = true; this.lblSize.Visible = true; if (this.isMoving) { this.isMoved = true; base.Location = this.GetNewLocation(Cursor.Position); this.GetRealSizeAndLocation(); } else { this.GetNewSizeAndLocation(Cursor.Position); this.GetRealSizeAndLocation(); this.DrawBlackBackground(); } this.DrawLocation(); return; } if (e.X < 10 && e.Y < 10) { this.Cursor = Cursors.SizeNWSE; this.moveType = LedSubareaMoveType.LeftTop; return; } if (e.X < 10 && e.Y > base.Height - 10) { this.Cursor = Cursors.SizeNESW; this.moveType = LedSubareaMoveType.LeftBottom; return; } if (e.X < 10 && e.Y > base.Height / 2 - 5 && e.Y < base.Height / 2 + 5) { this.Cursor = Cursors.SizeWE; this.moveType = LedSubareaMoveType.LeftMiddle; return; } if (e.X > base.Width - 10 && e.Y < 10) { this.Cursor = Cursors.SizeNESW; this.moveType = LedSubareaMoveType.RightTop; return; } if (e.X > base.Width - 10 && e.Y > base.Height / 2 - 5 && e.Y < base.Height / 2 + 5) { this.Cursor = Cursors.SizeWE; this.moveType = LedSubareaMoveType.RightMiddle; return; } if (e.X > base.Width - 10 && e.Y > base.Height - 10) { this.Cursor = Cursors.SizeNWSE; this.moveType = LedSubareaMoveType.RightBottom; return; } if (e.X > base.Width / 2 - 5 && e.X < base.Width / 2 + 5 && e.Y < 10) { this.Cursor = Cursors.SizeNS; this.moveType = LedSubareaMoveType.MiddleTop; return; } if (e.X > base.Width / 2 - 5 && e.X < base.Width / 2 + 5 && e.Y > base.Height - 10) { this.Cursor = Cursors.SizeNS; this.moveType = LedSubareaMoveType.MiddleBottom; return; } this.Cursor = Cursors.SizeAll; this.moveType = LedSubareaMoveType.All; }