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