VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Winamp Style Resize

by Michael L. Canejo (28 Submissions)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (8 Votes)

Winamp 2.80 and below had a resizing feature on it's playlist that resized the form in blocks of pixels instead of per pixel. The reason for it was because they didn't know how to stretch the playlist skins (i hope not), so instead they kept resizing it a certain amount of pixels and then painting the image block after it's last one. This does get you better quality on your skinning cause stretching would degrade the quality unless it wasn't made to be stretched. I am using this in an XP Control i'm working on right now because the vb Image control flickers when the stretch property is set to true and you want to resize it with a form. I figured resizing it per chunck of pixels rather than per pixel, it would reduce flickering and save resources on old computers. I havn't testing my theory, but this method still looks appealing to me. I think this would work great on borderless forms or unsizable forms for customizing. It's kinda sloppy but efficient ;)

Rate Winamp Style Resize

'Just paste it into a brand new form 
'or a old one and it will add cursor 
'resizers based on coordinates which 
'is really nice i think. There was no 
'point in zipping such a simple feature.
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim iTwipX, iTwipY
Dim iScale As Integer
 On Error Resume Next
 iScale = Me.ScaleMode
 iTwipX = Screen.TwipsPerPixelX
 iTwipY = Screen.TwipsPerPixelY
 Me.ScaleMode = 3
 
 If Button = 1 Then
 If MousePointer = 0 Then GoTo Fix_Scale
 If MousePointer = 7 Then GoTo NS_Resize
 If X / iTwipX > ScaleWidth + iTwipX Then
  Width = Width + iTwipX ^ 2 * 2
 ElseIf X / iTwipX < ScaleWidth - iTwipX Then
  Width = Width - iTwipX ^ 2 * 2
 End If
 
 If MousePointer = 9 Then GoTo Fix_Scale
NS_Resize:
 If Y / iTwipY > ScaleHeight + iTwipY Then
  Height = Height + iTwipY ^ 2 * 2
 ElseIf Y / iTwipY < ScaleHeight - iTwipY Then
  Height = Height - iTwipY ^ 2 * 2
 End If
  
 Else
 If X / iTwipX > ScaleWidth - 12 _
 And Y / iTwipY > ScaleHeight - 10 Then
  MousePointer = 8
 ElseIf X / iTwipX > ScaleWidth - 12 _
 And Y / iTwipY < ScaleHeight - 10 Then
  MousePointer = 9
 ElseIf X / iTwipX < ScaleWidth - 12 _
 And Y / iTwipY > ScaleHeight - 10 Then
  MousePointer = 7
 Else
  MousePointer = 0
 End If
 End If
 
Fix_Scale:
 Me.ScaleMode = iScale%
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
 MousePointer = 0
End Sub

Download this snippet    Add to My Saved Code

Winamp Style Resize Comments

No comments have been posted about Winamp Style Resize. Why not be the first to post a comment about Winamp Style Resize.

Post your comment

Subject:
Message:
0/1000 characters