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

タイトル Re^2: ドラッグアンドドロップで悩んでいます・・・
投稿日: 2006/01/17(Tue) 16:32
投稿者ふき
[OSのVer]:Windows XP   [VBのVer]:VB.NET  

花ちゃんさん、お返事ありがとうございます。

> 色の合成
> 赤(255,0,0)+青(0,0,255)=マゼンタ(255,0,255) (128,0,128)
>
> 赤(r1,g1,b1) + 青(r2,g2,b2) =(r1+r2\2,g1+g2\2,b1+b2\2) マゼンタ になります。

本当にありがとうございます。

> 試して見て自分の意図する動作で問題なく動けばいいのでは。
> 私の行く所はここでいいのですか? と聞いているように聞こえます。
> 又、上手く行かないでは見ている人はどう上手くいかないのか解りません
> 質問する場合は、自分が答える立場で読んで解る様に具体的に書いて下さい。

大変申し訳ありません。
次からは気をつけたいと思います・・・。

恐縮ながら、
今までやってみたところのコードを書かせていただきます。

PictureBox1についてです。

Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
            PictureBox3.AllowDrop = True
            Dim red As Integer
            red = RGB(255, 0, 0)
            PictureBox1.BackColor = ColorTranslator.FromWin32(red)
            PictureBox1.DoDragDrop(ColorTranslator.ToWin32(PictureBox1.BackColor).ToString,
DragDropEffects.Copy)
        End Sub




PictureBox2についてです。

Private Sub PictureBox2_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseDown
            PictureBox3.AllowDrop = True
            Dim blue As Integer
            blue = RGB(0, 0, 255)
            PictureBox2.BackColor = ColorTranslator.FromWin32(blue)
            PictureBox2.DoDragDrop(ColorTranslator.ToWin32(PictureBox2.BackColor).ToString,
DragDropEffects.Copy)
        End Sub





PictureBox3のドラッグアンドドロップについてです。

        Private Sub PictureBox3_DragDrop(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles PictureBox3.DragDrop

            PictureBox3.AllowDrop = True
            Dim red, blue, Magenta As Integer
            red = RGB(255, 0, 0)
            blue = RGB(0, 0, 255)
            Magenta = RGB(255, 0, 255)

            If PictureBox3.BackColor = System.Drawing.Color.White Then
                If e.Data.GetDataPresent(DataFormats.Text) = RGB(255, 0, 0) Then
                    PictureBox3.BackColor = ColorTranslator.FromWin32(red)
                End If
            End If


            If PictureBox3.BackColor = System.Drawing.Color.Red Then
                If e.Data.GetDataPresent(DataFormats.Text) = RGB(0, 0, 255) Then
                    'e.Effect = DragDropEffects.Copy

                    PictureBox3.BackColor = ColorTranslator.FromWin32(Magenta)
                    'e.Effect = DragDropEffects.None


                End If
            End If
        End Sub

        Private Sub PictureBox3_DragEnter(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles PictureBox3.DragEnter
            PictureBox3.AllowDrop = True
            Dim red, blue, Magenta As Integer
            red = RGB(255, 0, 0)
            blue = RGB(0, 0, 255)
            Magenta = RGB(255, 0, 255)

            If PictureBox3.BackColor = System.Drawing.Color.White Then
                    If e.Data.GetDataPresent(DataFormats.Text) = RGB(255, 0, 0) Then
                        PictureBox3.BackColor = ColorTranslator.FromWin32(red)
                End If
            End If


            If PictureBox3.BackColor = System.Drawing.Color.Red Then
                If e.Data.GetDataPresent(DataFormats.Text) = RGB(0, 0, 255) Then
                    'e.Effect = DragDropEffects.Copy

                    PictureBox3.BackColor = ColorTranslator.FromWin32(Magenta)
                    'e.Effect = DragDropEffects.None


                End If
            End If
        End Sub

このようにしてみたのですが、
PictureBox1、PictureBox2で取得した色が、
上手くPictureBox3でMagentaの色になったり、
ドラッグアンドドロップが上手くいきません・・・。

大変申し訳ありませんが、
ご教授お願いできませんか?
よろしくお願いいたします。

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

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