requirements:
requires a local amplification function, that is, like Google Maps, scrolling the wheel of the mouse, the map will scale, and you can use the mouse to drag the screen to see the different parts of the larger picture.
Implementation:
1 for scaling, each control has one property size, and modifying the Size property enables the control to scale. In particular, most controls have MouseWheel events that register to the event with a scalable action such as a change to the Size property.
2) Drag-and-drop function to set the AutoScroll property of the control's parent container to true, meaning that if the page is larger than the current page, a scroll property like the browser will appear.
3) Other: How to distinguish the sliding direction of the wheel (up or down), MouseWheel event, the corresponding event parameter type is MouseEventArgs, MouseEventArgs has a Delta attribute in this event that indicates the degree to which the wheel scrolls, if the direction of the regular wheel is pushed forward (away from you, that is, you say "up"), otherwise dial backwards (near you, that is, you say "downward"), see the following code.
Code:
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 form Scaling {public partial class Form1:form {public Form1 () {Initializecompon
ENT (); (Control).
MouseWheel + = new MouseEventHandler (Form1_mousewheel); Button1.
MouseWheel + = new MouseEventHandler (Button1_mousewheel);
} void Button1_mousewheel (object sender, MouseEventArgs e) {try { if (button1.
Bounds.contains (e.location)) {if (E.delta > 0) { Button1. size = new Size (button1. Size.width + 1, button1.
Size.Height + 1); else if (E.delta < 0) {button1. size = new Size (button1. Size.width-1, button1. Size.heIGHT-1);
catch {MessageBox.Show ("Error");
} void Form1_mousewheel (object sender, MouseEventArgs e) {try { if (btn.
Bounds.contains (e.location)) {if (E.delta > 0) { Btn. size = new Size (btn. Size.width + 1, btn.
Size.Height + 1); else if (E.delta < 0) {btn. size = new Size (btn. Size.width-1, BTN.
SIZE.HEIGHT-1);
catch {MessageBox.Show ("Error"); }
}
}
}
Interface:
Click Button1, and slide the mouse wheel up, to enlarge;
Place the cursor on the Button3, slide the mouse wheel up, get larger, down, shrink;
Resources:
1) WinForm Automatic telescopic control xpandercontrols
http://blog.163.com/evay_zy/blog/static/17115748820112109235760/
2 C # mouse wheel Event
Http://hi.baidu.com/%D0%C7%B7%C9%D4%C2%C2%E4/blog/item/684010e8245f13c6d439c9fa.html
3 C # to make a scalable personalized form
Http://wenku.baidu.com/view/0c3d6911f18583d04964590f.html
4 C # with the wheel, click the button to achieve the picture zoom in and out to move
Http://download.csdn.net/source/2816010%E6%BB%9A%E8%BD%AE%E4%BA%8B%E4%BB%B6