當前位置: 首頁>>代碼示例>>C#>>正文


C# PictureBox.FindForm方法代碼示例

本文整理匯總了C#中System.Windows.Forms.PictureBox.FindForm方法的典型用法代碼示例。如果您正苦於以下問題:C# PictureBox.FindForm方法的具體用法?C# PictureBox.FindForm怎麽用?C# PictureBox.FindForm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.PictureBox的用法示例。


在下文中一共展示了PictureBox.FindForm方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ObjectsList

        public ObjectsList(ObjectsPanel panel, PictureBox pb, GameWorld world, int x, int y, int width, int height,
            CheckTextButton showWar, CheckTextButton showCharacters, CheckTextButton showNpc, CheckTextButton showDrop,
            CharacterToolTip characterToolTip, NpcToolTip npcToolTip)
        {
            this.panel = panel;
            this.pb = pb;
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
            this.world = world;
            this.world.L2LiveObjectUpdate += world_L2LiveObjectUpdate;
            this.world.AddCharacter += (s, e) => { world_ObjectsChanged(); };
            //this.world.AddDrop += (s, e) => { world_ObjectsChanged(); };
            this.world.AddNpc += (s, e) => { world_ObjectsChanged(); };
            this.world.DeleteCharacter += (s, e) => { world_ObjectsChanged(); };
            //this.world.DeleteDrop += (s, e) => { world_ObjectsChanged(); };
            this.world.DeleteNpc += (s, e) => { world_ObjectsChanged(); };
            this.hoveredIndex = -1;
            this.showWar = showWar;
            this.showCharacters = showCharacters;
            this.showNpc = showNpc;
            this.showDrop = showDrop;
            this.objList = new List<L2Object>();
            this.characterToolTip = characterToolTip;
            this.npcToolTip = npcToolTip;

            scroll = new VScrollBar();
            scroll.Height = height - 1;
            scroll.Left = pb.Left + x + width - scroll.Width;
            scroll.Top = pb.Top + y + 1;
            scroll.LargeChange = height / itemHeight;
            pb.FindForm().Controls.Add(scroll);
            scroll.BringToFront();
            scroll.ValueChanged += scroll_ValueChanged;

            this.clip = new Rectangle(x + 1, y + 1, width - 2 - scroll.Width, height - 2);

            pb.MouseMove += pb_MouseMove;
            pb.MouseLeave += pb_MouseLeave;
            pb.MouseClick += pb_MouseClick;
            pb.FindForm().MouseWheel += ObjectsList_MouseWheel;

            hpBar = new MiniHPBar(72);
            hpBar5 = new Mini5HPBar(72);
            mpBar5 = new Mini5MPBar(72);
        }
開發者ID:Zergatul,項目名稱:ulHelper,代碼行數:47,代碼來源:ObjectsList.cs

示例2: Refresh

        private void Refresh(Image image, PictureBox pictureBox)
        {
            if (pictureBox.FindForm().WindowState == FormWindowState.Minimized)
                return;

            int sourceWidth = image.Width;
            int sourceHeight = image.Height;

            float nPercent = 0;
            float nPercentW = 0;
            float nPercentH = 0;

            nPercentW = ((float)pictureBox.Size.Width / (float)sourceWidth);
            nPercentH = ((float)pictureBox.Size.Height / (float)sourceHeight);

            nPercent = nPercentH < nPercentW ? nPercentH : nPercentW;

            int destWidth = (int)(sourceWidth * nPercent);
            int destHeight = (int)(sourceHeight * nPercent);

            Bitmap b = new Bitmap(destWidth, destHeight);
            Graphics g = Graphics.FromImage(b);
            {
                g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                g.DrawImage(image, 0, 0, destWidth, destHeight);
                pictureBox.Image = b;
            }
        }
開發者ID:RogerioCoimbra,項目名稱:SimCitySocialBot,代碼行數:28,代碼來源:Game.cs

示例3: collision

 //Checks if a shot and an enemy collides (panel and picturebox).
 private bool collision(Panel shot, PictureBox enemy)
 {
     Point enemyPoint = enemy.FindForm().PointToClient(enemy.Parent.PointToScreen(enemy.Location)); //Get absolute position of control in window - because of enemies parent
     return shot.Right >= enemyPoint.X - (enemy.Width / 2) + 5 && shot.Left <= enemyPoint.X + (enemy.Width / 2) + 20 && shot.Bottom >= enemyPoint.Y - (enemy.Height / 2) + 50 && shot.Top <= enemyPoint.Y + (enemy.Height / 2); //Checks if the shot is within the enemy boundries - values is based on testing
 }
開發者ID:HaavardM,項目名稱:RudrevyenTheGame,代碼行數:6,代碼來源:Form1.cs


注:本文中的System.Windows.Forms.PictureBox.FindForm方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。