文件拖拉代码

文件拖放 #region 文件拖放
                 private void FlashControl_DragEnter( object sender, DragEventArgs e)
                {
                         if (e.Data.GetDataPresent(DataFormats.FileDrop))
                        {
                                e.Effect = DragDropEffects.All;
                        }
                }

                 private void FlashControl_DragDrop( object sender, DragEventArgs e)
                {
                         string swf = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();

                         if (Path.GetExtension(swf).ToLower() == ".swf")
                        {
                                axShockwaveFlash1.Movie = swf;
                        }
                         else
                        {
                                MessageBox.Show( "文件必须是 swf 格式!");
                        }
                }
                #endregion

你可能感兴趣的:(代码,职场,文件,休闲,拖拉)