矩形に3D効果を与える(U)          <TOP>


DrawEdge  矩形に3D効果を与える

GetDC 指定されたウィンドウのデバイスコンテキストのハンドルを取得
ReleaseDC デバイスコンテキストを解放
 

 

'================================================================
'= 矩形に3D効果を与える(U)
'=    (DrawEdge2.bas)
'================================================================
#include "Windows.bi"

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

' 矩形に3D効果を与える
Declare Function Api_DrawEdge& Lib "user32" Alias "DrawEdge" (ByVal hDC&, qrc As RECT, ByVal edge&, ByVal grfFlags&)

' 指定されたウィンドウのデバイスコンテキストのハンドルを取得
Declare Function Api_GetDC& Lib "user32" Alias "GetDC" (ByVal hWnd&)

' デバイスコンテキストを解放
Declare Function Api_ReleaseDC& Lib "user32" Alias "ReleaseDC" (ByVal hWnd&, ByVal hDC&)

#define BF_LEFT &H1          '左辺を描画
#define BF_TOP &H2           '上辺を描画
#define BF_RIGHT &H4         '右辺に描画
#define BF_BOTTOM &H8        '矩形の下辺を描画
#define BF_RECT &HF          '上下左右の辺を描画

Var Shared hDC As Long

'================================================================
'=
'================================================================
Declare Sub MainForm_Start edecl ()
Sub MainForm_Start()
    hDC = Api_GetDC(GethWnd)
End Sub

'================================================================
'=
'================================================================
Declare Sub Button1_on edecl ()
Sub Button1_on()
    Var rc As RECT
    Var Ret As Long

    rc.Left = 10
    rc.Top = 35
    rc.Right = 100
    rc.Bottom = 74

    Ret = Api_DrawEdge(hDC, rc, BF_LEFT Or BF_RIGHT, BF_RECT)
End Sub

'================================================================
'=
'================================================================
Declare Sub Button2_on edecl ()
Sub Button2_on()
    Var rc As RECT
    Var Ret As Long

    rc.Left = 10
    rc.Top = 35
    rc.Right = 100
    rc.Bottom = 74
    Ret = Api_DrawEdge(hDC, rc, BF_TOP Or BF_BOTTOM, BF_RECT)
End Sub

'================================================================
'=
'================================================================
Declare Sub MainForm_QueryClose edecl ()
Sub MainForm_QueryClose()
    Var Ret As Long

    Ret = Api_ReleaseDC(GethWnd, hDC)
End Sub

'================================================================
'=
'================================================================
While 1
    WaitEvent
Wend
Stop
End