VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Allows you to make a frame border from a shape control. The frame border will be similar with Windo

by Brandalls (EGA) (1 Submission)
Category: Graphics
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Fri 29th November 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Allows you to make a frame border from a shape control. The frame border will be similar with Windows XP frame. The frame cannot contain any

API Declarations


'No API used.
'To use, please follow these step:
'• Place a shape control with name: "ShpFrame" for example
'• The frame's caption determined by the shape's tag
'• Place this procedure
'• Call CXMakeFrame(Form1, ShpFrame, 900)
'It means: (object supporting 'line', Shape control, Caption width)
'Determine caption width yourself, for example:
'if the caption: "My Fake Frame", it may need about 900-1200 of CapWidth,
'if the caption: "Test", it may need about 360-480 of CapWidth.
'• Your fake XP frame was completed.
'
'Thank you.
'Ega,
'Brandalls Corporation
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
'You may place credit on your program by using this code! :)
'

Rate Allows you to make a frame border from a shape control. The frame border will be similar with Windo



Public Sub CXMakeFrame(CX_Obj As Object, FrameRef As VB.Shape, Optional CapWidth%)
Dim CX%, CY%, Color As Long, SvFont$, SvFSize%
Dim SvB As Boolean, SvI As Boolean, SvU As Boolean
With CX_Obj
  CX = .CurrentX: CY = .CurrentY: Color = .ForeColor
  SvFont = .FontName: SvFSize = .FontSize
  SvB = .FontBold: SvI = .FontItalic: SvU = .FontUnderline
End With
'Settings have been saved
FrameRef.Visible = False
If CapWidth > FrameRef.Width - 240 Then CapWidth = 240
With FrameRef
  If FrameRef.Tag <> "" Then
    'Top 1st border
    CX_Obj.Line (.Left + 30, .Top)-(.Left + 90, .Top), &HBFD0D0, B
    'Top 2nd border
    CX_Obj.Line (.Left + 120 + CapWidth + 60, .Top)-(.Width + .Left - 45, .Top), &HBFD0D0, B
  Else
    CX_Obj.Line (.Left + 30, .Top)-(.Width + .Left - 45, .Top), &HBFD0D0, B
  End If
  'Print caption
  CX_Obj.CurrentX = .Left + 150: CX_Obj.CurrentY = .Top - 90
  CX_Obj.ForeColor = &HD54600
  CX_Obj.FontSize = 8: CX_Obj.FontBold = False: CX_Obj.FontItalic = False
  CX_Obj.FontUnderline = False
  CX_Obj.Print FrameRef.Tag
  'Left border
  CX_Obj.Line (.Left, .Top + 30)-(.Left, .Top + .Height - 45), &HBFD0D0, B
  'Right border
  CX_Obj.Line (.Left + .Width - 15, .Top + 30)-(.Left + .Width - 15, .Top + .Height - 45), &HBFD0D0, B
  'Bottom border
  CX_Obj.Line (.Left + 30, .Top + .Height - 15)-(.Left + .Width - 45, .Top + .Height - 15), &HBFD0D0, B
  'Create Left-Up Corner
  CX_Obj.Line (.Left, .Top + 30)-(.Left + 30, .Top), &HBFD0D0
  CX_Obj.Line (.Left, .Top + 45)-(.Left + 45, .Top), &HBFD0D0
  'Create Right-Up Corner
  CX_Obj.Line (.Left + .Width - 45, .Top)-(.Left + .Width, .Top + 45), &HBFD0D0
  CX_Obj.Line (.Left + .Width - 60, .Top)-(.Left + .Width, .Top + 60), &HBFD0D0
  'Create Right-Down Corner
  CX_Obj.Line (.Left + .Width - 45, .Top + .Height - 15)-(.Left + .Width, .Top + .Height - 60), &HBFD0D0
  CX_Obj.Line (.Left + .Width - 60, .Top + .Height - 15)-(.Left + .Width, .Top + .Height - 60), &HBFD0D0
  'Create Left-Down Corner
  CX_Obj.Line (.Left, .Top + .Height - 45)-(.Left + 30, .Top + .Height - 15), &HBFD0D0
  CX_Obj.Line (.Left, .Top + .Height - 60)-(.Left + 45, .Top + .Height - 15), &HBFD0D0
End With
'Restore settings
With CX_Obj
  .CurrentX = CX: .CurrentY = CY: .ForeColor = Color
  .FontName = SvFont: .FontSize = SvFSize
  .FontBold = SvB: .FontItalic = SvI: .FontUnderline = SvU
End With
End Sub
'
'
'Ega,
'Brandalls Corporation
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
'I'm glad if you place credit on your program by using this code! :)
'

Download this snippet    Add to My Saved Code

Allows you to make a frame border from a shape control. The frame border will be similar with Windo Comments

No comments have been posted about Allows you to make a frame border from a shape control. The frame border will be similar with Windo. Why not be the first to post a comment about Allows you to make a frame border from a shape control. The frame border will be similar with Windo.

Post your comment

Subject:
Message:
0/1000 characters