Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
I have pictureBox Control with transparent control . I move it with drag & drop mouse .
but it has flicker.I move with this code


C#
control.MouseMove += delegate(object sender, MouseEventArgs e)
{
   if (Dragging)
   {
       if (direction != Direction.Vertical)
	   container.Left = Math.Max(0, e.X + container.Left - DragStart.X);
       if (direction != Direction.Horizontal)
	    container.Top = Math.Max(0, e.Y + container.Top - DragStart.Y);
   }
}


I try some method for solve it such as
C#
Application.DoEvents()

Or
C#
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias


But they were not efficient , I want know is there any way such as change region of pictureBox to remove back color without Transparent color for background?
thanks for your replies
Posted
Updated 15-Feb-13 2:19am
v2

1 solution

Hello,

you should try to put a call to SuspendLayout and ResumeLayout in your code:
C#
control.MouseMove += delegate(object sender, MouseEventArgs e)
{
   if (Dragging)
   {
       this.SuspendLayout();
       if (direction != Direction.Vertical)
	   container.Left = Math.Max(0, e.X + container.Left - DragStart.X);
       if (direction != Direction.Horizontal)
	    container.Top = Math.Max(0, e.Y + container.Top - DragStart.Y);
       this.ResumeLayout();
   }
}
 
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