home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD103401012000.psc / B2 / Forms / frmStartMenu.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-10-01  |  15.8 KB  |  435 lines

  1. VERSION 5.00
  2. Begin VB.Form frmStartMenu 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00000000&
  5.    BorderStyle     =   0  'None
  6.    ClientHeight    =   4800
  7.    ClientLeft      =   0
  8.    ClientTop       =   0
  9.    ClientWidth     =   9135
  10.    ControlBox      =   0   'False
  11.    KeyPreview      =   -1  'True
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   320
  14.    ScaleMode       =   3  'Pixel
  15.    ScaleWidth      =   609
  16.    ShowInTaskbar   =   0   'False
  17.    StartUpPosition =   3  'Windows Default
  18.    Begin VB.Timer tmrExpand 
  19.       Enabled         =   0   'False
  20.       Interval        =   500
  21.       Left            =   4020
  22.       Top             =   2160
  23.    End
  24.    Begin VB.PictureBox picDesktopCapture 
  25.       AutoRedraw      =   -1  'True
  26.       Height          =   4875
  27.       Left            =   1200
  28.       ScaleHeight     =   4815
  29.       ScaleWidth      =   5175
  30.       TabIndex        =   16
  31.       Top             =   2760
  32.       Visible         =   0   'False
  33.       Width           =   5235
  34.    End
  35.    Begin VB.PictureBox picItemOver 
  36.       AutoRedraw      =   -1  'True
  37.       BackColor       =   &H00C0C0FF&
  38.       BorderStyle     =   0  'None
  39.       Height          =   600
  40.       Index           =   7
  41.       Left            =   3300
  42.       ScaleHeight     =   600
  43.       ScaleWidth      =   3315
  44.       TabIndex        =   15
  45.       Top             =   0
  46.       Visible         =   0   'False
  47.       Width           =   3315
  48.    End
  49.    Begin VB.PictureBox picItemOver 
  50.       AutoRedraw      =   -1  'True
  51.       BackColor       =   &H00C0E0FF&
  52.       BorderStyle     =   0  'None
  53.       Height          =   600
  54.       Index           =   6
  55.       Left            =   3300
  56.       ScaleHeight     =   600
  57.       ScaleWidth      =   3315
  58.       TabIndex        =   14
  59.       Top             =   600
  60.       Visible         =   0   'False
  61.       Width           =   3315
  62.    End
  63.    Begin VB.PictureBox picItemOver 
  64.       AutoRedraw      =   -1  'True
  65.       BackColor       =   &H00C0C0FF&
  66.       BorderStyle     =   0  'None
  67.       Height          =   600
  68.       Index           =   5
  69.       Left            =   3300
  70.       ScaleHeight     =   600
  71.       ScaleWidth      =   3315
  72.       TabIndex        =   13
  73.       Top             =   1200
  74.       Visible         =   0   'False
  75.       Width           =   3315
  76.    End
  77.    Begin VB.PictureBox picItemOver 
  78.       AutoRedraw      =   -1  'True
  79.       BackColor       =   &H00C0E0FF&
  80.       BorderStyle     =   0  'None
  81.       Height          =   600
  82.       Index           =   4
  83.       Left            =   3315
  84.       ScaleHeight     =   600
  85.       ScaleWidth      =   3315
  86.       TabIndex        =   12
  87.       Top             =   1800
  88.       Visible         =   0   'False
  89.       Width           =   3315
  90.    End
  91.    Begin VB.PictureBox picItemOver 
  92.       AutoRedraw      =   -1  'True
  93.       BackColor       =   &H00C0C0FF&
  94.       BorderStyle     =   0  'None
  95.       Height          =   600
  96.       Index           =   3
  97.       Left            =   3300
  98.       ScaleHeight     =   600
  99.       ScaleWidth      =   3315
  100.       TabIndex        =   11
  101.       Top             =   2400
  102.       Visible         =   0   'False
  103.       Width           =   3315
  104.    End
  105.    Begin VB.PictureBox picItemOver 
  106.       AutoRedraw      =   -1  'True
  107.       BackColor       =   &H00C0E0FF&
  108.       BorderStyle     =   0  'None
  109.       Height          =   600
  110.       Index           =   2
  111.       Left            =   3300
  112.       ScaleHeight     =   600
  113.       ScaleWidth      =   3315
  114.       TabIndex        =   10
  115.       Top             =   3000
  116.       Visible         =   0   'False
  117.       Width           =   3315
  118.    End
  119.    Begin VB.PictureBox picItemOver 
  120.       AutoRedraw      =   -1  'True
  121.       BackColor       =   &H00C0E0FF&
  122.       BorderStyle     =   0  'None
  123.       Height          =   600
  124.       Index           =   0
  125.       Left            =   3300
  126.       ScaleHeight     =   600
  127.       ScaleWidth      =   3315
  128.       TabIndex        =   9
  129.       Top             =   4200
  130.       Visible         =   0   'False
  131.       Width           =   3315
  132.    End
  133.    Begin VB.PictureBox picItemOver 
  134.       AutoRedraw      =   -1  'True
  135.       BackColor       =   &H00C0C0FF&
  136.       BorderStyle     =   0  'None
  137.       Height          =   600
  138.       Index           =   1
  139.       Left            =   3300
  140.       ScaleHeight     =   600
  141.       ScaleWidth      =   3315
  142.       TabIndex        =   8
  143.       Top             =   3600
  144.       Visible         =   0   'False
  145.       Width           =   3315
  146.    End
  147.    Begin VB.PictureBox picItem 
  148.       AutoRedraw      =   -1  'True
  149.       BackColor       =   &H00C0FFC0&
  150.       BorderStyle     =   0  'None
  151.       Height          =   600
  152.       Index           =   7
  153.       Left            =   0
  154.       ScaleHeight     =   600
  155.       ScaleWidth      =   3300
  156.       TabIndex        =   7
  157.       Top             =   0
  158.       Width           =   3300
  159.    End
  160.    Begin VB.PictureBox picItem 
  161.       AutoRedraw      =   -1  'True
  162.       BackColor       =   &H00C0FFFF&
  163.       BorderStyle     =   0  'None
  164.       Height          =   600
  165.       Index           =   6
  166.       Left            =   0
  167.       ScaleHeight     =   600
  168.       ScaleWidth      =   3300
  169.       TabIndex        =   6
  170.       Top             =   600
  171.       Width           =   3300
  172.    End
  173.    Begin VB.PictureBox picItem 
  174.       AutoRedraw      =   -1  'True
  175.       BackColor       =   &H00C0FFC0&
  176.       BorderStyle     =   0  'None
  177.       Height          =   600
  178.       Index           =   5
  179.       Left            =   0
  180.       ScaleHeight     =   600
  181.       ScaleWidth      =   3300
  182.       TabIndex        =   5
  183.       Top             =   1200
  184.       Width           =   3300
  185.    End
  186.    Begin VB.PictureBox picItem 
  187.       AutoRedraw      =   -1  'True
  188.       BackColor       =   &H00C0FFFF&
  189.       BorderStyle     =   0  'None
  190.       Height          =   600
  191.       Index           =   4
  192.       Left            =   0
  193.       ScaleHeight     =   600
  194.       ScaleWidth      =   3300
  195.       TabIndex        =   4
  196.       Top             =   1800
  197.       Width           =   3300
  198.    End
  199.    Begin VB.PictureBox picItem 
  200.       AutoRedraw      =   -1  'True
  201.       BackColor       =   &H00C0FFC0&
  202.       BorderStyle     =   0  'None
  203.       Height          =   600
  204.       Index           =   3
  205.       Left            =   0
  206.       ScaleHeight     =   600
  207.       ScaleWidth      =   3300
  208.       TabIndex        =   3
  209.       Top             =   2400
  210.       Width           =   3300
  211.    End
  212.    Begin VB.PictureBox picItem 
  213.       AutoRedraw      =   -1  'True
  214.       BackColor       =   &H00C0FFFF&
  215.       BorderStyle     =   0  'None
  216.       Height          =   600
  217.       Index           =   2
  218.       Left            =   0
  219.       ScaleHeight     =   600
  220.       ScaleWidth      =   3300
  221.       TabIndex        =   2
  222.       Top             =   3000
  223.       Width           =   3300
  224.    End
  225.    Begin VB.PictureBox picItem 
  226.       AutoRedraw      =   -1  'True
  227.       BackColor       =   &H00C0FFC0&
  228.       BorderStyle     =   0  'None
  229.       Height          =   600
  230.       Index           =   1
  231.       Left            =   0
  232.       ScaleHeight     =   600
  233.       ScaleWidth      =   3300
  234.       TabIndex        =   1
  235.       Top             =   3600
  236.       Width           =   3300
  237.    End
  238.    Begin VB.PictureBox picItem 
  239.       AutoRedraw      =   -1  'True
  240.       BackColor       =   &H00C0FFFF&
  241.       BorderStyle     =   0  'None
  242.       Height          =   600
  243.       Index           =   0
  244.       Left            =   0
  245.       ScaleHeight     =   600
  246.       ScaleWidth      =   3300
  247.       TabIndex        =   0
  248.       Top             =   4200
  249.       Width           =   3300
  250.    End
  251. Attribute VB_Name = "frmStartMenu"
  252. Attribute VB_GlobalNameSpace = False
  253. Attribute VB_Creatable = False
  254. Attribute VB_PredeclaredId = True
  255. Attribute VB_Exposed = False
  256. Public StartMenuHeight As Integer, StartMenuWidth As Integer
  257. Public CorrectWidth As Integer, CorrectHeight As Integer
  258. Private CurrentIndex As Integer, OldIndex As Integer
  259. Private ExpandIndex As Integer
  260. Private finalwidth As Integer, finalheight As Integer, finalleft As Integer, showindex As Integer
  261. Implements ICcrpTimerNotify
  262. Private tmrShow As ccrpTimer
  263. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  264.     Select Case KeyCode
  265.         Case vbKeyUp
  266.             If CurrentIndex = 7 Then CurrentIndex = 0 Else CurrentIndex = CurrentIndex + 1
  267.                 HideMenus
  268.                 SelectImage (CurrentIndex)
  269.                 If OldIndex <> -1 Then UnselectImage (OldIndex)
  270.                 OldIndex = CurrentIndex
  271.         Case vbKeyDown
  272.             If CurrentIndex = 0 Then CurrentIndex = 7 Else CurrentIndex = CurrentIndex - 1
  273.                 HideMenus
  274.                 SelectImage (CurrentIndex)
  275.                 If OldIndex <> -1 Then UnselectImage (OldIndex)
  276.                 OldIndex = CurrentIndex
  277.         Case vbKeyRight
  278.                 ExpandMenu CurrentIndex, True
  279.         Case vbKeyEscape
  280.             HideMe
  281.     End Select
  282. End Sub
  283. Private Sub Form_Load()
  284.     Set tmrShow = New ccrpTimer
  285.     LoadSkinSettings
  286.     LoadSkinImages
  287.     OldIndex = -1
  288.     CurrentIndex = -1
  289. End Sub
  290. Sub Display()
  291.     picDesktopCapture.Width = GetStartMenuWidth + 10
  292.     picDesktopCapture.Height = GetStartMenuHeight + 10
  293.     If GetMenuShadow Then
  294.         BltDesktop frmTaskbar.CurLeft, frmTaskbar.CurTop - StartMenuHeight + 10, picDesktopCapture
  295.         CreateAlphaShadow StartMenuWidth, StartMenuHeight
  296.         SetWindowPos Me.hWND, HWND_TOPMOST, frmTaskbar.CurLeft, frmTaskbar.CurTop - StartMenuHeight + 10, StartMenuWidth, StartMenuHeight, 0
  297.     Else
  298.         BltDesktop 0, ScreenHeight - StartMenuHeight - frmTaskbar.TaskbarHeight, picDesktopCapture
  299.         SetWindowPos Me.hWND, HWND_TOPMOST, 0, frmTaskbar.CurTop - Me.ScaleHeight, StartMenuWidth, StartMenuHeight, 0
  300.     End If
  301.     For i = 0 To 7
  302.         'picItem(i).Top = (CorrectHeight / 8) * (7 - i)
  303.         picItem(i).Cls
  304.         AlphaBlending picItem(i).HDC, 0, 0, StartMenuWidth, CorrectHeight / 8, picDesktopCapture.HDC, 0, (7 - i) * (CorrectHeight / 8), StartMenuWidth, CorrectHeight / 8, MenuTranslucencyLevel
  305.     Next
  306.     finalheight = Me.Height
  307.     finalwidth = Me.Width
  308.     Me.Width = 0
  309.     Me.Height = 0
  310.     SetWindowPos Me.hWND, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW
  311.     Me.Refresh
  312.     Set tmrShow.Notify = Me
  313.     showindex = 0
  314.     tmrShow.Interval = 5
  315.     tmrShow.Stats.Frequency = 5
  316.     tmrShow.Enabled = True
  317. End Sub
  318. Sub CreateAlphaShadow(wid As Integer, hei As Integer)
  319.     Me.Cls
  320.     For i = 1 To 5
  321.         'Draw the right shadow
  322.         AlphaBlending Me.HDC, wid - 5 + i, 5, 1, hei - 5, picDesktopCapture.HDC, wid - 5 + i, 5, 1, hei - 5, i * 40 + 60
  323.         'The right corner
  324.         AlphaBlending Me.HDC, wid - 5, i + 5, 5, 1, picDesktopCapture.HDC, wid - 5, i + 5, 5, 1, (5 - i) * 40 + 60
  325.         'The upper right corner
  326.         BitBlt Me.HDC, wid - 5, 0, 5, 6, picDesktopCapture.HDC, wid - 5, 0, vbSrcCopy
  327.         'The bottom section
  328.         AlphaBlending Me.HDC, 5, hei - 5 + i, wid - 5, 1, picDesktopCapture.HDC, 5, hei - 5 + i, wid - 5, 1, i * 40 + 60
  329.         'The bottom corner
  330.         AlphaBlending Me.HDC, 5 + i, hei - 5, 1, 5, picDesktopCapture.HDC, 5 + i, hei - 5, 1, 1, (5 - i) * 40 + 60
  331.         'The left bottom corner
  332.         BitBlt Me.HDC, 0, hei - 5, 6, 5, picDesktopCapture.HDC, 0, hei - 5, vbSrcCopy
  333.     Next
  334. End Sub
  335. Sub HideMe()
  336.     tmrExpand.Enabled = False
  337.     tmrShow.Enabled = False
  338.     If OldIndex <> -1 Then UnselectImage (OldIndex)
  339.     If CurrentIndex <> -1 Then UnselectImage (CurrentIndex)
  340.     CurrentIndex = -1
  341.     OldIndex = -1
  342.     Me.Hide
  343. End Sub
  344. Sub LoadSkinSettings()
  345.     If GetMenuShadow Then
  346.         StartMenuWidth = GetStartMenuWidth + 5
  347.         StartMenuHeight = GetStartMenuHeight + 5
  348.     Else
  349.         StartMenuWidth = GetStartMenuWidth
  350.         StartMenuHeight = GetStartMenuHeight
  351.     End If
  352.     CorrectWidth = GetStartMenuWidth
  353.     CorrectHeight = GetStartMenuHeight
  354. End Sub
  355. Sub LoadSkinImages()
  356.     For i = 0 To 7
  357.         picItem(i).Picture = LoadPicture(GetSkinImage("Start Menu\Main Menu\Normal\Image" & i & ".bmp"))
  358.         picItemOver(i).Picture = LoadPicture(GetSkinImage("Start Menu\Main Menu\Over\Image" & i & ".bmp"))
  359.     Next
  360. End Sub
  361. Sub UnselectImage(Index As Integer)
  362.     picItem(Index).Cls
  363.     AlphaBlending picItem(Index).HDC, 0, 0, StartMenuWidth, CorrectHeight / 8, picDesktopCapture.HDC, 0, (7 - Index) * (CorrectHeight / 8), StartMenuWidth, CorrectHeight / 8, MenuTranslucencyLevel
  364.     picItem(Index).Refresh
  365.     OldIndex = -1
  366. End Sub
  367. Sub SelectImage(Index As Integer)
  368.     If OldIndex <> Index Then
  369.         BitBlt picItem(Index).HDC, 0, 0, StartMenuWidth, CorrectHeight / 8, picItemOver(Index).HDC, 0, 0, vbSrcCopy
  370.         AlphaBlending picItem(Index).HDC, 0, 0, StartMenuWidth, CorrectHeight / 8, picDesktopCapture.HDC, 0, (7 - Index) * (CorrectHeight / 8), StartMenuWidth, CorrectHeight / 8, MenuTranslucencyLevel
  371.         picItem(Index).Refresh
  372.         If Index = 1 Then PlaySkinSound "menuitemhover"
  373.     End If
  374. End Sub
  375. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  376.     ToggleStartMenu
  377. End Sub
  378. Private Sub ICcrpTimerNotify_Timer(ByVal Milliseconds As Long)
  379.     showindex = showindex + 1
  380.     Me.Height = finalheight * (showindex / 25)
  381.     Me.Width = finalwidth * (showindex / 25)
  382.     If showindex = 25 Then
  383.         tmrShow.Enabled = False
  384.         SetWindowPos Me.hWND, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW
  385.     End If
  386. End Sub
  387. Private Sub picItem_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  388.     Select Case Index
  389.         Case 1
  390.             ToggleStartMenu
  391.             frmRun.Show
  392.     End Select
  393. End Sub
  394. Private Sub picItem_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  395.     If OldIndex <> -1 And OldIndex <> Index Then UnselectImage (OldIndex): HideMenus
  396.     SelectImage (Index)
  397.         
  398.     ExpandIndex = Index
  399.     tmrExpand.Enabled = True
  400.     OldIndex = Index
  401. End Sub
  402. Sub ExpandMenu(Index As Integer, Optional Keystroke As Boolean = False)
  403.     If CurrentIndex <> Index Or Keystroke Then
  404.         Select Case Index
  405.             Case 7
  406.                 frmFolderMenu.DrawMenu GetStartMenuPath, (CorrectWidth - 5) * Screen.TwipsPerPixelX, (ScreenHeight - StartMenuHeight) * Screen.TwipsPerPixelY
  407.                 MenuShown(7) = True
  408.             Case 6
  409.                 frmFolderMenu.DrawMenu GetFavoritesPath, (CorrectWidth - 5) * Screen.TwipsPerPixelY, (ScreenHeight - StartMenuHeight + (CorrectHeight / 8)) * Screen.TwipsPerPixelY
  410.                 MenuShown(6) = True
  411.             Case 5
  412.                 frmFolderMenu.DrawMenu GetRecent, (CorrectWidth - 5) * Screen.TwipsPerPixelY, (ScreenHeight - StartMenuHeight + ((CorrectHeight / 8) * 2)) * Screen.TwipsPerPixelY
  413.                 MenuShown(5) = True
  414.             Case 4
  415.                 frmSettingsMenu.Display CorrectWidth + (Me.Left / Screen.TwipsPerPixelX) - 5, Me.Top / Screen.TwipsPerPixelY + picItem(4).Top
  416.                 MenuShown(4) = True
  417.             Case 3
  418.                 frmFindMenu.Display CorrectWidth + (Me.Left / Screen.TwipsPerPixelX) - 5, Me.Top / Screen.TwipsPerPixelY + picItem(3).Top
  419.                 MenuShown(3) = True
  420.             Case 2
  421.                 frmHelpMenu.Display CorrectWidth + (Me.Left / Screen.TwipsPerPixelX) - 5, Me.Top / Screen.TwipsPerPixelY + picItem(2).Top
  422.                 MenuShown(2) = True
  423.             Case 0
  424.                 frmShutdownMenu.Display CorrectWidth + (Me.Left / Screen.TwipsPerPixelX) - 5, (Me.Top / Screen.TwipsPerPixelY) + picItem(0).Top - 40
  425.                 MenuShown(0) = True
  426.         End Select
  427.         If Index <> 1 Then PlaySkinSound "menuopen"
  428.     End If
  429. End Sub
  430. Private Sub tmrExpand_Timer()
  431.     ExpandMenu (ExpandIndex)
  432.     tmrExpand.Enabled = False
  433.     CurrentIndex = ExpandIndex
  434. End Sub
  435.