Exemple #1
0
        // 챔피언, 아이템 마우스 다운
        private void Champion_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pictureBox = (PictureBox)sender;

            pictureBox.Select();
            pictureBox.DoDragDrop(pictureBox.Image, DragDropEffects.Copy);
        }
        void carreau_MouseDown(object sender, MouseEventArgs e)
        {
            // sauvegarder le carreau de départ
            picFrom = sender as PictureBox;
            imgFrom = picFrom.Image;

            // terminer s'il n'y a pas de pièce sur le carreau
            if (imgFrom == null)
            {
                return;
            }

            // informations sur la pièce contenue dans le carreau
            InfoPiece piece = imgFrom.Tag as InfoPiece;

            // terminer si la partie n'est pas active ou si la couleur de la piece selectionnée ne corresponde pas à la couleur du joueur qui joue dans ce tours
            if (status.etat == EtatPartie.Reset || status.etat == EtatPartie.Mat || status.couleur != piece.couleur)
            {
                return;
            }

            // calculer les indices des carreaux de départ et arrivée
            int idxFrom = Convert.ToInt32(picFrom.Tag);

            // transformer les indices lineaires en numeros de rangée et colonne
            int x1 = idxFrom % 8;        // colonne du carreau de départ
            int y1 = (idxFrom - x1) / 8; // rangée du carreau de départ

            availableMoves = ((Partie)jeu).AvailableMoves(((Partie)jeu).echiquier.Cases[x1, y1].linkedPiece);
            DisplayHints();
            // demarrer le Drag & Drop
            picFrom.DoDragDrop(imgFrom, DragDropEffects.Move);

            // remettre le curseur
            pnlEdging.Cursor = Cursors.Default;

            // remettre l'image sur le carreau de départ
            picFrom.Image       = imgFrom;
            picFrom.BorderStyle = BorderStyle.None;

            // terminer s'il n'y a pas de carreau cible
            if (picTo == null)
            {
                ResetHintColors();
                return;
            }

            // calculer les indices des carreaux de départ et arrivée
            int idxTo = Convert.ToInt32(picTo.Tag);

            // transformer les indices lineaires en numeros de rangée et colonne
            int x2 = idxTo % 8;          // colonne du carreau d'arrivée
            int y2 = (idxTo - x2) / 8;   // rangée du carreau d'arrivée

            // reset du carreau cible
            picTo = null;

            // invoquer l'operation << DeplacerPiece >>
            DeplacerPiece(x1, y1, x2, y2);
        }
Exemple #3
0
 //событие на зажатие кнопки, начала drag'n'drop
 private void pb_MouseDown(object sender, MouseEventArgs e)
 {
     movingPB = sender as PictureBox;
     dx       = e.X;
     dy       = e.Y;
     movingPB.DoDragDrop(movingPB, DragDropEffects.Move);
 }
