Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
public Form1()
    {
        InitializeComponent();
        SetStyle(ControlStyles.UserPaint, true);
        SetStyle(ControlStyles.AllPaintingInWmPaint, true);
        SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
        SetStyle(ControlStyles.ResizeRedraw, true);
        SetStyle(ControlStyles.UserMouse, true);
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        this.SetStyle(ControlStyles.UserPaint, true);
        this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
        this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);


        this.DoubleBuffered = true;

        Rect1LT.Width = 10;
        Rect1LT.Height = 10;
        Rect1L.Width = 10;
        Rect1L.Height = 10;
        Rect1RT.Width = 10;
        Rect1RT.Height = 10;
        Rect1B.Width = 10;
        Rect1B.Height = 10;
        Rect1RB.Width = 10;
        Rect1RB.Height = 10;
        Rect1R.Width = 10;
        Rect1R.Height = 10;
        Rect1LB.Width = 10;
        Rect1LB.Height = 10;
        Rect1T.Width = 10;
        Rect1T.Height = 10;

        Rect1.X = panel1.Location.X + 50;
        Rect1.Y = panel1.Location.Y + 50;
        Rect1.Width = 100;
        Rect1.Height = 100;

        Rect1LT.X = Rect1.X - 5;
        Rect1LT.Y = Rect1.Y - 5;

        Rect1RT.X = Rect1.X - 5 + Rect1.Width;
        Rect1RT.Y = Rect1.Y - 5;

        Rect1LB.X = Rect1.X - 5;
        Rect1LB.Y = Rect1.Y - 5 + Rect1.Height;

        Rect1RB.X = Rect1.X - 5 + Rect1.Width;
        Rect1RB.Y = Rect1.Y - 5 + Rect1.Height;

        Rect1T.X = Rect1.X - 5 + (Rect1.Width / 2);
        Rect1T.Y = Rect1.Y - 5;

        Rect1B.X = Rect1.X - 5 + (Rect1.Width / 2);
        Rect1B.Y = Rect1.Y - 5 + Rect1.Height;

        Rect1L.X = Rect1.X - 5;
        Rect1L.Y = Rect1.Y - 5 + (Rect1.Height / 2);

        Rect1R.X = Rect1.X - 5 + Rect1.Width;
        Rect1R.Y = Rect1.Y - 5 + (Rect1.Height / 2);



    }

    private void panel1_Paint(object sender, PaintEventArgs e)
    {


    Pen mypen = default(Pen);
    mypen = new Pen(System.Drawing.Color.Red, 3);
    mypen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
    //For Dash Line in Rectangle 
    Pen mypen1 = default(Pen);
    mypen1 = new Pen(System.Drawing.Color.Blue, 1);
    mypen1.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;

    L1 = Rect1LT.X + 5;
    T1 = Rect1LT.Y + 5;
    W1 = Rect1RB.X - Rect1LT.X;
    H1 = Rect1RB.Y - Rect1LT.Y;
    e.Graphics.DrawRectangle(mypen, new System.Drawing.Rectangle(L1, T1, W1, H1));
    e.Graphics.DrawRectangle(mypen1, new System.Drawing.Rectangle(L1, T1, W1, H1));

    e.Graphics.DrawRectangle(Pens.Blue, new System.Drawing.Rectangle(Rect1LT.X, Rect1LT.Y, 10, 10));
    e.Graphics.DrawRectangle(Pens.Blue, new System.Drawing.Rectangle(Rect1RT.X, Rect1RT.Y, 10, 10));
    e.Graphics.DrawRectangle(Pens.Blue, new System.Drawing.Rectangle(Rect1LB.X, Rect1LB.Y, 10, 10));
    e.Graphics.DrawRectangle(Pens.Blue, new System.Drawing.Rectangle(Rect1RB.X, Rect1RB.Y, 10, 10));

    e.Graphics.FillRectangle(Brushes.Blue, Rect1LT);
    e.Graphics.FillRectangle(Brushes.Blue, Rect1RT);
    e.Graphics.FillRectangle(Brushes.Blue, Rect1LB);
    e.Graphics.FillRectangle(Brushes.Blue, Rect1RB);

    e.Graphics.DrawRectangle(Pens.Blue, new System.Drawing.Rectangle(Rect1T.X, Rect1T.Y, 10, 10));
    e.Graphics.DrawRectangle(Pens.Blue, new System.Drawing.Rectangle(Rect1R.X, Rect1R.Y, 10, 10));
    e.Graphics.DrawRectangle(Pens.Blue, new System.Drawing.Rectangle(Rect1B.X, Rect1B.Y, 10, 10));
    e.Graphics.DrawRectangle(Pens.Blue, new System.Drawing.Rectangle(Rect1L.X, Rect1L.Y, 10, 10));

    e.Graphics.FillRectangle(Brushes.Blue, Rect1T);
    e.Graphics.FillRectangle(Brushes.Blue, Rect1R);
    e.Graphics.FillRectangle(Brushes.Blue, Rect1B);
    e.Graphics.FillRectangle(Brushes.Blue, Rect1L);


}

