home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Popup_Ball53819272002.psc / frmTip.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2002-02-08  |  16.3 KB  |  419 lines

  1. VERSION 5.00
  2. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
  3. Begin VB.Form frmTip 
  4.    AutoRedraw      =   -1  'True
  5.    BackColor       =   &H80000018&
  6.    BorderStyle     =   0  'None
  7.    ClientHeight    =   1905
  8.    ClientLeft      =   0
  9.    ClientTop       =   0
  10.    ClientWidth     =   4680
  11.    ControlBox      =   0   'False
  12.    ForeColor       =   &H80000017&
  13.    Icon            =   "frmTip.frx":0000
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   127
  18.    ScaleMode       =   3  'Pixel
  19.    ScaleWidth      =   312
  20.    ShowInTaskbar   =   0   'False
  21.    Begin Tips.LaVolpeButton cmdLink 
  22.       Height          =   300
  23.       Left            =   1320
  24.       TabIndex        =   3
  25.       Top             =   1440
  26.       Visible         =   0   'False
  27.       Width           =   1695
  28.       _extentx        =   2990
  29.       _extenty        =   556
  30.       btype           =   3
  31.       bstyle          =   0
  32.       optval          =   0   'False
  33.       optmod          =   0   'False
  34.       tx              =   ""
  35.       enab            =   0   'False
  36.       font            =   "frmTip.frx":000C
  37.       coltype         =   1
  38.       bcol            =   16763594
  39.       fcol            =   0
  40.       fcolo           =   0
  41.       gstart          =   0
  42.       gstop           =   16711680
  43.       gstyle          =   0
  44.       embossm         =   12632256
  45.       embosss         =   16777215
  46.       mptr            =   0
  47.       micon           =   "frmTip.frx":0038
  48.       align           =   1
  49.       iconalign       =   0
  50.       style           =   0
  51.       orient          =   0
  52.       iconsize        =   2
  53.       showf           =   -1  'True
  54.    End
  55.    Begin RichTextLib.RichTextBox txtTip 
  56.       Height          =   855
  57.       Left            =   1380
  58.       TabIndex        =   2
  59.       Top             =   420
  60.       Width           =   1635
  61.       _ExtentX        =   2884
  62.       _ExtentY        =   1508
  63.       _Version        =   393217
  64.       BackColor       =   -2147483624
  65.       BorderStyle     =   0
  66.       Enabled         =   -1  'True
  67.       ReadOnly        =   -1  'True
  68.       ScrollBars      =   2
  69.       Appearance      =   0
  70.       TextRTF         =   $"frmTip.frx":0056
  71.    End
  72.    Begin VB.Timer timAutoClose 
  73.       Enabled         =   0   'False
  74.       Left            =   3960
  75.       Top             =   1200
  76.    End
  77.    Begin VB.Label lblX 
  78.       Alignment       =   2  'Center
  79.       BackStyle       =   0  'Transparent
  80.       Caption         =   "r"
  81.       BeginProperty Font 
  82.          Name            =   "Marlett"
  83.          Size            =   8.25
  84.          Charset         =   2
  85.          Weight          =   500
  86.          Underline       =   0   'False
  87.          Italic          =   0   'False
  88.          Strikethrough   =   0   'False
  89.       EndProperty
  90.       ForeColor       =   &H00FFFFFF&
  91.       Height          =   195
  92.       Left            =   3840
  93.       TabIndex        =   1
  94.       ToolTipText     =   "Close"
  95.       Top             =   600
  96.       Width           =   195
  97.    End
  98.    Begin VB.Image imgDisplayIcon 
  99.       Height          =   240
  100.       Left            =   120
  101.       Stretch         =   -1  'True
  102.       Top             =   120
  103.       Width           =   240
  104.    End
  105.    Begin VB.Image imgX_Up 
  106.       Height          =   240
  107.       Left            =   4080
  108.       Picture         =   "frmTip.frx":00DB
  109.       Top             =   360
  110.       Visible         =   0   'False
  111.       Width           =   240
  112.    End
  113.    Begin VB.Image imgX_Dn 
  114.       Height          =   240
  115.       Left            =   3480
  116.       Picture         =   "frmTip.frx":041D
  117.       Top             =   600
  118.       Visible         =   0   'False
  119.       Width           =   240
  120.    End
  121.    Begin VB.Image imgX 
  122.       Height          =   240
  123.       Left            =   3840
  124.       Picture         =   "frmTip.frx":075F
  125.       Top             =   600
  126.       Width           =   240
  127.    End
  128.    Begin VB.Image imgIcon 
  129.       Height          =   240
  130.       Index           =   1
  131.       Left            =   960
  132.       Picture         =   "frmTip.frx":0AA1
  133.       Top             =   1620
  134.       Visible         =   0   'False
  135.       Width           =   240
  136.    End
  137.    Begin VB.Image imgIcon 
  138.       Height          =   240
  139.       Index           =   0
  140.       Left            =   720
  141.       Picture         =   "frmTip.frx":102B
  142.       Top             =   1620
  143.       Visible         =   0   'False
  144.       Width           =   240
  145.    End
  146.    Begin VB.Image imgIcon 
  147.       Height          =   240
  148.       Index           =   2
  149.       Left            =   0
  150.       Picture         =   "frmTip.frx":15B5
  151.       Top             =   1320
  152.       Visible         =   0   'False
  153.       Width           =   240
  154.    End
  155.    Begin VB.Image imgIconXP 
  156.       Height          =   240
  157.       Index           =   2
  158.       Left            =   480
  159.       Picture         =   "frmTip.frx":1B3F
  160.       Top             =   1620
  161.       Visible         =   0   'False
  162.       Width           =   240
  163.    End
  164.    Begin VB.Image imgIconXP 
  165.       Height          =   240
  166.       Index           =   1
  167.       Left            =   240
  168.       Picture         =   "frmTip.frx":20C9
  169.       Top             =   1620
  170.       Visible         =   0   'False
  171.       Width           =   240
  172.    End
  173.    Begin VB.Image imgIconXP 
  174.       Height          =   240
  175.       Index           =   0
  176.       Left            =   0
  177.       Picture         =   "frmTip.frx":2653
  178.       Top             =   1620
  179.       Visible         =   0   'False
  180.       Width           =   240
  181.    End
  182.    Begin VB.Label lblTitle 
  183.       Alignment       =   2  'Center
  184.       Appearance      =   0  'Flat
  185.       BackColor       =   &H009EF5F3&
  186.       BackStyle       =   0  'Transparent
  187.       Caption         =   "<Title>"
  188.       BeginProperty Font 
  189.          Name            =   "MS Sans Serif"
  190.          Size            =   8.25
  191.          Charset         =   0
  192.          Weight          =   700
  193.          Underline       =   0   'False
  194.          Italic          =   0   'False
  195.          Strikethrough   =   0   'False
  196.       EndProperty
  197.       ForeColor       =   &H80000008&
  198.       Height          =   255
  199.       Left            =   480
  200.       TabIndex        =   0
  201.       Top             =   0
  202.       Width           =   3735
  203.    End
  204. Attribute VB_Name = "frmTip"
  205. Attribute VB_GlobalNameSpace = False
  206. Attribute VB_Creatable = False
  207. Attribute VB_PredeclaredId = True
  208. Attribute VB_Exposed = False
  209. Option Explicit 'All variables must be declared
  210. Dim XY() As POINTAPI
  211. Private Declare Function CreateEllipticRgn Lib "gdi32" _
  212.     (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, _
  213.     ByVal Y2 As Long) As Long 'Used to round the corners of the form
  214. Private Declare Function CreatePolygonRgn Lib "gdi32" _
  215.     (lpPoint As POINTAPI, ByVal nCount As Long, _
  216.     ByVal nPolyFillMode As Long) As Long 'Used to round corners of form
  217. Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, _
  218. ByVal hRgn As Long, ByVal bRedraw As Long) As Long
  219. Public Sub RoundCorners()
  220. Attribute RoundCorners.VB_Description = "Rounds the corners of the form via API to create the tooltip effect"
  221.     Me.ScaleMode = vbPixels
  222.     mlWidth = Me.ScaleWidth
  223.     mlHeight = Me.ScaleHeight
  224.     SetWindowRgn Me.hWnd, CreateRoundRectRgn(0, 0, _
  225.                 (Me.Width / Screen.TwipsPerPixelX), (Me.Height / Screen.TwipsPerPixelY), _
  226.                 25, 25), _
  227.                 True
  228. End Sub
  229. Private Sub cmdLink_Click()
  230.     MsgBox "So you want me to do something...well how about Quitting."
  231.     End
  232. End Sub
  233. Private Sub Form_Click()
  234. 'Hide me after I'm clicked on
  235. HideBalloon
  236. End Sub
  237. Private Sub Form_Load()
  238. RoundCorners ' Round the corners of this form to make it look "tool-tippy"
  239. End Sub
  240. Private Sub Form_Resize()
  241.   txtTip.Move 8, lblTitle.Height + 10, Me.ScaleWidth - 20, Me.ScaleHeight _
  242.   - lblTitle.Height - 20 - cmdLink.Height - (cmdLink.Height * 0.75)
  243.   lblX.Move (Me.ScaleWidth - lblX.Width) - 13, 5 'lblX.Height - 10  '- 2
  244.   imgX.Move (Me.ScaleWidth - lblX.Width) - 15, 2 'lblX.Height - 13  '- 5
  245.   imgX_Dn.Move (Me.ScaleWidth - lblX.Width) - 15, 2 '  lblX.Height - 13 ' - 5
  246.   imgX_Up.Move (Me.ScaleWidth - lblX.Width) - 15, 2 'lblX.Height - 13 '- 5
  247.   imgDisplayIcon.Move 10, 2
  248.   'Now, resize the title label's width to fit the balloon size:
  249.   lblTitle.Move 0, 1, Me.ScaleWidth
  250.   Me.Cls
  251.   Me.DrawWidth = 1
  252.   Me.FillStyle = 0
  253.   Me.Line (lblTitle.Left, lblTitle.Top)-(lblTitle.Width, lblTitle.Height), &H9EF5F3, BF
  254.   Me.FillStyle = 1
  255.   Me.DrawWidth = 2
  256.   Me.ForeColor = vbBlack
  257.   RoundRect Me.hdc, 0, 0, (Me.Width / Screen.TwipsPerPixelX) - 1, (Me.Height / Screen.TwipsPerPixelY) - 1, CLng(25), CLng(25)
  258. End Sub
  259. Private Sub imgDisplayIcon_Click()
  260.   ' Hide this balloon if I'm clicked
  261.   HideBalloon
  262. End Sub
  263. Private Sub imgX_Click()
  264.   HideBalloon
  265. End Sub
  266. Private Sub imgX_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  267.   If Button = vbLeftButton Then imgX.Picture = imgX_Dn.Picture
  268. End Sub
  269. Private Sub imgX_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  270.   If Button = vbLeftButton Then imgX.Picture = imgX_Up.Picture
  271. End Sub
  272. Private Sub lblTitle_Click()
  273. 'Hide me after I'm clicked on
  274. 'HideBalloon
  275. End Sub
  276. Public Sub SetBalloon(sTitle As String, sText As String, lPosX As Long, lPosY _
  277.     As Long, Optional sIcon As String, Optional bShowClose As Boolean = False, _
  278.     Optional lAutoCloseAfter As Long = 0, Optional lHeight As Long = 1620, _
  279.      Optional lWidth As Long = 4680, Optional sFont = "MS Sans Serif", Optional sRTFFilename As String _
  280.      , Optional boolButton As Boolean = False)
  281. 'Arguments for this Sub are explained below. What this Sub does is
  282. 'set the properties for the balloon to be displayed--text, title, etc.
  283. 'After (or right before) setting the properties, you must show the
  284. 'balloon yourself by calling <form_name>.Show
  285. 'For example, if this "template" form is frmTip, you can create a new
  286. 'instance of frmTip by doing:
  287. '   Dim frmMyTip as New frmTip
  288. 'and then calling frmMyTip.SetBalloon using the values you want, as in:
  289. '   frmMyTip.SetBalloon "Sample Title", "Sample Text"
  290. 'and going on with the arguments as needed (see below and the declaration
  291. 'for this Sub above).
  292. 'Then, to show the balloon, call
  293. '   frmMyTip.show
  294. 'Here's what the arguments for this Sub do:
  295. 'sTitle: The bold title to appear above the text on the balloon (Required)
  296. 'sText: Text of balloon (Required)
  297. 'lPosX and lPosY: The horizontal and vertical, respectively, positions to
  298. '                 show the ballon at (Required)
  299. 'sIcon: The icon to be displayed on the balloon, similar to the messagebox's.
  300. '       They're an "i", "x", or "!". (No question mark here; you can't ask
  301. '       on a balloon, can you?) To specifiy, pass either "i", "x", or "!" as
  302. '       the argument, e.g., SetBalloon("Title", "Text", "!" ...
  303. '       For none, don't pass anything. And, they'll use the XP-style icons
  304. '       by default; to use 9x-looking icons instead, specify "i9", "x9", or "!9"
  305. '       Look at the tooltip form (frmTip, in my example project) to see what
  306. '       they look like; you should see the difference, but they're quite similar--
  307. '       the XP ones just look more colorful and 3D-ish (Optional)
  308. 'bShowClose: Whether or not to show the "X" close button the user can
  309. '            press to close the balloon. If there, click to close the
  310. '            balloon; if it's not there (or if it is) clicking anywhere
  311. '            in the balloon will close it. (Optional)
  312. 'lAutoCloseAfter: Specifies the amount of time (in milliseconds) after
  313. '                 which to automatically close the balloon. Setting it
  314. '                 to 0 will make it not automatically close.
  315. '                 E.g., 10,000 is ten seconds. (Optional)
  316. 'lHeight and lWidth: The width and height that you want the balloon to have.
  317. '                    It 's optional, and it will default to a "normal" size.
  318. '                    If you have a long message, increasing the height should
  319. '                    be good, although you can increase the width if you want, too
  320.                      
  321. 'sFont: The font the text will appear in, defaulting to MS Sans Serif.
  322. '       The other normal choice would be Tahoma, which is gives it a
  323. '       "new" look, but some earlier Windows 9x versions may not have
  324. '       it (Optional)
  325. 'boolButton: Indicates if the command button is to be shown or not. If it is then
  326. '            the button can be used for any normal button function - close, link to
  327. '            something. The LaVolpeButton User Control has been add to allow the button
  328. '            style be set to XP. The Control also allows other styles (Optional)
  329.   'Setting TITLE AND CAPTION on tip:
  330.   lblTitle.Caption = sTitle
  331.   If sText <> "" Then txtTip.Text = sText
  332.   If sRTFFilename <> "" Then txtTip.FileName = sRTFFilename
  333.   'Setting the X AND Y POSITIONS:
  334.   Me.Move lPosX, lPosY
  335.   'Setting the ICON:
  336.   'First, convert the case to all lower; that way, since all Select Case
  337.   'statements below use lowercase for identification
  338.   sIcon = LCase(sIcon)
  339.   Select Case sIcon
  340.       Case "i": 'The "i" icon, XP-style (default)
  341.           Me.imgDisplayIcon.Picture = Me.imgIconXP(0).Picture
  342.           
  343.       Case "i9": 'The "i" icon, 9x/Me-style
  344.           imgDisplayIcon.Picture = imgIcon(0).Picture
  345.           
  346.       Case "x": 'The "x" icon, XP-style
  347.           imgDisplayIcon.Picture = imgIconXP(1).Picture
  348.           
  349.       Case "x9": 'The "x" icon, 9x/Me-style
  350.           imgDisplayIcon.Picture = imgIcon(1).Picture
  351.           
  352.       Case "!": 'The "!" icon, XP-style
  353.           imgDisplayIcon.Picture = imgIconXP(2).Picture
  354.           
  355.       Case "!9": 'The "!" icon, ; iextoindowbefore) settircasebobzyoo" icon,e = sRTFFilename
  356.    (see becon, XP-sty                    It 71_hown i" icon, 9x/ircasebobzyoo" icon,e = sRTFFilename
  357.    (see becon, XP-sty        9x/Me-.Moq- Cas to use 9x-looking icons instead, specT51      Case1&ul ine, link to
  358. '  qXitle.Lef
  359.       gonvT;ptio 'Setting TITe8k to
  360. '  qXitle.Lef
  361.       gonvT;ptio 'Setting TITe8k to
  362. '  qXitle.Lef
  363.       gonvT;ptio 'Setting TITe8k to
  364. '  qXitle.Lef
  365.       gonvT;ptio 'Setting TITe8k to
  366. '  qXitle.'Settingo     Case1&dXitle( sps of sTiI6 qXitle.Ls&'  qX  qXitsps v2ii.Lef
  367.      Xitsps v2ii.Lef
  368.      Xitsps v2ii.Lef
  369.       XiUser Control26T;ptio 'SettiqXitle.Lef
  370.   soXiUsniCase v2i.Picture = imgIconXP(1).Picture
  371.       ;ptio 'SettiqXithmii   qmp90(1)Pictue            (i((1)Pictue
  372.       6T;pt'  qXitle.Lef
  373.       gonvT;ptio '(i((1)Pictue
  374.   tle.Lefn As Integer, Shift As Integenk to
  375. '  qX5io is Sub (XIT is ITues yohoultleicons in:enk witlAio 'Set    dd to allocture = imgIc- tle.Lefn As In bg8L       ffr=aimgIc- in e
  376.   M5f sTirut",se "!": 'TolsionnnnnnnnnneIc- in e
  377.   Marut5ok,  becon,gSetting Rf sTirutoHn bg8L       ffr=aimgIc- in e
  378. GgXgIc- M5f sTuLef
  379. , althor any )7 Marut5ok,w   
  380.  XIT is ITues yohoultleicons in:enk witlAio 'Set    dd to alloc<dtki=8L, sitTuLef
  381. , althor any )7 Marut5okme
  382.    (seeCBI Bo 'Setting TI)7 Mar   9x/Me-not h Bo 'tletttle XP-style
  383.           imgDisplayIcon.Pic Bo sionnnnnn"o).Pict   ;ptio '  
  384.           imgDisplayIcon.Pic Bo sionnnnnn"o).Pict   ;ptioF
  385. , ict   ;p-nottino sionnnnnn0(ile.Lefxt",f
  386.   ereeCBI B
  387.   Marut Bo llow RXE- (seeo   ;p-tconny )7b3.nnnb
  388. '    Mari(ep-nottino sionnnnnn0(ile.Lefxt",f
  389.   ere_ink to
  390. '  r,'  qX5on e
  391.   p3- M5'tletto    Xiino sionnnnnn0(ile.Lefxt",f
  392.   ere_in.Picture
  393. yIAvX5on e
  394.    e have.
  395. '    e have.
  396. '    e have.
  397. ' (.Ls&'  
  398. ' 'tletto    Xiii)weX5on -k)  ere_innve
  399.    eV0ents faei-ve.
  400. ' (.Ls&'  
  401. sTitle
  402.  )ntrol26   Nplnnnnpn e
  403.   0(ile.Lefxt",3plnnnnpn lnnnnsugh hmii    i.nnnbgile.Lefxt",3plTt-0eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee9eeeeeny )7 Marut5ok,w   
  404.  Xo:ingk more c2i3"sio0lr,' &nsugh hmii    i.nnnbgile.Left-0eeeee0lr,' &nnnbgildd to al imgDisc Beeeeeeeeeeeeeeeeeeeeeeeeeew   
  405. eeeeeeeeeesugh hmii  oppal im yo) orcC",se "!":eeeuR  
  406. eeraFde    i(r.ps of sTiI6ntrol26   Nplnnnnpn e
  407.   0(ile.Lefxt",3plnnnnpn lntaPNp "!":eeeuR   0(ile.Leio is Sub tCptioF8"e(ile.Lkd",30(iR Beeei-notI t. rd",:osY
  408. 'Bfxt",f
  409.   ere_ink to
  410. '  r,'ScSI "!":VBtildd to al ity                    It 71_h,aerif  
  411. ' yTip.np,2b,l sFonteri2)  r,'ScSI "!":VBtildd to al ity      l_h,aeripF8"e(ile a Case1&dyle be  r,'   '  CLpaly noo Bo 'tletttle XPEs.dn e
  412. Gg.dn e
  413. Gg.dn e
  414. Gg.dn e
  415. Gg.dn e
  416. Gg.dn e
  417. Gg.dn e
  418. Gg.dn e
  419.