home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Programmer'…arterly (Limited Edition) / Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso / code / ch28code / frmret.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-08-02  |  4.6 KB  |  112 lines

  1. VERSION 4.00
  2. Begin VB.Form frmReturn 
  3.    BorderStyle     =   0  'None
  4.    ClientHeight    =   1125
  5.    ClientLeft      =   1080
  6.    ClientTop       =   1515
  7.    ClientWidth     =   2760
  8.    Height          =   1530
  9.    Icon            =   "FRMRET.frx":0000
  10.    Left            =   1020
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   75
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   184
  15.    ShowInTaskbar   =   0   'False
  16.    Top             =   1170
  17.    Width           =   2880
  18.    Begin VB.PictureBox picReturn 
  19.       Appearance      =   0  'Flat
  20.       AutoRedraw      =   -1  'True
  21.       BackColor       =   &H00C0C0C0&
  22.       BeginProperty Font 
  23.          name            =   "Arial"
  24.          charset         =   0
  25.          weight          =   700
  26.          size            =   8.25
  27.          underline       =   0   'False
  28.          italic          =   0   'False
  29.          strikethrough   =   0   'False
  30.       EndProperty
  31.       ForeColor       =   &H80000008&
  32.       Height          =   645
  33.       Left            =   0
  34.       ScaleHeight     =   41
  35.       ScaleMode       =   3  'Pixel
  36.       ScaleWidth      =   173
  37.       TabIndex        =   0
  38.       Top             =   0
  39.       Width           =   2625
  40.    End
  41. Attribute VB_Name = "frmReturn"
  42. Attribute VB_Creatable = False
  43. Attribute VB_Exposed = False
  44. '*********************************************************************
  45. ' FRMRET.FRM - This form is a picture button that provides a generic
  46. '              way to return to your app from Excel & Word.
  47. '*********************************************************************
  48. Option Explicit
  49. Option Compare Text
  50. Private frmCaller As Form
  51. '*********************************************************************
  52. ' Calling forms should display this form by calling its Display
  53. ' Method. This allows the form to know who displayed it, so it can
  54. ' set the focus back to the calling form when frmReturn is unloaded.
  55. '*********************************************************************
  56. Public Sub Display(frmCallingForm As Form)
  57.     Set frmCaller = frmCallingForm
  58.     Show
  59. End Sub
  60. '*********************************************************************
  61. ' Position the form and button to the same size in the upper right
  62. ' corner so they block the Minimize & Maximize buttons.
  63. '*********************************************************************
  64. Private Sub Form_Load()
  65. Dim XTwips%, YTwips%
  66.     XTwips = Screen.TwipsPerPixelX
  67.     YTwips = Screen.TwipsPerPixelY
  68.     picReturn.BackColor = vb3DFace
  69.     '*****************************************************************
  70.     ' Size the control, THEN move it to the uppper right corner.
  71.     '*****************************************************************
  72.     Move Left, top, 200 * XTwips, 43.4 * YTwips
  73.     Move Screen.Width - Width, 0
  74.     picReturn.Move 0, 0, 200, 43.4
  75.     '*****************************************************************
  76.     ' Prevent the window from being covered up, and draw the button.
  77.     '*****************************************************************
  78.     AlwaysOnTop Me, True
  79.     Handle_MouseUpDown False
  80. End Sub
  81. '*********************************************************************
  82. ' Handle drawing the button in its various states. Notice how we use
  83. ' to DrawButton routine from frmMain.
  84. '*********************************************************************
  85. Private Sub Handle_MouseUpDown(bState As Boolean)
  86.     DrawButton picReturn, IsDown:=bState, _
  87.                  sCaption:="Return to " & App.Title & "...", _
  88.                  sIcon:="RETURN", IsResource:=True
  89. End Sub
  90. '*********************************************************************
  91. ' Simulate a button click via graphics methods.
  92. '*********************************************************************
  93. Private Sub picReturn_MouseDown(Button%, Shift%, x As Single, y As Single)
  94.     Handle_MouseUpDown True
  95. End Sub
  96. Private Sub picReturn_MouseUp(Button%, Shift%, x As Single, y As Single)
  97.     Handle_MouseUpDown False
  98. End Sub
  99. '*********************************************************************
  100. ' Show the calling form, and unload this window.
  101. '*********************************************************************
  102. Private Sub picReturn_Click()
  103.     frmCaller.Show
  104.     '*****************************************************************
  105.     ' The calling form should have a public DestroyObject method to do
  106.     ' any necessary cleanup  (i.e., destroying it OLE Automation
  107.     ' object variables).
  108.     '*****************************************************************
  109.     frmCaller.DestroyObject
  110.     Unload Me
  111. End Sub
  112.