Exemplo n.º 1
0
		protected virtual void OnValidateMove(MoveEventArgs e) {
			if (ValidateMove != null)
				ValidateMove.Invoke(this, e);
		}
Exemplo n.º 2
0
		protected virtual void OnMove(MoveEventArgs e) {
			if (parent != null)
				parent.Invalidate();
			if (Move != null)
				Move.Invoke(this, e);
		}
Exemplo n.º 3
0
		void btnSlider_Move(object sender, MoveEventArgs e) {
			SkinLayer p = Skin.Layers["Control"];
			int size = btnSlider.Width;
			int w = Width - p.ContentMargins.Horizontal - size;
			int pos = e.Left;

			if (pos < p.ContentMargins.Left)
				pos = p.ContentMargins.Left;
			if (pos > w + p.ContentMargins.Left)
				pos = w + p.ContentMargins.Left;

			btnSlider.SetPosition(pos, 0);

			float px = (float)range / (float)w;
			Value = (int)(Math.Ceiling((pos - p.ContentMargins.Left) * px));
		}
Exemplo n.º 4
0
		private void MouseMoveProcess(MouseEventArgs e) {
			if (CheckPosition(e.Position) && !inside) {
				inside = true;
				Invalidate();
			} else if (!CheckPosition(e.Position) && inside) {
				inside = false;
				Invalidate();
			}

			PerformResize(e);

			if (!IsResizing && IsMoving) {
				int x = (parent != null) ? parent.AbsoluteLeft : 0;
				int y = (parent != null) ? parent.AbsoluteTop : 0;

				int l = e.Position.X - x - pressSpot.X - leftModifier;
				int t = e.Position.Y - y - pressSpot.Y - topModifier;

				if (!Suspended) {
					MoveEventArgs v = new MoveEventArgs(l, t, Left, Top);
					OnValidateMove(v);

					l = v.Left;
					t = v.Top;
				}

				if (outlineMoving) {
					OutlineRect = new Rectangle(l, t, OutlineRect.Width, OutlineRect.Height);
					if (parent != null)
						parent.Invalidate();
				} else {
					Left = l;
					Top = t;
				}
			}

			if (!Suspended) {
				OnMouseMove(TransformPosition(e));
			}
		}
Exemplo n.º 5
0
		void btnSlider_Move(object sender, MoveEventArgs e) {
			if (orientation == EOrientation.Horizontal) {
				int size = btnMinus.Width + Skin.Layers[strSlider].OffsetX;
				btnSlider.SetPosition(e.Left, 0);
				if (btnSlider.Left < size)
					btnSlider.SetPosition(size, 0);
				if (btnSlider.Left + btnSlider.Width + size > Width)
					btnSlider.SetPosition(Width - size - btnSlider.Width, 0);
			} else {
				int size = btnMinus.Height + Skin.Layers[strSlider].OffsetY;
				btnSlider.SetPosition(0, e.Top);
				if (btnSlider.Top < size)
					btnSlider.SetPosition(0, size);
				if (btnSlider.Top + btnSlider.Height + size > Height)
					btnSlider.SetPosition(0, Height - size - btnSlider.Height);
			}

			if (orientation == EOrientation.Horizontal) {
				int size = btnMinus.Width + Skin.Layers[strSlider].OffsetX;
				int w = (Width - 2 * size) - btnSlider.Width;
				float px = (float)(Range - PageSize) / (float)w;
				Value = (int)(Math.Ceiling((btnSlider.Left - size) * px));
			} else {
				int size = btnMinus.Height + Skin.Layers[strSlider].OffsetY;
				int h = (Height - 2 * size) - btnSlider.Height;
				float px = (float)(Range - PageSize) / (float)h;
				Value = (int)(Math.Ceiling((btnSlider.Top - size) * px));
			}
		}