Visual Basic, .NET, ASP, VBScript
 

   
   
     

Форум - Общий форум

Страница: 1 |

 

  Вопрос: Кайма по краю формы Добавлено: 31.10.03 10:39  

Автор вопроса:  Kovalenko P.S.

Есть форма с закругленными углами, углы закруглены при помощи:

WinAPI CreateRoundRectRgn...

Надо сделать тонкую каемку по краю формы...

Ответить

  Ответы Всего ответов: 5  

Номер ответа: 1
Автор ответа:
 Pashenko



ICQ: 176176951 

Вопросов: 14
Ответов: 655
 Профиль | | #1 Добавлено: 31.10.03 11:03
Отрисовывай свой регион:
Public Declare Function PaintRgn Lib "gdi32" Alias "PaintRgn" (ByVal hdc
As Long, ByVal hRgn As Long) As Long

Чтобы получить границу, надо рулить кистью (Brush):

"Declare Function CreateBrushIndirect Lib ""gdi32"" Alias
""CreateBrushIndirect"" (lpLogBrush As LOGBRUSH) As Long"
"Declare Function CreateDIBPatternBrush Lib ""gdi32"" Alias
""CreateDIBPatternBrush"" (ByVal hPackedDIB As Long, ByVal wUsage As
Long) As Long"
"Declare Function CreateDIBPatternBrushPt Lib ""gdi32"" Alias
""CreateDIBPatternBrushPt"" (lpPackedDIB As Any, ByVal iUsage As Long)
As Long"
"Declare Function CreateHatchBrush Lib ""gdi32"" Alias
""CreateHatchBrush"" (ByVal nIndex As Long, ByVal crColor As Long) As
Long"
"Declare Function CreatePatternBrush Lib ""gdi32"" Alias
""CreatePatternBrush"" (ByVal hBitmap As Long) As Long"
"Declare Function CreateSolidBrush Lib ""gdi32"" Alias
""CreateSolidBrush"" (ByVal crColor As Long) As Long"
"Declare Function SetBrushOrgEx Lib ""gdi32"" Alias ""SetBrushOrgEx""
(ByVal hdc As Long, ByVal nXOrg As Long, ByVal nYOrg As Long, lppt As
POINTAPI) As Long"
"Declare Function FixBrushOrgEx Lib ""gdi32"" Alias ""FixBrushOrgEx""
(ByVal hDC As Long, ByVal n1 As Long, ByVal n2 As Long, lpPoint As
POINTAPI) As Long"
"Declare Function GetBrushOrgEx Lib ""gdi32"" Alias ""GetBrushOrgEx""
(ByVal hDC As Long, lpPoint As POINTAPI) As Long"
"Declare Function GetSysColorBrush Lib ""user32"" Alias
""GetSysColorBrush"" (ByVal nIndex As Long) As Long"

и пером (Pen):

"Declare Function CreatePen Lib ""gdi32"" Alias ""CreatePen"" (ByVal
nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long"
"Declare Function CreatePenIndirect Lib ""gdi32"" Alias
""CreatePenIndirect"" (lpLogPen As LOGPEN) As Long"
"Declare Function ExtCreatePen Lib ""gdi32"" Alias ""ExtCreatePen""
(ByVal dwPenStyle As Long, ByVal dwWidth As Long, lplb As LOGBRUSH,
ByVal dwStyleCount As Long, lpStyle As Long) As Long"

Ответить

Номер ответа: 2
Автор ответа:
 Kovalenko P.S.



Вопросов: 3
Ответов: 4
 Профиль | | #2 Добавлено: 03.11.03 08:52

Как этим всем пользоваться???

Заранее благодарен.

Ответить

Номер ответа: 3
Автор ответа:
 Pashenko



ICQ: 176176951 

Вопросов: 14
Ответов: 655
 Профиль | | #3 Добавлено: 03.11.03 15:30
Честно говоря, не помню, вот что слепил навскидку:


Форма:

Autoredraw=true
Borderstyle=none
Fillstyle=solid
Fillcolor=0


Код формы:

Dim Rgn As Long, Rgn1 As Long
Private Sub Form_Load()
Rgn = CreateRoundRectRgn(0, 0, Me.Width / Screen.TwipsPerPixelX,
Me.Height / Screen.TwipsPerPixelY, 50, 50)
Rgn1 = CreateRoundRectRgn(1, 1, Me.Width / Screen.TwipsPerPixelX
- 1, Me.Height / Screen.TwipsPerPixelY - 1, 48, 48)

SetWindowRgn Me.hwnd, Rgn, True

Me.FillColor = &HFFFFFF
PaintRgn Me.hdc, Rgn1

DeleteObject Rgn

End Sub


Модуль:

Public Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As
Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As
Long, ByVal Y3 As Long) As Long
Public Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long,
ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long)
As Long
Public Declare Function PaintRgn Lib "gdi32" (ByVal hdc As Long, ByVal
hRgn As Long) As Long

Ответить

Номер ответа: 4
Автор ответа:
 Kovalenko P.S.



Вопросов: 3
Ответов: 4
 Профиль | | #4 Добавлено: 04.11.03 06:24

Огромное человеческое Спасибо!!!

Ответить

Номер ответа: 5
Автор ответа:
 Pashenko



ICQ: 176176951 

Вопросов: 14
Ответов: 655
 Профиль | | #5 Добавлено: 04.11.03 09:23
Вечером накопал:

Public Declare Function RoundRect Lib "gdi32" Alias "RoundRect" (ByVal
hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal
Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long

Без всяких регионов и рисует с теми параметрами, которые установлены для
формы.

Пример:
RoundRect Me.hdc, 0, 0, Me.Width / Screen.TwipsPerPixelX, Me.Height /
Screen.TwipsPerPixelY, 50, 50

Ответить

Страница: 1 |

Поиск по форуму



© Copyright 2002-2011 VBNet.RU | Пишите нам