Exemple #4
0
        //동적 생성 컨트롤의 클릭/ 더블클릭 이벤트
        // pic 마우스다운 이벤트
        private void pic_MouseDown(object sender, MouseEventArgs e)
        {
            if (isGameEnd(Convert.ToInt32(nudCnt.Value)))
            {
                return;
            }

            if (e.Button == MouseButtons.Left)
            {
                PictureBox pic = (PictureBox)sender;

                //invoke the drag and drop operation
                if (isDragPic(pic))
                {
                    m_strDragTag = pic.Tag.ToString();

                    // 우선 모든 Panel의 AllowDrop을 true로 한다.
                    panLeft.AllowDrop   = true;
                    panCenter.AllowDrop = true;
                    panRight.AllowDrop  = true;

                    // 현재 클릭한 pic의 부모 panel은 false로 한다.
                    GetPanCtrl(pic.Tag.ToString()).AllowDrop = false;

                    pic.DoDragDrop(pic.Image, DragDropEffects.Move);
                }
                else
                {
                    m_strDragTag = "";
                }
            }
        }
        private void mover(PictureBox pictureBox)
        {
            origen = pictureBox.Parent.Name.ToString();
            /*MessageBox.Show(origen);*/
            pictureBox.DoDragDrop(pictureBox, DragDropEffects.Move);

            if (setPosition(pictureBox, origen))
            {
                switch (origen)
                {
                case "panel2":
                    pictureBox.Parent = panel2;
                    break;

                case "panel6":
                    pictureBox.Parent = panel6;
                    break;

                case "panel7":
                    pictureBox.Parent = panel7;
                    break;
                }
            }
            pictureBox.BringToFront();
        }
        private void pecaMD_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pecamd = (PictureBox)sender;

            posicaoAnterior = tabuleiro.GetPositionFromControl(pecamd);
            pecamd.DoDragDrop(pecamd, DragDropEffects.Move);
        }
        private bool TryMakeDragDropPKM(PictureBox pb, bool encrypt, PKM pkx, string newfile, out bool external)
        {
            File.WriteAllBytes(newfile, encrypt ? pkx.EncryptedBoxData : pkx.DecryptedBoxData);
            var img = (Bitmap)pb.Image;

            SetCursor(new Cursor(img.GetHicon()), pb);
            pb.Image           = null;
            pb.BackgroundImage = Resources.slotDrag;
            // Thread Blocks on DoDragDrop
            DragInfo.CurrentPath = newfile;
            DragDropEffects result = pb.DoDragDrop(new DataObject(DataFormats.FileDrop, new[] { newfile }), DragDropEffects.Move);

            external = !DragInfo.Source.IsValid || result != DragDropEffects.Link;
            if (external || DragInfo.SameSlot || result != DragDropEffects.Link) // not dropped to another box slot, restore img
            {
                pb.Image           = img;
                pb.BackgroundImage = OriginalBackground;
            }

            if (result == DragDropEffects.Copy)    // viewed in tabs or cloned
            {
                if (!DragInfo.Destination.IsValid) // apply 'view' highlight
                {
                    SetColor(DragInfo.Source.Box, DragInfo.Source.Slot, Resources.slotView);
                }
                external = false;
            }
            return(true);
        }
        private void pbSprite_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pb   = (PictureBox)(sender);
            DataObject data = new DataObject();

            data = new DataObject(DataFormats.Serializable, frmpkm);
            pb.DoDragDrop(data, DragDropEffects.Move);
            MemoryMappedFile MemoryMapped = MemoryMappedFile.OpenExisting("name", MemoryMappedFileRights.FullControl);

            using (MemoryMappedViewAccessor FileMap = MemoryMapped.CreateViewAccessor())
            {
                PKMDS.Pokemon otherpkm = new PKMDS.Pokemon();
                FileMap.ReadArray <byte>(0, otherpkm.Data, 0, 136);
                if (otherpkm.SpeciesID == 0)
                {
                    FileMap.Dispose();
                    return;
                }
                UInt16 frmpkmcheck   = BitConverter.ToUInt16(frmpkm.Data, 0x06);
                UInt16 otherpkmcheck = BitConverter.ToUInt16(otherpkm.Data, 0x06);
                if (frmpkmcheck == otherpkmcheck)
                {
                    FileMap.Dispose();
                    return;
                }
                frmpkm.Data    = otherpkm.Data;
                lblData.Text   = frmpkm.SpeciesName;
                pbSprite.Image = frmpkm.Sprite;
            }
        }
Exemple #9
0
        void choice_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pbox = (PictureBox)sender;

            pbox.DoDragDrop(pbox, DragDropEffects.Move);
            //MessageBox.Show("mouse down");
        }
Exemple #10
0
        private void furniture_MouseDown(object sender, MouseEventArgs e)
        {
            Console.WriteLine("mouse down");
            resetHelperButtons();

            //get furniture type
            PictureBox furnitureIcon = (PictureBox)sender;
            int        furnitureType;

            Int32.TryParse((string)furnitureIcon.Tag, out furnitureType);
            selectedFurniture = Furniture.getFurniture(furnitureType);

            //show available spots
            int j = getDoorPictureIndex();

            for (int i = 0; i < _dropboxes.Length; i++)
            {
                if (i != j)
                {
                    _dropboxes[i].First.Visible = true;
                }
            }
            //send furniture

            furnitureIcon.DoDragDrop(furnitureIcon.Image, DragDropEffects.Copy);
        }
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pb = (PictureBox)sender;

            pb.Select();
            pb.DoDragDrop(pb.Image, DragDropEffects.Copy);
        }
Exemple #12
0
        private void pictureBox2_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pb = sender as PictureBox;

            pbCache = pb;
            pb.DoDragDrop(pb.Image, DragDropEffects.Copy);
        }
Exemple #13
0
        private void pictureBox_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pb = (PictureBox)sender;

            pb.Select();
            pb.DoDragDrop(pb.Image, DragDropEffects.Move);
            pictureBox_RemovePicture(sender, e);
        }
Exemple #14
0
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pb = sender as PictureBox;

            tmpImage = pb.Image;
            tempBox  = pb;
            pb.DoDragDrop(pb, DragDropEffects.Copy);
        }
Exemple #15
0
 private void OnPictureMouseMove(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         PictureBox picture = sender as PictureBox;
         picture.DoDragDrop(picture, DragDropEffects.Move);
     }
 }
Exemple #16
0
        // 배치칸 마우스 다운
        private void Arrangement_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pictureBox = (PictureBox)sender;

            pictureBox.Select();
            pictureBox.DoDragDrop(pictureBox.Image, DragDropEffects.Move);
            pictureBox.Image = null;
        }
