Страница: 1 |
|
Вопрос: CreatSolidBrash & CreatPen
|
Добавлено: 11.10.04 02:00
|
|
Автор вопроса: night-roll
|
может кто-нибудь набросать код (в двух словах), где рисуется прямоугольник(не существенно) с помощью АПИ, причём границы его одного цвета, заливка любого друго!
...у меня не получается :( рисуется либо заливка, либо граница...
помогите пж-ста!
Ответить
|
Номер ответа: 1 Автор ответа: cresta
Вопросов: 117 Ответов: 1538
|
Профиль | | #1
|
Добавлено: 11.10.04 05:58
|
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function FrameRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Declare Function FillRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hDC As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Sub Command1_Click()
 im R As RECT, hBrushFill As Long, hBrushFrame As Long, hDC As Long
hBrushFill = CreateSolidBrush(RGB(0, 0, 255))
hBrushFrame = CreateSolidBrush(RGB(255, 0, 0))
hDC = GetWindowDC(Me.hwnd)
SetRect R, 20, 40, 120, 140
FillRect hDC, R, hBrushFill
FrameRect hDC, R, hBrushFrame
 eleteObject hBrushFrame
 eleteObject hBrushFill
ReleaseDC Me.hwnd, hDC
End Sub
Ответить
|
Страница: 1 |
Поиск по форуму