int L1;
int T1;
int W1;
int H1;
bool flg1_LT = false;
bool flg1_RT = false;
bool flg1_LB = false;
bool flg1_RB = false;
bool flg1_mid = false;
bool flg1_T = false;
bool flg1_B = false;
bool flg1_L = false;

bool flg1_R = false;
public System.Drawing.Rectangle Rect1;
public System.Drawing.Rectangle Rect1LT;
public System.Drawing.Rectangle Rect1RT;
public System.Drawing.Rectangle Rect1LB;
public System.Drawing.Rectangle Rect1RB;
public System.Drawing.Rectangle Rect1T;
public System.Drawing.Rectangle Rect1B;
public System.Drawing.Rectangle Rect1L;

public System.Drawing.Rectangle Rect1R;
public Point Point1LT;
public Point Point1RT;
public Point Point1LB;
public Point Point1RB;
public Point Point1L;
public Point Point1T;
public Point Point1R;

public Point Point1B;

private void panel1_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Location.X >= Rect1LT.X & e.Location.Y >= Rect1LT.Y & e.Location.X <= (Rect1LT.X + 10) & e.Location.Y <= (Rect1LT.Y + 10))
    {
        flg1_LT = true;
    }
    else if (e.Location.X >= Rect1RT.X & e.Location.Y >= Rect1RT.Y & e.Location.X <= (Rect1RT.X + 10) & e.Location.Y <= (Rect1RT.Y + 10))
    {
        flg1_RT = true;
    }
    else if (e.Location.X >= Rect1LB.X & e.Location.Y >= Rect1LB.Y & e.Location.X <= (Rect1LB.X + 10) & e.Location.Y <= (Rect1LB.Y + 10))
    {
        flg1_LB = true;
    }
    else if (e.Location.X >= Rect1RB.X & e.Location.Y >= Rect1RB.Y & e.Location.X <= (Rect1RB.X + 10) & e.Location.Y <= (Rect1RB.Y + 10))
    {
        flg1_RB = true;
    }
    else if (e.Location.X >= Rect1B.X & e.Location.Y >= Rect1B.Y & e.Location.X <= (Rect1B.X + 10) & e.Location.Y <= (Rect1B.Y + 10))
    {
        flg1_B = true;
    }
    else if (e.Location.X >= Rect1R.X & e.Location.Y >= Rect1R.Y & e.Location.X <= (Rect1R.X + 10) & e.Location.Y <= (Rect1R.Y + 10))
    {
        flg1_R = true;
    }
    else if (e.Location.X >= Rect1T.X & e.Location.Y >= Rect1T.Y & e.Location.X <= (Rect1T.X + 10) & e.Location.Y <= (Rect1T.Y + 10))
    {
        flg1_T = true;
    }
    else if (e.Location.X >= Rect1L.X & e.Location.Y >= Rect1L.Y & e.Location.X <= (Rect1L.X + 10) & e.Location.Y <= (Rect1L.Y + 10))
    {
        flg1_L = true;
    }
    else if (e.Location.X >= (Rect1LT.X + 10) & e.Location.Y >= (Rect1LT.Y + 10) & e.Location.X <= (Rect1RB.X + 10) & e.Location.Y <= (Rect1RB.Y + 10))
    {
        flg1_mid = true;

        temp1X = e.Location.X;
        temp1Y = e.Location.Y;

        Point1L.X = Rect1L.X;
        Point1T.X = Rect1T.X;
        Point1B.X = Rect1B.X;
        Point1R.X = Rect1R.X;
        Point1L.Y = Rect1L.Y;
        Point1T.Y = Rect1T.Y;
        Point1B.Y = Rect1B.Y;
        Point1R.Y = Rect1R.Y;
        Point1LT.X = Rect1LT.X;
        Point1LB.X = Rect1LB.X;
        Point1RT.X = Rect1RT.X;
        Point1RB.X = Rect1RB.X;
        Point1LT.Y = Rect1LT.Y;
        Point1LB.Y = Rect1LB.Y;
        Point1RT.Y = Rect1RT.Y;
        Point1RB.Y = Rect1RB.Y;

        this.panel1.Cursor = System.Windows.Forms.Cursors.SizeAll;
}


}
int temp1X;
int temp1Y;
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
    System.Drawing.Rectangle Rect_TEMP1 = default(System.Drawing.Rectangle);
    System.Drawing.Rectangle Rect_TEMP2 = default(System.Drawing.Rectangle);
    System.Drawing.Rectangle Rect_TEMP3 = default(System.Drawing.Rectangle);
    System.Drawing.Rectangle Rect_TEMP4 = default(System.Drawing.Rectangle);
    System.Drawing.Rectangle Rect_TEMP5 = default(System.Drawing.Rectangle);
    System.Drawing.Rectangle Rect_TEMP6 = default(System.Drawing.Rectangle);

    if (e.Button == MouseButtons.Left)
    {
        Rect1T.X = ((Rect1LT.X + Rect1RB.X) / 2);
        Rect1L.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
        Rect1R.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
        Rect1B.X = ((Rect1LT.X + Rect1RB.X) / 2);


        if (flg1_LT)
        {
            if (e.Location.X > Rect1LT.X)
            {
                Rect1LT.X = e.Location.X;
                Rect1LB.X = e.Location.X;
                Rect1L.X = e.Location.X;
                Rect1T.X = ((Rect1LT.X + Rect1RB.X) / 2);
            }
            if (e.Location.Y > Rect1LT.Y)
            {
                Rect1LT.Y = e.Location.Y;
                Rect1RT.Y = e.Location.Y;
                Rect1T.Y = e.Location.Y;
                Rect1L.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
            }
            if (e.Location.X < Rect1LT.X)
            {
                Rect1LT.X = e.Location.X;
                Rect1LB.X = e.Location.X;
                Rect1L.X = e.Location.X;
                Rect1T.X = ((Rect1LT.X + Rect1RB.X) / 2);
            }
            if (e.Location.Y < Rect1LT.Y)
            {
                Rect1LT.Y = e.Location.Y;
                Rect1RT.Y = e.Location.Y;
                Rect1T.Y = e.Location.Y;
                Rect1L.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
            }



        }
        else if (flg1_RT)
        {
            if (e.Location.X > Rect1RT.X)
            {
                Rect1RT.X = e.Location.X;
                Rect1RB.X = e.Location.X;
                Rect1R.X = e.Location.X;
                Rect1T.X = ((Rect1LT.X + Rect1RB.X) / 2);
            }
            if (e.Location.Y > Rect1RT.Y)
            {
                Rect1RT.Y = e.Location.Y;
                Rect1LT.Y = e.Location.Y;
                Rect1T.Y = e.Location.Y;
                Rect1R.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
            }
            if (e.Location.X < Rect1RT.X)
            {
                Rect1RT.X = e.Location.X;
                Rect1RB.X = e.Location.X;
                Rect1R.X = e.Location.X;
                Rect1T.X = ((Rect1LT.X + Rect1RB.X) / 2);
            }
            if (e.Location.Y < Rect1RT.Y)
            {
                Rect1RT.Y = e.Location.Y;
                Rect1LT.Y = e.Location.Y;
                Rect1T.Y = e.Location.Y;
                Rect1R.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
            }


        }
        else if (flg1_LB)
        {
            if (e.Location.X > Rect1LB.X)
            {
                Rect1LB.X = e.Location.X;
                Rect1LT.X = e.Location.X;
                Rect1L.X = e.Location.X;
                Rect1B.X = ((Rect1LT.X + Rect1RB.X) / 2);
                Rect1T.X = ((Rect1LT.X + Rect1RB.X) / 2);
            }
            if (e.Location.Y > Rect1LB.Y)
            {
                Rect1LB.Y = e.Location.Y;
                Rect1RB.Y = e.Location.Y;
                Rect1B.Y = e.Location.Y;
                Rect1L.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
            }
            if (e.Location.X < Rect1LB.X)
            {
                Rect1LB.X = e.Location.X;
                Rect1LT.X = e.Location.X;
                Rect1L.X = e.Location.X;
                Rect1B.X = ((Rect1LT.X + Rect1RB.X) / 2);
                Rect1T.X = ((Rect1LT.X + Rect1RB.X) / 2);
            }
            if (e.Location.Y < Rect1LB.Y)
            {
                Rect1LB.Y = e.Location.Y;
                Rect1RB.Y = e.Location.Y;
                Rect1B.Y = e.Location.Y;
                Rect1L.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
            }


        }
        else if (flg1_RB)
        {
            if (e.Location.X > Rect1RB.X)
            {
                Rect1RB.X = e.Location.X;
                Rect1RT.X = e.Location.X;
                Rect1R.X = e.Location.X;
                Rect1B.X = ((Rect1LT.X + Rect1RB.X) / 2);
                Rect1T.X = ((Rect1LT.X + Rect1RB.X) / 2);
            }
            if (e.Location.Y > Rect1RB.Y)
            {
                Rect1RB.Y = e.Location.Y;
                Rect1LB.Y = e.Location.Y;
                Rect1B.Y = e.Location.Y;
                Rect1R.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
            }
            if (e.Location.X < (Rect1RB.X + 10))
            {
                Rect1RB.X = e.Location.X;
                Rect1RT.X = e.Location.X;
                Rect1R.X = e.Location.X;
                Rect1B.X = ((Rect1LT.X + Rect1RB.X) / 2);
                Rect1T.X = ((Rect1LT.X + Rect1RB.X) / 2);
            }
            if (e.Location.Y < (Rect1RB.Y + 10))
            {
                Rect1RB.Y = e.Location.Y;
                Rect1LB.Y = e.Location.Y;
                Rect1B.Y = e.Location.Y;
                Rect1R.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
            }


        }
        else if (flg1_B)
        {
            if (e.Location.Y > Rect1B.Y)
            {
                Rect1B.Y = e.Location.Y;
                Rect1LB.Y = e.Location.Y;
                Rect1RB.Y = e.Location.Y;
            }
            if (e.Location.Y < (Rect1B.Y + 10))
            {
                Rect1B.Y = e.Location.Y;
                Rect1LB.Y = e.Location.Y;
                Rect1RB.Y = e.Location.Y;
            }


        }
        else if (flg1_T)
        {
            if (e.Location.Y > Rect1T.Y)
            {
                Rect1T.Y = e.Location.Y;
                Rect1LT.Y = e.Location.Y;
                Rect1RT.Y = e.Location.Y;
            }

            if (e.Location.Y < (Rect1T.Y + 10))
            {
                Rect1T.Y = e.Location.Y;
                Rect1LT.Y = e.Location.Y;
                Rect1RT.Y = e.Location.Y;
            }


        }
        else if (flg1_R)
        {
            if (e.Location.X > Rect1R.X)
            {
                Rect1R.X = e.Location.X;
                Rect1RT.X = e.Location.X;
                Rect1RB.X = e.Location.X;
            }

            if (e.Location.X < (Rect1R.X + 10))
            {
                Rect1R.X = e.Location.X;
                Rect1RT.X = e.Location.X;
                Rect1RB.X = e.Location.X;
            }


        }
        else if (flg1_L)
        {
            if (e.Location.X > Rect1L.X)
            {
                Rect1L.X = e.Location.X;
                Rect1LT.X = e.Location.X;
                Rect1LB.X = e.Location.X;
            }

            if (e.Location.X < (Rect1L.X + 10))
            {
                Rect1L.X = e.Location.X;
                Rect1LT.X = e.Location.X;
                Rect1LB.X = e.Location.X;
            }


        }
        else if (flg1_mid)
        {
            Rect1LT.X = Point1LT.X + (e.Location.X - temp1X);
            Rect1RT.X = Point1RT.X + (e.Location.X - temp1X);
            Rect1LB.X = Point1LB.X + (e.Location.X - temp1X);
            Rect1RB.X = Point1RB.X + (e.Location.X - temp1X);
            Rect1LT.Y = Point1LT.Y + (e.Location.Y - temp1Y);
            Rect1RT.Y = Point1RT.Y + (e.Location.Y - temp1Y);
            Rect1LB.Y = Point1LB.Y + (e.Location.Y - temp1Y);
            Rect1RB.Y = Point1RB.Y + (e.Location.Y - temp1Y);
            Rect1L.X = Point1L.X + (e.Location.X - temp1X);
            Rect1R.X = Point1R.X + (e.Location.X - temp1X);
            Rect1B.X = Point1B.X + (e.Location.X - temp1X);
            Rect1T.X = Point1T.X + (e.Location.X - temp1X);
            Rect1L.Y = Point1L.Y + (e.Location.Y - temp1Y);
            Rect1R.Y = Point1R.Y + (e.Location.Y - temp1Y);
            Rect1B.Y = Point1B.Y + (e.Location.Y - temp1Y);
            Rect1T.Y = Point1T.Y + (e.Location.Y - temp1Y);

        }

        Rect1T.X = ((Rect1LT.X + Rect1RB.X) / 2);
        Rect1L.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
        Rect1R.Y = (Rect1LT.Y + Rect1LB.Y) / 2;
        Rect1B.X = ((Rect1LT.X + Rect1RB.X) / 2);

        if (Rect1LT.X > Rect1RT.X)
        {
            Rect_TEMP1 = Rect1RT;
            Rect_TEMP2 = Rect1R;
            Rect_TEMP3 = Rect1RB;
            Rect1RT = Rect1LT;
            Rect1R = Rect1L;
            Rect1RB = Rect1LB;
            Rect1LT = Rect_TEMP1;
            Rect1L = Rect_TEMP2;
            Rect1LB = Rect_TEMP3;

        }
        if (Rect1LT.Y > Rect1LB.Y)
        {
            Rect_TEMP4 = Rect1LB;
            Rect_TEMP5 = Rect1B;
            Rect_TEMP6 = Rect1RB;
            Rect1LB = Rect1LT;
            Rect1B = Rect1T;
            Rect1RB = Rect1RT;
            Rect1LT = Rect_TEMP4;
            Rect1T = Rect_TEMP5;
            Rect1RT = Rect_TEMP6;
        }
        this.DoubleBuffered= true;
        this.SetStyle(ControlStyles.UserPaint |
      ControlStyles.AllPaintingInWmPaint |
      ControlStyles.ResizeRedraw |
      ControlStyles.ContainerControl |
      ControlStyles.OptimizedDoubleBuffer |
      ControlStyles.SupportsTransparentBackColor
      , true);

        panel1.Invalidate();
    }

    if (e.Location.X >= Rect1LT.X & e.Location.Y >= Rect1LT.Y & e.Location.X <= (Rect1LT.X + 10) & e.Location.Y <= (Rect1LT.Y + 10))
    {
        this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNWSE;
    }
    else if (e.Location.X >= Rect1RT.X & e.Location.Y >= Rect1RT.Y & e.Location.X <= (Rect1RT.X + 10) & e.Location.Y <= (Rect1RT.Y + 10))
    {
        this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNESW;
    }
    else if (e.Location.X >= Rect1LB.X & e.Location.Y >= Rect1LB.Y & e.Location.X <= (Rect1LB.X + 10) & e.Location.Y <= (Rect1LB.Y + 10))
    {
        this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNESW;
    }
    else if (e.Location.X >= Rect1RB.X & e.Location.Y >= Rect1RB.Y & e.Location.X <= (Rect1RB.X + 10) & e.Location.Y <= (Rect1RB.Y + 10))
    {
        this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNWSE;
    }
    else if (e.Location.X >= Rect1B.X & e.Location.Y >= Rect1B.Y & e.Location.X <= (Rect1B.X + 10) & e.Location.Y <= (Rect1B.Y + 10))
    {
        this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNS;
    }
    else if (e.Location.X >= Rect1R.X & e.Location.Y >= Rect1R.Y & e.Location.X <= (Rect1R.X + 10) & e.Location.Y <= (Rect1R.Y + 10))
    {
        this.panel1.Cursor = System.Windows.Forms.Cursors.SizeWE;
    }
    else if (e.Location.X >= Rect1T.X & e.Location.Y >= Rect1T.Y & e.Location.X <= (Rect1T.X + 10) & e.Location.Y <= (Rect1T.Y + 10))
    {
        this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNS;
    }
    else if (e.Location.X >= Rect1L.X & e.Location.Y >= Rect1L.Y & e.Location.X <= (Rect1L.X + 10) & e.Location.Y <= (Rect1L.Y + 10))
    {
        this.panel1.Cursor = System.Windows.Forms.Cursors.SizeWE;
    }
    else if (e.Location.X >= (Rect1LT.X + 10) & e.Location.Y >= (Rect1LT.Y + 10) & e.Location.X <= (Rect1RB.X + 10) & e.Location.Y <= (Rect1RB.Y + 10))
    {
        this.panel1.Cursor = System.Windows.Forms.Cursors.SizeAll;
    }
}

    private void panel1_MouseUp(object sender, MouseEventArgs e)
    {
        flg1_LB = false;
        flg1_LT = false;
        flg1_RB = false;
        flg1_RT = false;
        temp1X = 0;
        temp1Y = 0;
        flg1_B = false;
        flg1_L = false;
        flg1_R = false;
        flg1_T = false;
        flg1_mid = false;
    }
}