Exemple #17
0
        /*private void invPic_Click(object sender, EventArgs e)
         * {
         *  PictureBox currentPic = (PictureBox)sender;
         *  int i = Convert.ToInt32(currentPic.Name.Substring(6, 1));
         *  int j = Convert.ToInt32(currentPic.Name.Substring(8, currentPic.Name.Length - 8));
         *  MessageBox.Show(String.Format("{0}\n{1}\n{2}", currentPic.Name, "Row: " + i, "Column: " + j));
         * }*/

        private void pic_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                currentSource = (PictureBox)sender;
                currentSource.DoDragDrop(currentSource.Image, DragDropEffects.Move);
            }
        }
Exemple #18
0
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox handPB = (PictureBox)sender;

            indexOfDominoInPlay = userHandPBs.IndexOf(handPB);
            userDominoInPlay    = userHand[indexOfDominoInPlay];

            handPB.DoDragDrop(userDominoInPlay, DragDropEffects.Move);
        }
 private void IMouseMove(object sender, MouseEventArgs e) //перетаскивание таракана по полю
 {
     if (e.Button == MouseButtons.Left)
     {
         PictureBox picture = sender as PictureBox;
         picture.Tag = new Point(e.X, e.Y);                //запоминаем координаты мыши на момент начала перетаскивания
         picture.DoDragDrop(sender, DragDropEffects.Move); //начинаем перетаскивание ЧЕГО и с КАКИМ ЭФФЕКТОМ
     }
 }
Exemple #20
0
 private void IMouseMove(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         PictureBox picture = sender as PictureBox;
         picture.Tag = new Point(picture.Location.X + e.X + 1, picture.Location.Y + e.Y + 1); //запоминаем координаты мыши в момент начала перетаскивания
         picture.DoDragDrop(sender, DragDropEffects.Move);                                    //начинаем перетаскивание ЧЕГО и с КАКИМ ЭФФЕКТОМ
     }
 }
Exemple #21
0
        private void GridPB_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pb = (PictureBox)sender;

            if (pb.Tag != null)
            {
                pb.DoDragDrop((IDraggable)pb.Tag, DragDropEffects.Move);
            }
        }
Exemple #22
0
 private void PictureBox_MouseDown(Object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         movingCard    = (PictureBox)sender;
         flpMovingFrom = (FlowLayoutPanel)movingCard.Parent;
         movingCard.DoDragDrop(movingCard.Image, DragDropEffects.Move);
     }
 }
Exemple #23
0
 private void pic_MouseMove(object sender, MouseEventArgs e)
 {
     temppic_   = sender as PictureBox;
     imagefile_ = temppic_.ImageLocation;
     if (e.Button == MouseButtons.Left)
     {
         temppic_.DoDragDrop(temppic_.Image, DragDropEffects.All);
     }
 }
        private void pecaBQ_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pecabq = (PictureBox)sender;

            pecabq.Image = Properties.Resources.peçadabqcombrilho;

            posicaoAnterior = tabuleiro.GetPositionFromControl(pecabq);
            pecabq.DoDragDrop(pecabq, DragDropEffects.Move);
        }
 private void pictTurno_MouseDown(object sender, MouseEventArgs e)
 {
     if (cambiojug == true)
     {
         PictureBox pb = (PictureBox)sender;
         pb.Select();
         pb.DoDragDrop(pb.Image, DragDropEffects.Copy);
     }
     cambiojug = true;
 }
 void framecontrol_MouseMove(object sender, MouseEventArgs e)
 {
     if (mMouseDown && e.Button == MouseButtons.Left)
     {
         mMouseDown = false;
         PictureBox pb    = (PictureBox)sender;
         int        field = e.X / (pb.Size.Width / mFrames);
         pb.DoDragDrop(field, DragDropEffects.Copy);
     }
 }
Exemple #27
0
        private void RakamKutu_MouseDown(object sender, MouseEventArgs e)
        {
            // Sürükleme işleminin başladığı kutunun referansını veri olarak sakla
            PictureBox kaynakKutu = sender as PictureBox;

            if (kaynakKutu != null)
            {
                kaynakKutu.DoDragDrop(kaynakKutu, DragDropEffects.Move);
            }
        }
Exemple #28
0
        // L'evento indica la pressione del pulsante del mouse (quindi sottintende
        // l'inizio dell'operazione di drag dell'immagine)
        private void _postiPictureBox_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pb = (PictureBox)sender;

            pb.Select();
            if (pb.Tag != null)
            {
                pb.DoDragDrop(pb.Tag, DragDropEffects.Copy);
            }
        }
Exemple #29
0
        private void Event_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pictureBox = (PictureBox)sender;

            if (pictureBox.Image != null)
            {
                pictureBox.Select();
                pictureBox.DoDragDrop(pictureBox.Image, DragDropEffects.Copy);
            }
        }
Exemple #30
0
        private void pbNavio_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pb = (PictureBox)sender;

            if (pb.Image != null)
            {
                pb.Image.Tag = pb.Tag;
                pb.DoDragDrop(pb.Image, DragDropEffects.All);
                //navio = (TipoDeNavio)Enum.Parse(typeof(TipoDeNavio), pb.Tag.ToString());
            }
        }