Enlarge and shrink the picture

Source: Internet
Author: User

Click to enlarge, the picture becomes bigger, click Shrinks, the picture shrinks

Code

1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.ComponentModel;4 usingSystem.Data;5 usingSystem.Drawing;6 usingSystem.Text;7 usingSystem.Linq;8 usingSystem.Threading.Tasks;9 usingSystem.Windows.Forms;Ten usingdevexpress.xtraeditors; One usingCom.HuaQin.DBHelper; A usingSystem.Drawing; - usingSystem.Drawing.Imaging; - usingSystem.Reflection; the  - namespaceCom.HuaQin.WKStationPlugin - { -      Public Partial classXFrmQueryChild:DevExpress.XtraEditors.XtraForm +     { -         PrivateImage Mybitmap; + Point op, np; A Picture pic; atMyPoint Mousepoint =NewMyPoint (); -Boolean flag =true; - Boolean MouseDown; -Shift SFT =NewShift (); -         intScale =1; -          PublicXfrmquerychild (Image bit) in         { - InitializeComponent (); toPictureedit1.image =bit; +             //picturebox1.image = bit; -              the             //this.pictureBox1.Image = Mybitmap; *             //pic = new picture (bit, pictureBox1); $             //Pictureedit1.contextmenu = GetMenu (pictureEdit1);Panax Notoginseng         } -  the         Private voidToolstripbutton2_click (Objectsender, EventArgs e) +         { A             //Invokemenumethod (GetMenu (pictureEdit1), "Zoomto"); the             // +         } -  $         PrivateDevExpress.XtraEditors.Controls.PictureMenu getmenu (DevExpress.XtraEditors.PictureEdit Edit) $         { -PropertyInfo pi =typeof(DevExpress.XtraEditors.PictureEdit). GetProperty ("Menu", BindingFlags.NonPublic |bindingflags.instance); -             if(Pi! =NULL) the                 returnPi. GetValue (Edit,NULL) asDevExpress.XtraEditors.Controls.PictureMenu; -             return NULL;Wuyi         } the         Private voidInvokemenumethod (DevExpress.XtraEditors.Controls.PictureMenu menu,stringname) -         { WuMethodInfo mi =typeof(DevExpress.XtraEditors.Controls.PictureMenu). GetMethod (name, BindingFlags.NonPublic |bindingflags.instance); -             if(Mi! =NULL&& Menu! =NULL) AboutMi. Invoke (menu,New Object[] {menu,NewEventArgs ()}); $         } -  -         Private voidBarbuttonitem1_itemclick (Objectsender, DevExpress.XtraBars.ItemClickEventArgs e) -         { A             varmenu =GetMenu (pictureEdit1); +Invokemenumethod (menu,"Onzoomin"); the             //"Onzoomout" -         } $  the         Private voidBarbuttonitem2_itemclick (Objectsender, DevExpress.XtraBars.ItemClickEventArgs e) the         { the             varmenu =GetMenu (pictureEdit1); theInvokemenumethod (menu,"Onzoomout"); -         } in         the     } the}
View Code

Enlarge and shrink the picture

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.