home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 6_2008-2009.ISO / data / zips / A_resizabl2220692262012.psc / Forms / frmResizableSkin.frm next >
Text File  |  2008-12-19  |  9KB  |  318 lines

  1. VERSION 5.00
  2. Begin VB.Form frmResizableSkin 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00FFFFFF&
  5.    Caption         =   "Resizable Skin Demo"
  6.    ClientHeight    =   2652
  7.    ClientLeft      =   1260
  8.    ClientTop       =   1560
  9.    ClientWidth     =   6132
  10.    ClipControls    =   0   'False
  11.    BeginProperty Font 
  12.       Name            =   "Arial"
  13.       Size            =   9
  14.       Charset         =   0
  15.       Weight          =   700
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    Icon            =   "frmResizableSkin.frx":0000
  21.    LinkTopic       =   "Form1"
  22.    PaletteMode     =   1  'UseZOrder
  23.    ScaleHeight     =   221
  24.    ScaleMode       =   3  'Pixel
  25.    ScaleWidth      =   511
  26.    Begin ResizableSkin.CrystalButton cbtControl 
  27.       Height          =   240
  28.       Index           =   1
  29.       Left            =   5280
  30.       TabIndex        =   1
  31.       TabStop         =   0   'False
  32.       Top             =   48
  33.       Width           =   300
  34.       _ExtentX        =   529
  35.       _ExtentY        =   423
  36.       BackColor       =   12582912
  37.       Caption         =   ""
  38.       CornerAngle     =   1
  39.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  40.          Name            =   "Arial"
  41.          Size            =   7.8
  42.          Charset         =   0
  43.          Weight          =   400
  44.          Underline       =   0   'False
  45.          Italic          =   0   'False
  46.          Strikethrough   =   0   'False
  47.       EndProperty
  48.       PicOpacity      =   0
  49.       Shape           =   3
  50.    End
  51.    Begin VB.PictureBox picSkin 
  52.       AutoRedraw      =   -1  'True
  53.       AutoSize        =   -1  'True
  54.       BorderStyle     =   0  'None
  55.       BeginProperty Font 
  56.          Name            =   "MS Sans Serif"
  57.          Size            =   7.8
  58.          Charset         =   0
  59.          Weight          =   400
  60.          Underline       =   0   'False
  61.          Italic          =   0   'False
  62.          Strikethrough   =   0   'False
  63.       EndProperty
  64.       Height          =   888
  65.       Left            =   5040
  66.       Picture         =   "frmResizableSkin.frx":08CA
  67.       ScaleHeight     =   74
  68.       ScaleMode       =   3  'Pixel
  69.       ScaleWidth      =   87
  70.       TabIndex        =   0
  71.       TabStop         =   0   'False
  72.       Top             =   720
  73.       Visible         =   0   'False
  74.       Width           =   1044
  75.    End
  76.    Begin VB.Timer tmrSysTrayPosition 
  77.       Enabled         =   0   'False
  78.       Interval        =   20
  79.       Left            =   5040
  80.       Top             =   2160
  81.    End
  82.    Begin ResizableSkin.CrystalButton cbtControl 
  83.       Height          =   240
  84.       Index           =   0
  85.       Left            =   4920
  86.       TabIndex        =   2
  87.       TabStop         =   0   'False
  88.       ToolTipText     =   "Minimize"
  89.       Top             =   48
  90.       Width           =   300
  91.       _ExtentX        =   529
  92.       _ExtentY        =   423
  93.       BackColor       =   12582912
  94.       Caption         =   ""
  95.       CornerAngle     =   1
  96.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  97.          Name            =   "Arial"
  98.          Size            =   7.8
  99.          Charset         =   0
  100.          Weight          =   400
  101.          Underline       =   0   'False
  102.          Italic          =   0   'False
  103.          Strikethrough   =   0   'False
  104.       EndProperty
  105.       Picture         =   "frmResizableSkin.frx":555C
  106.       Shape           =   2
  107.    End
  108.    Begin ResizableSkin.CrystalButton cbtControl 
  109.       Height          =   240
  110.       Index           =   2
  111.       Left            =   5640
  112.       TabIndex        =   3
  113.       TabStop         =   0   'False
  114.       ToolTipText     =   "Close"
  115.       Top             =   48
  116.       Width           =   300
  117.       _ExtentX        =   529
  118.       _ExtentY        =   423
  119.       BackColor       =   192
  120.       Caption         =   ""
  121.       CornerAngle     =   1
  122.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  123.          Name            =   "Arial"
  124.          Size            =   7.8
  125.          Charset         =   0
  126.          Weight          =   400
  127.          Underline       =   0   'False
  128.          Italic          =   0   'False
  129.          Strikethrough   =   0   'False
  130.       EndProperty
  131.       Picture         =   "frmResizableSkin.frx":56B6
  132.       Shape           =   1
  133.    End
  134.    Begin VB.Image imgControl 
  135.       Height          =   192
  136.       Index           =   1
  137.       Left            =   5760
  138.       Picture         =   "frmResizableSkin.frx":5810
  139.       ToolTipText     =   "Restore"
  140.       Top             =   1680
  141.       Width           =   192
  142.    End
  143.    Begin VB.Image imgControl 
  144.       Height          =   192
  145.       Index           =   0
  146.       Left            =   5520
  147.       Picture         =   "frmResizableSkin.frx":595A
  148.       ToolTipText     =   "Maximize"
  149.       Top             =   1680
  150.       Width           =   192
  151.    End
  152.    Begin VB.Image imgIcon 
  153.       Height          =   384
  154.       Left            =   5040
  155.       Top             =   1680
  156.       Visible         =   0   'False
  157.       Width           =   384
  158.    End
  159. End
  160. Attribute VB_Name = "frmResizableSkin"
  161. Attribute VB_GlobalNameSpace = False
  162. Attribute VB_Creatable = False
  163. Attribute VB_PredeclaredId = True
  164. Attribute VB_Exposed = False
  165. Option Explicit
  166.  
  167. ' Private Constant
  168. Private Const ICON_SIZE As Integer = 52
  169.  
  170. ' Private Variable
  171. Private MouseX          As Single
  172. Private MouseY          As Single
  173.  
  174. Public Sub EndResizableSkin()
  175.  
  176.    Unload Me
  177.  
  178. End Sub
  179.  
  180. Public Sub ToggleWindowState()
  181.  
  182.    If WindowState = vbMaximized Then
  183.       WindowState = vbNormal
  184.       
  185.    Else
  186.       WindowState = vbMaximized
  187.    End If
  188.  
  189. End Sub
  190.  
  191. Private Sub cbtControl_Click(Index As Integer)
  192.  
  193.    Select Case Index
  194.       Case 0
  195.          WindowState = vbMinimized
  196.          
  197.       Case 1
  198.          Call ToggleWindowState
  199.          
  200.       Case 2
  201.          Unload Me
  202.    End Select
  203.  
  204. End Sub
  205.  
  206. Private Sub Form_DblClick()
  207.  
  208.    If MouseY < ICON_SIZE Then
  209.       If MouseX < ICON_SIZE Then
  210.          Call EndResizableSkin
  211.          
  212.       Else
  213.          Call ToggleWindowState
  214.       End If
  215.    End If
  216.  
  217. End Sub
  218.  
  219. Private Sub Form_Load()
  220.  
  221.    imgIcon.Picture = Icon
  222.    
  223.    Call Initialize(Me, picSkin, imgIcon, ICON_SIZE)
  224.    Call SetCaptionFont("Arial", 10, True, , &H80FFFF)
  225.    Call RemoveTitleBar
  226.  
  227. End Sub
  228.  
  229. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  230.  
  231.    If MousePointer = vbSizeAll Then MousePointer = vbNormal
  232.    If (X < ICON_SIZE) And (Y < ICON_SIZE) Then If Not SysMenuOpen Then Call ShowSystemMenu
  233.    If (X > ICON_SIZE) Or (Y > ICON_SIZE) Then SysMenuOpen = False
  234.  
  235. End Sub
  236.  
  237. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  238.  
  239. Static blnButtonDown As Boolean
  240.  
  241.    MouseX = X
  242.    MouseY = Y
  243.    
  244.    If Button = vbLeftButton Then
  245.       If Not blnButtonDown And ((X > ICON_SIZE) And (Y < ICON_SIZE)) Then
  246.          Call MovingWindow(X + Y * &H10000)
  247.          
  248.       Else
  249.          blnButtonDown = True
  250.       End If
  251.       
  252.    Else
  253.       blnButtonDown = False
  254.    End If
  255.  
  256. End Sub
  257.  
  258. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  259.  
  260.    SysMenuOpen = False
  261.  
  262. End Sub
  263.  
  264. Private Sub Form_Resize()
  265.  
  266. Static blnMaximized As Boolean
  267.  
  268.    If WindowState = vbMaximized Then
  269.       If blnMaximized Then Exit Sub
  270.       
  271.       blnMaximized = True
  272.       
  273.       Call MakeSizable(False)
  274.       Call DockToSysTray
  275.       
  276.       tmrSysTrayPosition.Enabled = True
  277.       
  278.    Else
  279.       tmrSysTrayPosition.Enabled = False
  280.    End If
  281.    
  282.    Call CreateWindow(Width / Screen.TwipsPerPixelX, Height / Screen.TwipsPerPixelX, 40, AllRound, blnMaximized)
  283.    
  284.    If blnMaximized Then
  285.       Call MakeSizable(True)
  286.       
  287.       blnMaximized = False
  288.    End If
  289.    
  290.    Call DrawSkin
  291.    
  292.    With cbtControl.Item(2)
  293.       .Left = ScaleWidth - .Width - 10
  294.       cbtControl.Item(1).Left = .Left - .Width + 1
  295.    End With
  296.    
  297.    With cbtControl.Item(1)
  298.       cbtControl.Item(0).Left = .Left - .Width + 1
  299.       .Picture = imgControl.Item(Abs(tmrSysTrayPosition.Enabled)).Picture
  300.       .ToolTipText = imgControl.Item(Abs(tmrSysTrayPosition.Enabled)).ToolTipText
  301.    End With
  302.  
  303. End Sub
  304.  
  305. Private Sub Form_Unload(Cancel As Integer)
  306.  
  307.    Call Terminate
  308.    
  309.    Set frmResizableSkin = Nothing
  310.  
  311. End Sub
  312.  
  313. Private Sub tmrSysTrayPosition_Timer()
  314.  
  315.    Call DockToSysTray
  316.  
  317. End Sub
  318.