As shown above I am drawing Rectangle , it causes flickering on panel? I also set Double Buffered Property to true but still result is zero. I set background Image in panel and Image Property is set as stretch, if Image Property is tile it doesn't flicker. what changes I should make to avoid flickering.
C#

Posted
Updated 2-Dec-14 22:11pm
v3
Comments
George Jonsson 3-Dec-14 4:21am    
Instead of drawing directly to the panel using e.Graphics, could try to draw to an image and then load the image in the panel.
BillWoodruff 3-Dec-14 5:38am    
That's a very good idea in this case !
BillWoodruff 3-Dec-14 5:41am    
Try removing all this from the MouseMove EventHandler:

this.DoubleBuffered= true;
this.SetStyle(ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.ResizeRedraw |
ControlStyles.ContainerControl |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.SupportsTransparentBackColor
, true);

You want to execute code like that once in the Form Constructor.
BillWoodruff 3-Dec-14 5:43am    
My brain cannot cope with reading all your code: please give a short description of what the user sees as they use the mouse using your code: they see ... obviously ... rectangles, and it appears where they move the mouse in relation to the drawing surface determines ... ?
keyur.shubham2014 3-Dec-14 7:31am    
I have a panel with simple image background and I draw rectangle over Panel and using mouse event I do resize and move that.

1 solution

Take a look at my simple image cropping tool. I use offscreen buffering for drawing the selection rectangle. I have even included size grippers and a moveable selection rectangle. Possible Solution
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900