private void Form1_Load(object sender, EventArgs e) { string basePath = @"C:\GitHub\ActionEngine\src\Engine\Demo\Contents\Models"; string[] files = Directory.GetFiles(basePath); for (int i = 0; i < files.Length; i++) { string fileName = Path.GetFileName(files[i]); if (Path.GetExtension(files[i]) == ".amt") { ucViewport vp = new ucViewport(); vp.Width = 200; vp.Height = 200; vp.InitializeVP(); vp.Active = true; vp.AddModel(fileName); vp.Information = fileName; vp.MouseDown += new MouseEventHandler(vp_MouseDown); _vps.Add(vp); } } flpVpsContainer.Controls.AddRange(_vps.ToArray()); }
void vp_MouseDown(object sender, MouseEventArgs e) { ucViewport vp = sender as ucViewport; vp.DoDragDrop(vp.Information, DragDropEffects.Copy); }