tagCANDY CGI VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
[ツリー表示へ]  [ワード検索]  [Home]

タイトル Re^3: Drag&DropでDrag元のショートカットのリンク先取得
投稿日: 2008/01/18(Fri) 08:32
投稿者y4yama
横レスで失礼します
> AllowDrop プロパティの設定はしています。

> また、DragDropのイベントでWshShortcutをどのように使ったら良いのでしょうか。
不要?のようです
> 今回、DragDropをはじめて使うので分からない事だらけで、Googleでも色々検索したのですが・・・
F1のHelpでもTextについては出てきますよね

Testだけですが、下記にて XP、VB2005ExpressEdition では動きました
Vistaでは、どうでしょうか・・

    Private Sub Button6_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Button6.DragDrop
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            'ドロップされたデータを取得
            Dim itemObj As Object = e.Data.GetData(DataFormats.FileDrop)
            Console.WriteLine(" DragDroped:" & itemObj(0).ToString)
        End If
    End Sub

    Private Sub Button6_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Button6.DragEnter
        Console.WriteLine("fire Enter")  '<<--Vistaで、これは出るでしょうか?
        Console.WriteLine("e.AllowedEffect=" & e.AllowedEffect)
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then

            If (e.AllowedEffect And DragDropEffects.Copy) = _
               DragDropEffects.Copy Then
                e.Effect = DragDropEffects.Copy
            Else
                e.Effect = DragDropEffects.None
            End If
        End If
    End Sub
電卓のアイコンをCtrlキーを押しながらButton6にDragします。ショートカット名
DragDroped:C:\Documents and Settings\xxxxxx1yama\デスクトップ\電卓.lnk
と表示しました

- 関連一覧ツリー をクリックするとツリー全体を一括表示します)

古いスレッドにレスはつけられません。