public MapBtn(TabPage tab, Panel panelMiasto, string nazwa, short wspX, short wspY) { pozycja = new Rectangle(wspX - bg.Width / 2, wspY - bg.Height / 2, bg.Width - 5, bg.Height - 5); this.panelMiasto = panelMiasto; this.panelMiasto.Visible = false; this.ikona.Image = bgSmall; this.ikona.Location = new Point(pozycja.X, pozycja.Y); this.ikona.Name = "pictureBoxMapa"; this.ikona.Size = new System.Drawing.Size(pozycja.Width, pozycja.Height); this.ikona.TabIndex = 0; this.ikona.TabStop = false; this.ikona.MouseEnter += new System.EventHandler(this.MyszNad); this.ikona.MouseLeave += new System.EventHandler(this.MyszPoza); this.ikona.MouseClick += new MouseEventHandler(this.MyszClick); this.nazwaMiasta.Text = nazwa; this.nazwaMiasta.Location = new Point(pozycja.X + 30, pozycja.Y - 25); this.nazwaMiasta.Font = new Font(new FontFamily("Arial Black"), 30); this.nazwaMiasta.ForeColor = Color.White; this.nazwaMiasta.BorderColor = Color.Black; this.nazwaMiasta.BorderSize = 3; this.nazwaMiasta.AutoSize = true; this.nazwaMiasta.Visible = false; this.tabPage = tab; nazwaMiasta.BringToFront(); tab.Controls.Add(ikona); tab.Controls.Add(nazwaMiasta); MyszPoza(null, null); }
/// <summary> /// Positions the controls per the properties. /// </summary> private void updateLayout() { this.SuspendLayout(); m_pbxImage.Dock = (m_tpsPosition == TextPosition.Left) ? DockStyle.Right : DockStyle.Left; m_pbxGradient.BringToFront(); loadImage(); m_tlbLabel.Top = (this.ClientSize.Height - m_tlbLabel.Height) / 2; switch (m_tpsPosition) { case TextPosition.Left: m_tlbLabel.Left = 15; m_tlbLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left; break; case TextPosition.RightOfImage: m_tlbLabel.Left = m_pbxImage.Width + 15; m_tlbLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left; break; default: m_tlbLabel.Left = this.ClientSize.Width - m_tlbLabel.Width - 15; m_tlbLabel.Anchor = AnchorStyles.Top | AnchorStyles.Right; break; } m_tlbLabel.BringToFront(); this.ResumeLayout(); Fade(); }