Jump to content

Image Rotate Yardım


muratboy31
 Share

Recommended Posts

  • 2 hafta sonra ...

cevap için teşekürler pairs

 

bir sorum daha var,

 

buton ile form üzerine picturebox ekleyip sonra bu picturebox ı mouse ile sürükleyebilir miyim ?

ama aslında amacım birden fazla pixturebox ekleyebilmek ve hangisini mouse ile tutarsam onu sağa sola yada yukarı aşağıda sürükleyebilmek...

Bu konuda yardımcı olabilir misiniz...

 

Teşekürler

Edited by muratboy31
Link to comment
Share on other sites

 
        PictureBox p1;
            p1 = new PictureBox();
p1.BackgroundImage = Devre_Cizim.Properties.Resources.Toprak; l1.Text = Cihaz + TSayac.ToString();
            p1.Location = new Point(0, 13);
            p1.Size = new Size(105, 31);
            p1.SendToBack();
            p1.Enabled = true;
            p1.SendToBack();
this.Controls.Add(p1);
            p1.MouseUp += new MouseEventHandler(Birak);
            p1.MouseDown += new MouseEventHandler(Sec);
            p1.MouseMove += new MouseEventHandler(Tasi);

 

bool Durum = false;
        public void Sec(object sender, MouseEventArgs e)
        {
            Durum = true;
            Panel pnl = sender as Panel;
            pnl.Cursor = Cursors.SizeAll;
        }
 
        public void Tasi(object sender, MouseEventArgs e)
        {
            if (Durum)
            {
                Panel pnl = sender as Panel;
                pnl.Left = e.X + pnl.Left;
                pnl.Top = e.Y + pnl.Top;
            }
        }
 
        public void Birak(object sender, MouseEventArgs e)
        {
            Durum = false;
            Panel pnl = sender as Panel;
            pnl.Cursor = Cursors.Default;
        }
Edited by MehmetErdo287du
Link to comment
Share on other sites

nerde yanlış yapıyorum acaba ?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace picturebox_drag
{
    public partial class Form1 : Form
    {
        PictureBox p1;
        bool Durum = false;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            p1 = new PictureBox();
            p1.BackgroundImage = Properties.Resources.ar; 
           // label1.Text = Cihaz + TSayac.ToString();

            p1.Location = new Point(20, 13);
            p1.Size = new Size(105, 31);
            p1.SendToBack();

            p1.Enabled = false;
            p1.SendToBack();

            p1.MouseUp += new MouseEventHandler(Birak);
            p1.MouseDown += new MouseEventHandler(Sec);
            p1.MouseMove += new MouseEventHandler(Tasi);
            this.Controls.Add(p1);
        }

        public void Sec(object sender, MouseEventArgs e)
        {
            Durum = true;
            PictureBox pnl = sender as PictureBox;
            pnl.Cursor = Cursors.SizeAll;
        }

        public void Tasi(object sender, MouseEventArgs e)
        {
            if (Durum)
            {
                PictureBox pnl = sender as PictureBox;
                pnl.Left = e.X + pnl.Left;
                pnl.Top = e.Y + pnl.Top;
            }
        }

        public void Birak(object sender, MouseEventArgs e)
        {
            Durum = false;
            PictureBox pnl = sender as PictureBox;
            pnl.Cursor = Cursors.Default;
        }

    }
}

Link to comment
Share on other sites

Teşekkürler  MehmetErdo287du,

 

 

bunları hep p1 diye ekliyor, peki bunlardan birini silmek istediğimde hangisi olduğunu nasıl yapabilirim ?

silme işini mouse sağ click olaylarında kod yazıp visible = false yapabilirsin. fakat program hafızasından nasıl yapılır bilmiyorum


  1. mesela
  2. p1.Mousedoubleclick += new MouseEventHandler(Sil);
  3. this.Controls.Add(p1);
  4. }
  5.  
  6. public void Sil(object sender, MouseEventArgs e)
  7. {
  8. PictureBox pnl = sender as PictureBox;
  9. pnl.visible = false;
  10. }

resim döndürme yardımcı olabilir
 
Bitmap Resim = (Bitmap)p1.BackgroundImage;
            Resim.RotateFlip(RotateFlipType.Rotate90FlipXY);
            p1.BackgroundImage = Resim;
Edited by MehmetErdo287du
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...