本文整理汇总了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);
}
示例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;
}
}
示例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
}