[Mono-list] Windows.Forms Controls Drawing

Phillip N. pneumann at gmail.com
Thu Dec 11 17:21:15 EST 2008


El jue, 11-12-2008 a las 20:26 +0100, Robert Jordan escribió:
> 
> > 1.- You can see two "Agents" in forms. They are transparent in the
> sense
> > that you can see the form background below them. But the are not
> > transparent with each other. Just move them so one get below the
> other.
> > In the real version, im drawing much more than two Agents, and the
> > probability of a overlap is high... 
> > How can i make them transparent to each other too?
> 
> WinForms does not support this. It supports transparency
> between the control and its parent only if there is no other
> control inbetween, which happens if you move the images over
> each other.
> 

Woot. Too bad. This is my first MWF proyect and im already
disapointed.. :S


> > 2.- When you move the agents after moving the Window, the movement
> start
> > to be not correct (it starts moving from another point in the form).
> Is
> > this a bug in my application?
> 
> Try this:
> 
>                 Point lastMousePosition;
> 
>                 protected override void OnMouseDown (MouseEventArgs e)
>                 {
>                         if (e.Button != MouseButtons.Left)
>                                 return;
> 
>                         this.BringToFront();
>                         tip.Show("Move it!",this, e.Location);
>                         lastMousePosition = e.Location;
>                         mouseDown = true;
>                 }
> 
>                 protected override void OnMouseMove (MouseEventArgs e)
>                 {
>                         if (mouseDown) {
>                                 int diffX = e.X - lastMousePosition.X;
>                                 int diffY = e.Y - lastMousePosition.Y;
>                                 // set Left & Top at once
>                                 Location = new Point (Left + diffX,
> Top + diffY);
>                         }
>                 }
> 

Works greate. 

Thanks!




More information about the Mono-list mailing list