Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Directives
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- #endregion
- #region Browse
- /* Copyright & Contact
- * --------------------------------------------------------------------------------<
- * Tool Name : Drag Control *
- * From Project : Creator Eye *
- * Project Lang : C# *
- * Creator : Yassine Abbani *
- * Facebook : https://www.facebook.com/YassineAbbani.user *
- * Pastebin : https://pastebin.com/u/Yassine_Abbani *
- * Youtube : https://www.youtube.com/channel/UCqvOCRs3HWbPH4yuZuTx8mw *
- * Version : 1.0 Beta *
- *>--------------------------------------------------------------------------------<
- */
- /* Features
- * ------------------------
- * Custom Properties:
- * Select control > Get select a panel into drag control Properties and start your project then move (that panel) where you want.
- */
- /* history
- * ------------------------
- * 1.0 (23 May 2018):
- * In my Source Code Get Drag Control Component code and use it at your project to drag any panel to any location you want.
- *
- */
- #endregion
- #region DragControl
- class Ce_DragControl : Component
- {
- #region Variables
- private Control handleControl;
- #endregion
- #region Properties
- public Control SelectControl
- {
- get
- {
- return this.handleControl;
- }
- set
- {
- this.handleControl = value;
- this.handleControl.MouseDown += new MouseEventHandler(this.DragForm_MouseDown);
- }
- }
- #endregion
- #region Method
- [DllImport("user32.dll")]
- public static extern int SendMessage(IntPtr a, int msg, int wParam,int lParam);
- [DllImport("user32.dll")]
- public static extern bool ReleaseCapture();
- #endregion
- #region Event Method
- private void DragForm_MouseDown(object sender, MouseEventArgs e)
- {
- bool flage = e.Button == MouseButtons.Left;
- if (flage)
- {
- Ce_DragControl.ReleaseCapture();
- Ce_DragControl.SendMessage(this.SelectControl.FindForm().Handle,161,2,0);
- }
- }
- #endregion
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement