Exemplo n.º 1
0
 /// <summary>
 /// 左 右 旋转
 /// </summary>
 /// <param name="bol">true表示左旋转</param>
 public void XuanZhuang(bool bol)
 {
     DevExpress.XtraTab.XtraTabPage page = cJiaTabControl1.SelectedTabPage;
     CJia.Controls.CJiaPicture      pic  = (CJia.Controls.CJiaPicture)page.Controls.Find("cJiaPicture", true)[0];
     if (pic.Image != null)
     {
         Image img = pic.Image;
         if (bol)
         {
             img.RotateFlip(RotateFlipType.Rotate270FlipNone);
             int   panel_W = pic.Parent.Width;
             float i       = float.Parse(img.Height.ToString()) / float.Parse(img.Width.ToString());
             pic.Width = panel_W - 20;
             float height = i * (panel_W - 20);
             pic.Height = Convert.ToInt32(height);
             pic.Image  = img;
         }
         else
         {
             img.RotateFlip(RotateFlipType.Rotate90FlipNone);
             int   panel_W = pic.Parent.Width;
             float i       = float.Parse(img.Height.ToString()) / float.Parse(img.Width.ToString());
             pic.Width = panel_W - 20;
             float height = i * (panel_W - 20);
             pic.Height = Convert.ToInt32(height);
             pic.Image  = img;
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 放大 缩小
 /// </summary>
 /// <param name="bol"></param>
 public void FangDa(bool bol)
 {
     DevExpress.XtraTab.XtraTabPage page = cJiaTabControl1.SelectedTabPage;
     CJia.Controls.CJiaPicture      pic  = (CJia.Controls.CJiaPicture)page.Controls.Find("cJiaPicture", true)[0];
     if (pic.Image != null)
     {
         int   panel_W = pic.Width;
         Image img     = pic.Image;
         float i       = float.Parse(img.Height.ToString()) / float.Parse(img.Width.ToString());
         if (bol)
         {
             if (panel_W + 100 < img.Width)
             {
                 pic.Width = panel_W + 100;
                 float height = i * (panel_W + 100);
                 pic.Height = Convert.ToInt32(height);
             }
         }
         else
         {
             if (panel_W - 100 > 100)
             {
                 pic.Width = panel_W - 100;
                 float height = i * (panel_W - 100);
                 pic.Height = Convert.ToInt32(height);
             }
         }
     }
 }
Exemplo n.º 3
0
Arquivo: Help.cs Projeto: whuacn/CJia
 /// <summary>
 /// 放大 缩小
 /// </summary>
 /// <param name="pic"></param>
 /// <param name="bol">true 放大</param>
 public static void FangDa(CJia.Controls.CJiaPicture pic, bool bol)
 {
     if (pic.Image != null)
     {
         int   panel_W = pic.Width;
         Image img     = pic.Image;
         float i       = float.Parse(img.Height.ToString()) / float.Parse(img.Width.ToString());
         if (bol)
         {
             if (panel_W + 100 < img.Width)
             {
                 pic.Width = panel_W + 100;
                 float height = i * (panel_W + 100);
                 pic.Height = Convert.ToInt32(height);
             }
         }
         else
         {
             if (panel_W - 100 > 100)
             {
                 pic.Width = panel_W - 100;
                 float height = i * (panel_W - 100);
                 pic.Height = Convert.ToInt32(height);
             }
         }
     }
 }
Exemplo n.º 4
0
Arquivo: Help.cs Projeto: whuacn/CJia
 /// <summary>
 /// 左 右 旋转
 /// </summary>
 /// <param name="pic"></param>
 /// <param name="bol">true表示左旋转</param>
 public static void XuanZhuang(CJia.Controls.CJiaPicture pic, bool bol)
 {
     if (pic.Image != null)
     {
         Image img = pic.Image;
         if (bol)
         {
             img.RotateFlip(RotateFlipType.Rotate270FlipNone);
             int   panel_W = pic.Parent.Width;
             float i       = float.Parse(img.Height.ToString()) / float.Parse(img.Width.ToString());
             pic.Width = panel_W - 20;
             float height = i * (panel_W - 20);
             pic.Height = Convert.ToInt32(height);
             pic.Image  = img;
         }
         else
         {
             img.RotateFlip(RotateFlipType.Rotate90FlipNone);
             int   panel_W = pic.Parent.Width;
             float i       = float.Parse(img.Height.ToString()) / float.Parse(img.Width.ToString());
             pic.Width = panel_W - 20;
             float height = i * (panel_W - 20);
             pic.Height = Convert.ToInt32(height);
             pic.Image  = img;
         }
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 判断图片格式是否正确
 /// </summary>
 /// <param name="image"></param>
 /// <param name="file"></param>
 bool isRightPicture(CJia.Controls.CJiaPicture image, CJia.Controls.CJiaOpenFile file)
 {
     try
     {
         image.Image = Image.FromFile(file.Text);
         return(true);
     }
     catch
     {
         MessageBox.Show("您选择的图片不能被读取或文件类型不对!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         image.Image = null;
         return(false);
     }
 }
Exemplo n.º 6
0
Arquivo: Help.cs Projeto: whuacn/CJia
 /// <summary>
 /// 实际尺寸 合适尺寸
 /// </summary>
 /// <param name="pic"></param>
 /// <param name="bol">true表示实际尺寸</param>
 public static void InFactSize(CJia.Controls.CJiaPicture pic, bool bol)
 {
     if (pic.Image != null)
     {
         Image img = pic.Image;
         if (bol)
         {
             pic.Width  = img.Width;
             pic.Height = img.Height;
         }
         else
         {
             int   panel_W = pic.Parent.Width;
             float i       = float.Parse(img.Height.ToString()) / float.Parse(img.Width.ToString());
             pic.Width = panel_W - 20;
             float height = i * (panel_W - 20);
             pic.Height = Convert.ToInt32(height);
         }
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 实际尺寸 合适尺寸
 /// </summary>
 /// <param name="bol">true表示实际尺寸</param>
 public void InFactSize(bool bol)
 {
     DevExpress.XtraTab.XtraTabPage page = cJiaTabControl1.SelectedTabPage;
     CJia.Controls.CJiaPicture      pic  = (CJia.Controls.CJiaPicture)page.Controls.Find("cJiaPicture", true)[0];
     if (pic.Image != null)
     {
         Image img = pic.Image;
         if (bol)
         {
             pic.Width  = img.Width;
             pic.Height = img.Height;
         }
         else
         {
             int   panel_W = pic.Parent.Width;
             float i       = float.Parse(img.Height.ToString()) / float.Parse(img.Width.ToString());
             pic.Width = panel_W - 20;
             float height = i * (panel_W - 20);
             pic.Height = Convert.ToInt32(height);
         }
     }
 }