如何在图像前放置一些东西?

时间:2015-09-03 14:08:28

标签: vb.net z-index picturebox

使用VB.net VS2010和Winforms,我只是想在面板上添加一个图片框和一个标签,但标签不会出现在图片框的前面。如何将标签设置为最重要的对象?使用下面的代码,标签总是在图片框后面。

 Public Class MyTab

    Inherits System.Windows.Forms.Panel
    Public myText As New Label
    Public tab_top_left as New Picturebox

    Public Sub New(ByVal tab_object As tab_properties_object)

        With tab_top_left
            .BackgroundImage = My.Resources.tab_top_left
            .Parent = Me
            .Location = New Point(0, 0)
            .SendToBack()
            .Width = 20
            .Height = 19
            .Name = "tab_top_left"
        End With

        Dim TextString As String = tab_object.top_tab_text

        myText.Font = CustomFont.GetInstance(Main.main_font_size_up3, FontStyle.Regular)
        myText.ForeColor = Color.FromArgb(255, 0, 0, 0)
        myText.BackColor = Color.FromArgb(255, 204, 204, 204)
        myText.Text = TextString
        myText.Location = New Point(0, 0)
        myText.Width = 200
        myText.Height = 40
        myText.UseCompatibleTextRendering = True
        myText.BorderStyle = BorderStyle.None
        myText.Name = "tab_" & myText.Text
        myText.Parent = Me
        myText.BringToFront()

        Me.Width = myText.Left + textSize.Width + 15
        Me.Height = 40
        Me.Name = "_" & TextString
        Me.Location = New Point(0, 0)

   End Sub
End Class

0 个答案:

没有答案