FrameQQ.ctl
上传用户:yj36_1982
上传日期:2022-07-13
资源大小:63k
文件大小:18k
源码类别:

界面编程

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.UserControl QQ_Frame 
  3.    Appearance      =   0  'Flat
  4.    AutoRedraw      =   -1  'True
  5.    BackColor       =   &H80000005&
  6.    ClientHeight    =   495
  7.    ClientLeft      =   0
  8.    ClientTop       =   0
  9.    ClientWidth     =   1005
  10.    ControlContainer=   -1  'True
  11.    ScaleHeight     =   33
  12.    ScaleMode       =   3  'Pixel
  13.    ScaleWidth      =   67
  14.    ToolboxBitmap   =   "FrameQQ.ctx":0000
  15.    Begin VB.Image img 
  16.       Height          =   240
  17.       Left            =   0
  18.       Picture         =   "FrameQQ.ctx":0312
  19.       Top             =   0
  20.       Visible         =   0   'False
  21.       Width           =   255
  22.    End
  23.    Begin VB.Label lbl 
  24.       Alignment       =   2  'Center
  25.       Appearance      =   0  'Flat
  26.       AutoSize        =   -1  'True
  27.       BackColor       =   &H80000005&
  28.       Caption         =   " Frame1"
  29.       ForeColor       =   &H00000000&
  30.       Height          =   195
  31.       Left            =   360
  32.       TabIndex        =   24
  33.       Top             =   0
  34.       Width           =   570
  35.    End
  36.    Begin VB.Label dot 
  37.       BackStyle       =   0  'Transparent
  38.       Caption         =   "."
  39.       ForeColor       =   &H8000000B&
  40.       Height          =   255
  41.       Index           =   0
  42.       Left            =   9000
  43.       TabIndex        =   23
  44.       Top             =   240
  45.       Width           =   135
  46.    End
  47.    Begin VB.Label dot 
  48.       BackStyle       =   0  'Transparent
  49.       Caption         =   "."
  50.       ForeColor       =   &H8000000B&
  51.       Height          =   255
  52.       Index           =   1
  53.       Left            =   9000
  54.       TabIndex        =   22
  55.       Top             =   0
  56.       Width           =   135
  57.    End
  58.    Begin VB.Label dot 
  59.       BackStyle       =   0  'Transparent
  60.       Caption         =   "."
  61.       ForeColor       =   &H8000000B&
  62.       Height          =   255
  63.       Index           =   2
  64.       Left            =   9000
  65.       TabIndex        =   21
  66.       Top             =   0
  67.       Width           =   135
  68.    End
  69.    Begin VB.Label dot 
  70.       BackStyle       =   0  'Transparent
  71.       Caption         =   "."
  72.       ForeColor       =   &H8000000B&
  73.       Height          =   255
  74.       Index           =   3
  75.       Left            =   9000
  76.       TabIndex        =   20
  77.       Top             =   0
  78.       Width           =   135
  79.    End
  80.    Begin VB.Label dot 
  81.       BackStyle       =   0  'Transparent
  82.       Caption         =   "."
  83.       ForeColor       =   &H8000000B&
  84.       Height          =   255
  85.       Index           =   4
  86.       Left            =   9000
  87.       TabIndex        =   19
  88.       Top             =   0
  89.       Width           =   135
  90.    End
  91.    Begin VB.Label dot 
  92.       BackStyle       =   0  'Transparent
  93.       Caption         =   "."
  94.       ForeColor       =   &H8000000B&
  95.       Height          =   255
  96.       Index           =   5
  97.       Left            =   9000
  98.       TabIndex        =   18
  99.       Top             =   0
  100.       Width           =   135
  101.    End
  102.    Begin VB.Label dot 
  103.       BackStyle       =   0  'Transparent
  104.       Caption         =   "."
  105.       ForeColor       =   &H8000000B&
  106.       Height          =   255
  107.       Index           =   6
  108.       Left            =   9000
  109.       TabIndex        =   17
  110.       Top             =   0
  111.       Width           =   135
  112.    End
  113.    Begin VB.Label dot 
  114.       BackStyle       =   0  'Transparent
  115.       Caption         =   "."
  116.       ForeColor       =   &H8000000B&
  117.       Height          =   255
  118.       Index           =   7
  119.       Left            =   9000
  120.       TabIndex        =   16
  121.       Top             =   0
  122.       Width           =   135
  123.    End
  124.    Begin VB.Label dot 
  125.       BackStyle       =   0  'Transparent
  126.       Caption         =   "."
  127.       ForeColor       =   &H8000000B&
  128.       Height          =   255
  129.       Index           =   8
  130.       Left            =   9000
  131.       TabIndex        =   15
  132.       Top             =   0
  133.       Width           =   135
  134.    End
  135.    Begin VB.Label dot 
  136.       BackStyle       =   0  'Transparent
  137.       Caption         =   "."
  138.       ForeColor       =   &H8000000B&
  139.       Height          =   255
  140.       Index           =   9
  141.       Left            =   9000
  142.       TabIndex        =   14
  143.       Top             =   0
  144.       Width           =   135
  145.    End
  146.    Begin VB.Label dot 
  147.       BackStyle       =   0  'Transparent
  148.       Caption         =   "."
  149.       ForeColor       =   &H8000000B&
  150.       Height          =   255
  151.       Index           =   10
  152.       Left            =   9000
  153.       TabIndex        =   13
  154.       Top             =   0
  155.       Width           =   135
  156.    End
  157.    Begin VB.Label dot 
  158.       BackStyle       =   0  'Transparent
  159.       Caption         =   "."
  160.       ForeColor       =   &H8000000B&
  161.       Height          =   255
  162.       Index           =   11
  163.       Left            =   9000
  164.       TabIndex        =   12
  165.       Top             =   0
  166.       Width           =   135
  167.    End
  168.    Begin VB.Label dot 
  169.       BackStyle       =   0  'Transparent
  170.       Caption         =   "."
  171.       ForeColor       =   &H8000000B&
  172.       Height          =   255
  173.       Index           =   12
  174.       Left            =   9000
  175.       TabIndex        =   11
  176.       Top             =   0
  177.       Width           =   135
  178.    End
  179.    Begin VB.Label dot 
  180.       BackStyle       =   0  'Transparent
  181.       Caption         =   "."
  182.       ForeColor       =   &H8000000B&
  183.       Height          =   255
  184.       Index           =   13
  185.       Left            =   9000
  186.       TabIndex        =   10
  187.       Top             =   0
  188.       Width           =   135
  189.    End
  190.    Begin VB.Label dot 
  191.       BackStyle       =   0  'Transparent
  192.       Caption         =   "."
  193.       ForeColor       =   &H8000000B&
  194.       Height          =   255
  195.       Index           =   14
  196.       Left            =   9000
  197.       TabIndex        =   9
  198.       Top             =   0
  199.       Width           =   135
  200.    End
  201.    Begin VB.Label dot 
  202.       BackStyle       =   0  'Transparent
  203.       Caption         =   "."
  204.       ForeColor       =   &H8000000B&
  205.       Height          =   255
  206.       Index           =   15
  207.       Left            =   9000
  208.       TabIndex        =   8
  209.       Top             =   0
  210.       Width           =   135
  211.    End
  212.    Begin VB.Label dot 
  213.       BackStyle       =   0  'Transparent
  214.       Caption         =   "."
  215.       ForeColor       =   &H8000000B&
  216.       Height          =   255
  217.       Index           =   16
  218.       Left            =   9000
  219.       TabIndex        =   7
  220.       Top             =   0
  221.       Width           =   135
  222.    End
  223.    Begin VB.Label dot 
  224.       BackStyle       =   0  'Transparent
  225.       Caption         =   "."
  226.       ForeColor       =   &H8000000B&
  227.       Height          =   255
  228.       Index           =   17
  229.       Left            =   9000
  230.       TabIndex        =   6
  231.       Top             =   0
  232.       Width           =   135
  233.    End
  234.    Begin VB.Label dot 
  235.       BackStyle       =   0  'Transparent
  236.       Caption         =   "."
  237.       ForeColor       =   &H8000000B&
  238.       Height          =   255
  239.       Index           =   18
  240.       Left            =   9000
  241.       TabIndex        =   5
  242.       Top             =   0
  243.       Width           =   135
  244.    End
  245.    Begin VB.Label dot 
  246.       BackStyle       =   0  'Transparent
  247.       Caption         =   "."
  248.       ForeColor       =   &H8000000B&
  249.       Height          =   255
  250.       Index           =   19
  251.       Left            =   9000
  252.       TabIndex        =   4
  253.       Top             =   0
  254.       Width           =   135
  255.    End
  256.    Begin VB.Label dot 
  257.       BackStyle       =   0  'Transparent
  258.       Caption         =   "."
  259.       ForeColor       =   &H8000000B&
  260.       Height          =   255
  261.       Index           =   20
  262.       Left            =   9000
  263.       TabIndex        =   3
  264.       Top             =   0
  265.       Width           =   135
  266.    End
  267.    Begin VB.Label dot 
  268.       BackStyle       =   0  'Transparent
  269.       Caption         =   "."
  270.       ForeColor       =   &H8000000B&
  271.       Height          =   255
  272.       Index           =   21
  273.       Left            =   9000
  274.       TabIndex        =   2
  275.       Top             =   0
  276.       Width           =   135
  277.    End
  278.    Begin VB.Label dot 
  279.       BackStyle       =   0  'Transparent
  280.       Caption         =   "."
  281.       ForeColor       =   &H8000000B&
  282.       Height          =   255
  283.       Index           =   22
  284.       Left            =   9000
  285.       TabIndex        =   1
  286.       Top             =   0
  287.       Width           =   135
  288.    End
  289.    Begin VB.Label dot 
  290.       BackStyle       =   0  'Transparent
  291.       Caption         =   "."
  292.       ForeColor       =   &H8000000B&
  293.       Height          =   255
  294.       Index           =   23
  295.       Left            =   9000
  296.       TabIndex        =   0
  297.       Top             =   0
  298.       Width           =   135
  299.    End
  300. End
  301. Attribute VB_Name = "QQ_Frame"
  302. Attribute VB_GlobalNameSpace = False
  303. Attribute VB_Creatable = True
  304. Attribute VB_PredeclaredId = False
  305. Attribute VB_Exposed = False
  306. ' **********************************************************************
  307. '  描  述:一组QQ风格控件
  308. '  由本人收集整理  http://www.qq.com
  309. ' **********************************************************************
  310. Dim mBackColor As OLE_COLOR                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'Aki
  311. Dim mForeColor As OLE_COLOR
  312. Dim mFont As Font
  313. Const defBackColor = vbButtonFace
  314. Const defForeColor = &HFF0000
  315. 'In this project I tried to use only one picture to make XpFrame but it was not that.
  316. 'The corners were like Microsoft Frame and I wanted XpFrame,so that was not the solution.
  317. 'Other solution was to use labels with caption " . ", only for corners.
  318. 'I had a problem when you change font to other size, but I fix that to, so everything
  319. 'is working perfect and you have now the final version of XpFrame->>by Aki.
  320. Private Sub UserControl_Initialize()
  321.     UserControl_Resize
  322. End Sub
  323. Private Sub UserControl_InitProperties()
  324.     Enabled = True
  325.     BackColor = defBackColor
  326.     Caption = Ambient.DisplayName
  327.     Set Font = UserControl.Ambient.Font
  328.     ForeColor = defForeColor
  329. End Sub
  330. Private Sub UserControl_Resize()
  331.     UserControl.ScaleMode = 3
  332.     UserControl.Cls
  333.     
  334.     Dim x, y, W, H, lblH As Integer
  335.         x = UserControl.ScaleWidth - 3
  336.         y = UserControl.ScaleHeight - 3
  337.         W = UserControl.ScaleWidth - 6
  338.         H = UserControl.ScaleHeight - 6 - (lbl.Height  2)
  339.         lblH = lbl.Height  2
  340.         
  341.             If lbl.Caption = "" Then
  342.                 lbl.Visible = False
  343.                     Else
  344.                         lbl.Visible = True
  345.             End If
  346.                 lbl.Top = 0
  347.                     lbl.Left = 0
  348.     
  349.     UserControl.PaintPicture img.Picture, 3 + 3, lblH, W - 6, 1, 3, 0, 16, 1 'painting top line
  350.     UserControl.PaintPicture img.Picture, x + 2, lblH + 6, 1, H - 6, 21, 3, 1, 14 'painting right line
  351.     UserControl.PaintPicture img.Picture, 3 + 3, y + 2, W - 6, 1, 3, 19, 16, 1 'painting bottom line
  352.     UserControl.PaintPicture img.Picture, 0, lblH + 6, 1, H - 6, 0, 3, 1, 14 'painting left line
  353.     
  354.     'starting to paint corners using labels with caption " . " --> ONLY corners
  355.     'to look perfect you must know that every corner needs 6 dots, so here we go...
  356.         
  357.     'painting left top
  358.     dot(0).Top = lblH - 5: dot(0).Left = UserControl.ScaleWidth - UserControl.ScaleWidth
  359.         dot(1).Top = lblH - 6: dot(1).Left = UserControl.ScaleWidth - UserControl.ScaleWidth
  360.             dot(2).Top = lblH - 7: dot(2).Left = UserControl.ScaleWidth - UserControl.ScaleWidth + 1
  361.                 dot(3).Top = lblH - 8: dot(3).Left = UserControl.ScaleWidth - UserControl.ScaleWidth + 2
  362.                     dot(4).Top = lblH - 9: dot(4).Left = UserControl.ScaleWidth - UserControl.ScaleWidth + 3
  363.                         dot(5).Top = lblH - 9: dot(5).Left = UserControl.ScaleWidth - UserControl.ScaleWidth + 4
  364.                             'painting right top
  365.                             dot(6).Top = lblH - 5: dot(6).Left = UserControl.ScaleWidth - 3
  366.                                 dot(7).Top = lblH - 6: dot(7).Left = UserControl.ScaleWidth - 3
  367.                                     dot(8).Top = lblH - 7: dot(8).Left = UserControl.ScaleWidth - 4
  368.                                         dot(9).Top = lblH - 8: dot(9).Left = UserControl.ScaleWidth - 5
  369.                                             dot(10).Top = lblH - 9: dot(10).Left = UserControl.ScaleWidth - 6
  370.                                                 dot(11).Top = lblH - 9: dot(11).Left = UserControl.ScaleWidth - 7
  371.                                                     'painting right down
  372.                                                     dot(12).Top = UserControl.ScaleHeight - 16: dot(12).Left = UserControl.ScaleWidth - 3
  373.                                                 dot(13).Top = UserControl.ScaleHeight - 15: dot(13).Left = UserControl.ScaleWidth - 3
  374.                                             dot(14).Top = UserControl.ScaleHeight - 14: dot(14).Left = UserControl.ScaleWidth - 4
  375.                                         dot(15).Top = UserControl.ScaleHeight - 13: dot(15).Left = UserControl.ScaleWidth - 5
  376.                                     dot(16).Top = UserControl.ScaleHeight - 12: dot(16).Left = UserControl.ScaleWidth - 6
  377.                                 dot(17).Top = UserControl.ScaleHeight - 12: dot(17).Left = UserControl.ScaleWidth - 7
  378.                             'painting left down
  379.                             dot(18).Top = UserControl.ScaleHeight - 16: dot(18).Left = (UserControl.ScaleWidth - UserControl.ScaleWidth)
  380.                         dot(19).Top = UserControl.ScaleHeight - 15: dot(19).Left = (UserControl.ScaleWidth - UserControl.ScaleWidth)
  381.                     dot(20).Top = UserControl.ScaleHeight - 14: dot(20).Left = (UserControl.ScaleWidth - UserControl.ScaleWidth) + 1
  382.                 dot(21).Top = UserControl.ScaleHeight - 13: dot(21).Left = (UserControl.ScaleWidth - UserControl.ScaleWidth) + 2
  383.             dot(22).Top = UserControl.ScaleHeight - 12: dot(22).Left = (UserControl.ScaleWidth - UserControl.ScaleWidth) + 3
  384.         dot(23).Top = UserControl.ScaleHeight - 12: dot(23).Left = (UserControl.ScaleWidth - UserControl.ScaleWidth) + 4
  385.         img.Left = lbl.Width + 500
  386. End Sub
  387. Private Sub lbl_Change()
  388.     UserControl_Resize
  389. End Sub
  390. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  391.     Enabled = PropBag.ReadProperty("Enabled", True)
  392.     Set Font = PropBag.ReadProperty("Font", UserControl.Ambient.Font)
  393.     BackColor = PropBag.ReadProperty("BackColor", defBackColor)
  394.     Caption = PropBag.ReadProperty("Caption", "Frame1")
  395.     ForeColor = PropBag.ReadProperty("ForeColor", defForeColor)
  396. End Sub
  397. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  398.     Call PropBag.WriteProperty("Caption", lbl.Caption, "Frame")
  399.     Call PropBag.WriteProperty("Enabled", UserControl.Enabled, True)
  400.     Call PropBag.WriteProperty("Font", mFont, UserControl.Ambient.Font)
  401.     Call PropBag.WriteProperty("BackColor", mBackColor, defBackColor)
  402.     Call PropBag.WriteProperty("ForeColor", mForeColor, defForeColor)
  403. End Sub
  404. Public Property Get Font() As Font
  405.     Set Font = mFont
  406. End Property
  407. Public Property Set Font(ByVal NewFont As Font)
  408.     Set mFont = NewFont
  409.     Set lbl.Font = mFont
  410.     UserControl_Resize
  411.     PropertyChanged "Font"
  412. End Property
  413. Public Property Get ForeColor() As OLE_COLOR
  414.     ForeColor = mForeColor
  415. End Property
  416. Public Property Let ForeColor(ByVal NewForeColor As OLE_COLOR)
  417.     mForeColor = NewForeColor
  418.     lbl.ForeColor = mForeColor
  419.     PropertyChanged "ForeColor"
  420. End Property
  421. Public Property Get BackColor() As OLE_COLOR
  422.     BackColor = mBackColor
  423. End Property
  424. Public Property Let BackColor(ByVal NewBackColor As OLE_COLOR)
  425.     mBackColor = NewBackColor
  426.     PropertyChanged "BackColor"
  427.     UserControl.BackColor = mBackColor
  428.     lbl.BackColor = mBackColor
  429.     UserControl_Resize
  430. End Property
  431. Public Property Get Caption() As String
  432.     Caption = lbl.Caption
  433. End Property
  434. Public Property Let Caption(ByVal NewCaption As String)
  435.     lbl.Caption() = NewCaption
  436.     UserControl_Resize
  437.     PropertyChanged "Caption"
  438. End Property
  439. Public Property Get Enabled() As Boolean
  440.     Enabled = UserControl.Enabled
  441. End Property
  442. Public Property Let Enabled(ByVal NewEnabled As Boolean)
  443.     UserControl.Enabled() = NewEnabled
  444.         If Enabled = True Then
  445.             lbl.ForeColor = &HFF0000
  446.                 Else
  447.                     lbl.ForeColor = &H80000011
  448.         End If
  449.     PropertyChanged "Enabled"
  450. End Property
  451.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            'Aki