5 Replies - 4717 Views - Last Post: 20 February 2010 - 07:57 PM Rate Topic: -----

#1 elvepure  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 12-February 10

Lable's with progress bar's

Posted 20 February 2010 - 03:43 PM

So quick question.
Im haveing a problem here.
So i have a progress bar that moves when i press button 1.
And i have a lable1 that changes text when the progress bar is at 50%

I want to put the lable inside the progress bar so it looks like its in it.
Right now if i put it over my progress bar and make back color transparent
It covers up my progress bar and show's me my background image
I want it look like the lable is inside the progress bar.
Any help here.
Transparent wont work.
If u need any of my codes just ask

Is This A Good Question/Topic? 0
  • +

Replies To: Lable's with progress bar's

#2 weirddemon  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 190
  • Joined: 05-January 09

Re: Lable's with progress bar's

Posted 20 February 2010 - 04:23 PM

You can't. At least not by default. You have to create your own ProgressBar in order to do that.

If you do some Google searches for a customer progress bar component, I'm sure you can find some ones that will fit your needs.

This post has been edited by weirddemon: 20 February 2010 - 04:23 PM

Was This Post Helpful? 0
  • +
  • -

#3 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Lable's with progress bar's

Posted 20 February 2010 - 04:30 PM

If you're simply looking to add the text (progress value) to your progress bar take a look at this tutorial. It's written in C# but it should be pretty easy to convert to VB.NET (if not there's plenty of online converters out there)
Was This Post Helpful? 0
  • +
  • -

#4 elvepure  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 12-February 10

Re: Lable's with progress bar's

Posted 20 February 2010 - 04:40 PM

View Postweirddemon, on 20 February 2010 - 03:23 PM, said:

You can't. At least not by default. You have to create your own ProgressBar in order to do that.

If you do some Google searches for a customer progress bar component, I'm sure you can find some ones that will fit your needs.


I should be able to cuz right now when it all works like i planed on it.
When the bar gets to 50% lable1 changes.
But when i put lable one under the progress bar it covers up the progress bar
I jsut need some way to make it blend in to the progress bar.
I googled that and found nothing that i needed.
Trust me I have been looking for this for about 5 hours now found nothing on google.
Was This Post Helpful? 0
  • +
  • -

#5 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Lable's with progress bar's

Posted 20 February 2010 - 04:43 PM

Like already mentioned, you cannot by default put a Label inside a ProgressBar. Read my post and look through that tutorial, that's your best option
Was This Post Helpful? 0
  • +
  • -

#6 elvepure  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 12-February 10

Re: Lable's with progress bar's

Posted 20 February 2010 - 07:57 PM

View PostPsychoCoder, on 20 February 2010 - 03:30 PM, said:

If you're simply looking to add the text (progress value) to your progress bar take a look at this tutorial. It's written in C# but it should be pretty easy to convert to VB.NET (if not there's plenty of online converters out there)


Well i did as you said and converted the code to



 Dim percent As Integer = CInt(((CDbl(progressBar1.Value) / CDbl(progressBar1.Maximum)) * 100))
   progressBar1.CreateGraphics().DrawString(percent.ToString() & "%", New Font("Arial", CSng(8.25), FontStyle.Regular), Brushes.Black, New PointF(progressBar1.Width / 2 - 10, progressBar1.Height / 2 - 7))



For vb.net and it said
Those exact lines of code above is what i used to draw the picture at the top. All you have to do is, after you change the progress bar's value, put that code right after it. There is no need to refresh the progress bar, because changing the value does this for you. Of course, my progress bar was called "progressBar1", but that can be easily changed. All it takes is a copy/paste. Enjoy!


So i put it here

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Value += 1

        Dim percent As Integer = CInt(((CDbl(ProgressBar1.Value) / CDbl(ProgressBar1.Maximum)) * 100))
        ProgressBar1.CreateGraphics().DrawString(percent.ToString() & "%", New Font("Arial", CSng(8.25), FontStyle.Regular), Brushes.Black, New PointF(ProgressBar1.Width / 2 - 10, ProgressBar1.Height / 2 - 7))



        If ProgressBar1.Value = 50 Then
            Label1.Text = ("test")
        End If
        If ProgressBar1.Value = 100 Then
            Timer1.Enabled = False
            PictureBox1.Enabled = False
        End If
    End Sub


And it didnt work.

Here is my full code if it will help.

Public Class Form1
#Region " Global Variables "
    Dim Point As New System.Drawing.Point()
    Dim X, Y As Integer
#End Region

#Region " GUI "
    Private Sub Main_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
        If e.Button = MouseButtons.Left Then
            Point = Control.MousePosition
            Point.X = Point.X - (X)
            Point.Y = Point.Y - (Y)
            Me.Location = Point
        End If
    End Sub
    Private Sub Main_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
        X = Control.MousePosition.X - Me.Location.X
        Y = Control.MousePosition.Y - Me.Location.Y
    End Sub

#End Region

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub


    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        giveUserIllusionOfProgress()
    End Sub
    Public Sub giveUserIllusionOfProgress()
        Timer1.Enabled = True
        Timer1.Interval = 100 'change this to your liking
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Value += 1

        Dim percent As Integer = CInt(((CDbl(ProgressBar1.Value) / CDbl(ProgressBar1.Maximum)) * 100))
        ProgressBar1.CreateGraphics().DrawString(percent.ToString() & "%", New Font("Arial", CSng(8.25), FontStyle.Regular), Brushes.Black, New PointF(ProgressBar1.Width / 2 - 10, ProgressBar1.Height / 2 - 7))



        If ProgressBar1.Value = 50 Then
            Label1.Text = ("test")
        End If
        If ProgressBar1.Value = 100 Then
            Timer1.Enabled = False
            PictureBox1.Enabled = False
        End If
    End Sub

    Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
        Me.Close()
    End Sub

    Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click
        WindowState = FormWindowState.Minimized
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub

    Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click


        


    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click




    End Sub
End Class


Any ideas m8?
Where should i put it to get it to work?
Thanks in advance


Edit

Wait it does work like that i just had the lable over it.
Now it shows a precent just fine.
Now i just need to change the precent to the lable some how
Any so is there anyway to do that

This post has been edited by elvepure: 20 February 2010 - 08:06 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1