예제 #1
0
        void CutBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Panel panel = sender as Panel;

            Bitmap source = (Bitmap)panel.Parent.BackgroundImage;
            Utils.BitmapOperate bo = new Utils.BitmapOperate();
            Bitmap bmp = null;
            if (panel.Parent.Name == "ChampionPanel")
            {
                bmp = bo.GetPartOfImageRec(source,
                (Int32)Math.Round(panel.Width / 0.543),
                (Int32)Math.Round(panel.Height / 0.543),
                (Int32)Math.Round(panel.Left / 0.543),
                (Int32)Math.Round(panel.Top / 0.543));
            }
            else if (panel.Parent.Name == "ShotPanel")
            {
                bmp = bo.GetPartOfImageRec(source,
                (Int32)Math.Round(Convert.ToDouble(panel.Width / (Convert.ToDouble(panel.Parent.Width) / Convert.ToDouble(1215)))),
                (Int32)Math.Round(Convert.ToDouble(panel.Height / (Convert.ToDouble(panel.Parent.Height) / Convert.ToDouble(717)))),
                (Int32)Math.Round(Convert.ToDouble(panel.Left / (Convert.ToDouble(panel.Parent.Width) / Convert.ToDouble(1215)))),
                (Int32)Math.Round(Convert.ToDouble(panel.Top / (Convert.ToDouble(panel.Parent.Height) / Convert.ToDouble(717)))));
            }

            Datas.ChampionList ClistObj = new Datas.ChampionList();
            //Datas.LoginSeverList LlistObj = new Datas.LoginSeverList();
            Models.Champion champion = ClistObj.GetChampionById(panel.Parent.Tag.ToString());
            Utils.FileOperate fo = new Utils.FileOperate();

            Snapshot ss = new Snapshot();
            ss.ShotPanel.Width = panel.Width;
            ss.ShotPanel.Height = panel.Height;
            Point point = panel.PointToScreen(new Point(0,0));
            ss.StartPosition = FormStartPosition.Manual;
            ss.Location = new Point(point.X-15, point.Y-15);
            ss.ShotPanel.BackgroundImage = bmp;
            ss.ShotPanel.BackgroundImageLayout = ImageLayout.Stretch;
            ss.ChampionName.Tag = champion.EnName;

            if (champion.Spells != null && champion.Spells.Count > 0)
            {
                foreach (Models.Spell spell in champion.Spells)
                {
                    if (champion.EnName != "DrMundo")
                    {
                        Panel spellpanel = ss.ShotPanel.Controls.Find(spell.shortKey, true)[0] as Panel;
                        Bitmap spellbmp = bo.GetPartOfImageRec((fo.GetSpellPath() + spell.pathName + ".png"), spellpanel.Width - 3, spellpanel.Height - 3, spellpanel.Width, spellpanel.Height, -2, -2);
                        spellpanel.BackgroundImage = spellbmp;
                    }
                    else
                    {
                        if (spell.shortKey == "w")
                        {
                            Panel spellpanel = ss.ShotPanel.Controls.Find("w", true)[0] as Panel;
                            Bitmap spellbmp = bo.GetPartOfImageRec((global::SignatureBuilder.Properties.Resources.DrMundo_KissOfDeath), spellpanel.Width - 3, spellpanel.Height - 3, spellpanel.Width, spellpanel.Height, -2, -2);
                            spellpanel.BackgroundImage = spellbmp;
                        }
                        else if (spell.shortKey == "e")
                        {
                            Panel spellpanel = ss.ShotPanel.Controls.Find("e", true)[0] as Panel;
                            Bitmap spellbmp = bo.GetPartOfImageRec((global::SignatureBuilder.Properties.Resources.DrMundo_Masochism), spellpanel.Width - 3, spellpanel.Height - 3, spellpanel.Width, spellpanel.Height, -2, -2);
                            spellpanel.BackgroundImage = spellbmp;
                        }
                        else
                        {
                            Panel spellpanel = ss.ShotPanel.Controls.Find(spell.shortKey, true)[0] as Panel;
                            Bitmap spellbmp = bo.GetPartOfImageRec((fo.GetSpellPath() + spell.pathName + ".png"), spellpanel.Width - 3, spellpanel.Height - 3, spellpanel.Width, spellpanel.Height, -2, -2);
                            spellpanel.BackgroundImage = spellbmp;
                        }
                    }
                }
            }

            ss.ShowDialog(this);
        }