xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 28KB
    文件類型: .7z
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-06-05
  • 語言: C#
  • 標簽: C#??容器??鼠標??拖動??控件??

資源簡介

C# 容器之間的控件拖動: 1. 從左邊容器(GroupBox)中的Lable,TextBox,拖到右邊的 GroupBox中,并可以在右邊GroupBox區(qū)域中進行移動該控件及變動寬度和高度。 2.從左邊容器(GroupBox)中Button,拖到右邊的GroupBox區(qū)域后,重新創(chuàng)建一個Button,并不移動之前的Button, 新創(chuàng)建的Button可在該區(qū)域移動、改變寬度和高度。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;

namespace?GroupBoxMove
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????grbRight.AllowDrop?=?true;
????????????//CaptionHeight?=?40;
???????????
????????}

????????///?
????????///?拖動的控件;?可在此處修改
????????///?

????????private?int?n_Type?=?0;

????????private?void?label1_MouseDown(object?sender?MouseEventArgs?e)
????????{
????????????n_Type?=?1;
????????????label1.DoDragDrop(sender?DragDropEffects.Move);
????????}

????????private?void?textBox1_MouseDown(object?sender?MouseEventArgs?e)
????????{
????????????n_Type?=?2;
????????????textBox1.DoDragDrop(sender?DragDropEffects.Move);
????????}

????????private?void?button1_MouseDown(object?sender?MouseEventArgs?e)
????????{
????????????n_Type?=?3;
????????????button1.DoDragDrop(sender?DragDropEffects.Move);
????????}


????????private?void?grbRight_DragDrop(object?sender?DragEventArgs?e)
????????{
????????????Control?col?=?(Control)sender;

????????????int?nW?=?(this.Width?-?this.ClientRectangle.Width)?/?2;

????????????Point?pC?=?new?Point(this.Location.X?+?nW?+?col.Location.X?this.Location.Y?+?col.Location.Y?+?this.Height?-?this.ClientRectangle.Height?-?nW);
????????????Point?p?=?new?Point(e.X?-?pC.X?e.Y?-?pC.Y);
????????????switch?(n_Type)
????????????{
????????????????case?1:
????????????????????grbLeft.Controls.Remove(label1);
????????????????????grbRight.Controls.Add(label1);
????????????????????label1.MouseDown?-=?new?MouseEventHandler(label1_MouseDown);
????????????????????label1.Location?=?p;
????????????????????MoveControl?label?=?new?MoveControl(label1);
????????????????????break;
????????????????case?2:
????????????????????grbLeft.Controls.Remove(textBox1);
????????????????????grbRight.Controls.Add(textBox1);
????????????????????textBox1.Location?=?p;
????????????????????textBox1.MouseDown?-=?new?MouseEventHandler(textBox1_MouseDown);
????????????????????MoveControl?textBox?=?new?MoveControl(textBox1);
????????????????????break;
????????????????case?3:
????????????????????Button?btn?=?new?Button();
????????????????????btn.Text?=?“New“;
????????????????????grbRight.Controls.Add(btn);
????????????????????btn.Location?=?p;
????????????????????MoveControl?button?=?new?MoveControl(btn);
????????????????????break;



????????????}

????????}

????????private?void?grbRight_DragEnter(object?sender?DragEventArgs?e)
????????{
????????????e.Effect?=?DragDropEffects.Move;

????????}
????}
}

評論

共有 條評論