Foro de elhacker.net

Programación => 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
  1. Option Explicit
  2. Dim oPicProgress As StdPicture
  3.  
  4. Private Sub Form_Load()
  5.    Set oPicProgress = LoadPicture("C:\cache.bmp")
  6.    Picture1.Height = ScaleY(oPicProgress.Height, vbHimetric, vbTwips)
  7.    Picture1.AutoRedraw = True
  8.    HScroll1.Max = 100
  9. End Sub
  10.  
  11. Private Sub RenderProgress(ByVal lPercent As Long)
  12.    Picture1.Cls
  13.    If lPercent = 0 Then Exit Sub
  14.    Picture1.PaintPicture oPicProgress, 0, 0, Picture1.ScaleWidth * lPercent / 100
  15.    Picture1.Refresh
  16. End Sub
  17.  
  18. Private Sub HScroll1_Scroll()
  19.    RenderProgress HScroll1.Value
  20. End Sub
  21. [code]
  22.  
  23. 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