图片的放大和缩小

点击放大,图片变大,点击缩小,图片缩小

 

代码

 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Text;
 7 using System.Linq;
 8 using System.Threading.Tasks;
 9 using System.Windows.Forms;
10 using DevExpress.XtraEditors;
11 using Com.HuaQin.DBHelper;
12 using System.Drawing;
13 using System.Drawing.Imaging;
14 using System.Reflection;
15 
16 namespace Com.HuaQin.WKStationPlugin
17 {
18     public partial class xFrmQueryChild : DevExpress.XtraEditors.XtraForm
19     {
20         private Image myBitmap;
21         Point op, np;
22         Picture pic;
23         myPoint mousePoint = new myPoint();
24         Boolean flag = true;
25         Boolean mouseDown;
26         Shift sft = new Shift();
27         int scale =1;
28         public xFrmQueryChild(Image bit)
29         {
30             InitializeComponent();
31             pictureEdit1.Image = bit;
32             //pictureBox1.Image = bit;
33             
34             //this.pictureBox1.Image = myBitmap;
35             //pic = new Picture(bit, pictureBox1);
36             //pictureEdit1.ContextMenu = GetMenu(pictureEdit1);
37         }
38 
39         private void toolStripButton2_Click(object sender, EventArgs e)
40         {
41             //InvokeMenuMethod(GetMenu(pictureEdit1) ,"zoomTo");
42             //
43         }
44 
45         private DevExpress.XtraEditors.Controls.PictureMenu GetMenu(DevExpress.XtraEditors.PictureEdit edit)
46         {
47             PropertyInfo pi = typeof(DevExpress.XtraEditors.PictureEdit).GetProperty("Menu", BindingFlags.NonPublic | BindingFlags.Instance);
48             if (pi != null)
49                 return pi.GetValue(edit, null) as DevExpress.XtraEditors.Controls.PictureMenu;
50             return null;
51         }
52         private void InvokeMenuMethod(DevExpress.XtraEditors.Controls.PictureMenu menu, string name)
53         {
54             MethodInfo mi = typeof(DevExpress.XtraEditors.Controls.PictureMenu).GetMethod(name, BindingFlags.NonPublic | BindingFlags.Instance);
55             if (mi != null && menu != null)
56                 mi.Invoke(menu, new object[] { menu, new EventArgs() });
57         }
58 
59         private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
60         {
61             var menu = GetMenu(pictureEdit1);
62             InvokeMenuMethod(menu, "OnZoomIn");
63             //"OnZoomOut"
64         }
65 
66         private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
67         {
68             var menu = GetMenu(pictureEdit1);
69             InvokeMenuMethod(menu, "OnZoomOut");
70         }
71        
72     }
73 }
View Code

 

转载于:https://www.cnblogs.com/xcswswswws/p/5258179.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值