-
draw on a frame control
[Originally posted by harshad]
how to draw on a frame using api's
though i get hdc using Getdc function still
drawing on a frame is not possible
-
Re:draw on a frame control
[Originally posted by neophile]
You could make your own Frame with a PictureBox and a Label...
' On a Form, place a PictureBox with a
' a Label control inside it...
Option Explicit
Private Const BDR_SUNKENOUTER = &H2
Private Const BDR_RAISEDINNER = &H4
Private Const EDGE_ETCHED = (BDR_SUNKENOUTER Or BDR_RAISEDINNER)
Private Const BF_BOTTOM = &H8
Private Const BF_LEFT = &H1
Private Const BF_RIGHT = &H4
Private Const BF_TOP = &H2
Private Const BF_RECT = (BF_LEFT Or BF_TOP Or BF_RIGHT Or BF_BOTTOM)
Private Type RECT
ÿ ÿ Left As Long
ÿ ÿ Top As Long
ÿ ÿ Right As Long
ÿ ÿ Bottom As Long
End Type
Private Declare Function DrawEdge Lib "user32" (ByVal hdc As Long, qrc As RECT, ByVal edge As Long, ByVal grfFlags As Long) As Long
Private Sub Form_Load()
ÿ ÿ Dim vR As RECT
ÿ ÿ
ÿ ÿ With Picture1
ÿ ÿ ÿ ÿ .BorderStyle = 0
ÿ ÿ ÿ ÿ .AutoRedraw = True
ÿ ÿ ÿ ÿ .ScaleMode = vbPixels
ÿ ÿ ÿ ÿ vR.Right = .ScaleWidth - 1
ÿ ÿ ÿ ÿ vR.Bottom = .ScaleHeight - 1
ÿ ÿ End With
ÿ ÿ With Label1
ÿ ÿ ÿ ÿ .Top = 0
ÿ ÿ ÿ ÿ .Left = 8
ÿ ÿ ÿ ÿ vR.Top = .Height / 2
ÿ ÿ End With
ÿ ÿ Call DrawEdge(Picture1.hdc, vR, EDGE_ETCHED, BF_RECT)
ÿ ÿ Picture1.Refresh
End Sub
... that way, you have a PictureBox to draw on ;)
The only other way I could think to do it would be to hook into the Frame control's window and process WM_PAINT messages yourself (but that sounds a little messy to me.)
The above code isn't a perfect clone of a Frame, so you may want to look up DrawText() instead of using a Label.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks