質問

I have some buttons inside a FLP and I want when the mouse is over a button, to increase the size of the button a little, like a zoom effect. The problem is that when the button size increases, all buttons next to it slide to the right and down.. Probably the issue is caused by the space added by the FLP between items, but how can I prevent this, so when the size is increasing to go over that space not to add more..?

My ZOOM class:

class zoom
    {
        public zoom(Control cst)
        {
            cst.MouseEnter += delegate(object sender, EventArgs e)
            {
                cst.Size = new Size(70, 75);    
                cst.Font = new Font(cst.Font.FontFamily, 9);                    
            };
            cst.MouseLeave += delegate(object sender, EventArgs e)
            {
               cst.Size = new Size(68, 73);
               cst.Font = new Font(cst.Font.FontFamily, 8);
            };
}

}

役に立ちましたか?

解決

It's the way the FlowLayoutPanel works. It moves the rest of the controls to fit them all following the flow.
If you have some space between the buttons it's because of the Margin property, you could reduce the margin of the button as you zoom it.
This won't work if you want the button to show over the other ones. In that case, probably the only way to go is to use a simple Panel instead of the FlowLayoutPanel and do a BringToFront() with the Zoom.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top