private System.Windows.Forms.Integration.WindowsFormsHost makeToolBoxGUIOItem(HMIConstants.guioNumber guioNumber) { //windowsFormHost는 WPF element또는 page 내부에 Windows Form contorl을 호스팅하기위해 사용한다. System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); host.HorizontalAlignment = HorizontalAlignment.Left; host.Height = 34; host.Width = 234; host.Margin = new Thickness(0, 1, 0, 0); host.VerticalAlignment = VerticalAlignment.Top; System.Windows.Forms.Label guioItem = new System.Windows.Forms.Label(); guioItem.Size = new System.Drawing.Size(234, 34); guioItem.MouseDown += guio_MouseDown; guioItem.Image = (Bitmap)rm.GetObject(HMIConstants.getGUIOName(guioNumber)); guioItem.Name = HMIConstants.getGUIOName(guioNumber); guioItem.AutoSize = false; guioItem.Refresh(); host.Name = HMIConstants.getGUIOName(guioNumber); host.Child = guioItem; return(host); }
private void guio_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { senderItem = HMIConstants.getGUIONumber(((System.Windows.Forms.Label)sender).Name); System.Windows.Forms.Label guio = (System.Windows.Forms.Label)sender; guio.DoDragDrop(guio, System.Windows.Forms.DragDropEffects.Move); }