How to create Progressbar from Image Pattern

Iniciado por Mi4night, 11 Agosto 2010, 20:03 PM

0 Miembros y 1 Visitante están viendo este tema.

Mi4night

Okay first off all Hi! all.
Okay My question is how can i create for example a Progressbar from a Image Pattern.
I know that you can't yet understand what i mean as my english is pretty poor but let me try to explain

for example i don't not load big progressbar images into my application to create a progressbar so i want use this little image here

and set it's length but i don't want to lose quality of the image by streching it so how is it possible to copy and past it over and over again until i get my disired length.
I hope i understand what i mean to say thx for any help

LeandroA

First Save the picture as .bmp (if you like 1 pixels Width) then...

put in the form one picturebox and one HScroll1
Código (vb) [Seleccionar]

Option Explicit
Dim oPicProgress As StdPicture

Private Sub Form_Load()
    Set oPicProgress = LoadPicture("C:\cache.bmp")
    Picture1.Height = ScaleY(oPicProgress.Height, vbHimetric, vbTwips)
    Picture1.AutoRedraw = True
    HScroll1.Max = 100
End Sub

Private Sub RenderProgress(ByVal lPercent As Long)
    Picture1.Cls
    If lPercent = 0 Then Exit Sub
    Picture1.PaintPicture oPicProgress, 0, 0, Picture1.ScaleWidth * lPercent / 100
    Picture1.Refresh
End Sub

Private Sub HScroll1_Scroll()
    RenderProgress HScroll1.Value
End Sub
[code]

Saludos.
[/code]

Mi4night

Hey thank you a lot Leandro one more question how would have this done using API as i know your really good at GDI.
Thanks a lot again