Test Foro de elhacker.net SMF 2.1

Programación => .NET (C#, VB.NET, ASP) => Programación General => Programación Visual Basic => Mensaje iniciado por: Mi4night en 11 Agosto 2010, 20:03 PM

Título: How to create Progressbar from Image Pattern
Publicado por: Mi4night en 11 Agosto 2010, 20:03 PM
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
(http://img202.imageshack.us/img202/2544/loadingj.png)
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
Título: Re: How to create Progressbar from Image Pattern
Publicado por: LeandroA en 12 Agosto 2010, 04:31 AM
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]
Título: Re: How to create Progressbar from Image Pattern
Publicado por: Mi4night en 13 Agosto 2010, 00:25 AM
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