dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Feb 22, 1999

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Draw Frames on Form Without Control

The DrawEdge API provides a convenient way to draw a number of interesting effects. You can change the EDGE_ constants to give different border effects; the BF_ constants determine which borders are drawn (for example, BF_BOTTOM):
 
Private Declare Function DrawEdge Lib "user32" (ByVal hDC _
	As Long, qrc As RECT, ByVal edge As Long, ByVal _
	grfFlags As Long) As Long
Private Declare Function GetClientRect Lib "user32" _
	(ByVal hWnd As Long, lpRect As RECT) As Long

Private Type RECT
	Left As Long
	Top As Long
	Right As Long
	Bottom As Long
End Type

Const BDR_INNER = &HC
Const BDR_OUTER = &H3
Const BDR_RAISED = &H5
Const BDR_RAISEDINNER = &H4
Const BDR_RAISEDOUTER = &H1
Const BDR_SUNKEN = &HA
Const BDR_SUNKENINNER = &H8
Const BDR_SUNKENOUTER = &H2

Const BF_RIGHT = &H4
Const BF_LEFT = &H1
Const BF_TOP = &H2
Const BF_BOTTOM = &H8

Const EDGE_BUMP = (BDR_RAISEDOUTER Or BDR_SUNKENINNER)
Const EDGE_ETCHED = (BDR_SUNKENOUTER Or BDR_RAISEDINNER)
Const EDGE_RAISED = (BDR_RAISEDOUTER Or BDR_RAISEDINNER)
Const EDGE_SUNKEN = (BDR_SUNKENOUTER Or BDR_SUNKENINNER)
Const BF_RECT = (BF_LEFT Or BF_RIGHT Or BF_TOP Or BF_BOTTOM)
In the Form_Paint event, put this code where you wish to draw the rectangle:
 
Private Sub Form_Paint()
	Static Tmp As RECT
	Static TmpL As Long
	TmpL = GetClientRect(hWnd, Tmp)
	TmpL = DrawEdge(hDC, Tmp, EDGE_SUNKEN, BF_RECT)
End Sub
If the rectangle doesn't draw, do a Debug.Print on the TmpL variable. It should read a nonzero value upon success.
Jeff Shimano
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date