윈도우 (폼) 모양 바꾸기 - 1홍사훈 0건 334회 15-06-10 23:33 |
관련링크
본문
* 참고 자료 *
- CreateRectRgnIndirect API : https://msdn.microsoft.com/en-us/library/dd183515(VS.85).aspx
- CombineRgn API : https://msdn.microsoft.com/en-us/library/dd183465(VS.85).aspx
- SetWindowRgn API : https://msdn.microsoft.com/en-us/library/dd145102(VS.85).aspx
#Window_0_Button_0
#Window_0_Text_2
#Window_0_Container_3
#Window_0_CheckBox_4
#Window_0_Option_5
#Window_0_Frame3D_6
#Window_0_String_7
EndEnumeration
If OpenWindow(0, 396, 121, 456, 335, "Window_0", #PB_Window_BorderLess|#PB_Window_ScreenCentered)
SetWindowColor(0, #Blue)
a = ButtonGadget(#Window_0_Button_0, 30, 45, 90, 30, "프로그램 종료")
b = TextGadget(#Window_0_Text_2, 160, 45, 120, 30, "Gadget_2")
SetGadgetColor(#Window_0_Text_2, #PB_Gadget_BackColor, #Green)
c = ContainerGadget(#Window_0_Container_3, 30, 95, 350, 155)
CheckBoxGadget(#Window_0_CheckBox_4, 20, 30, 115, 25, "Gadget_4")
OptionGadget(#Window_0_Option_5, 20, 65, 115, 25, "Gadget_5")
Frame3DGadget(#Window_0_Frame3D_6, 10, 5, 190, 145, "Gadget_6")
StringGadget(#Window_0_String_7, 20, 95, 115, 30, "Gadget_7")
CloseGadgetList()
SetGadgetColor(#Window_0_Container_3, #PB_Gadget_BackColor, #Yellow)
;가젯의 클라이언트 좌표, 영역 구함.
GetClientRect_(a, r1.RECT)
GetClientRect_(b, r2.RECT)
GetClientRect_(c, r3.RECT)
;부모 윈도우 좌표로 변환.
MapWindowPoints_(a, WindowID(0), @r1, 2)
MapWindowPoints_(b, WindowID(0), @r2, 2)
MapWindowPoints_(c, WindowID(0), @r3, 2)
;각 가젯의 크기로 region 생성.
hRgn = CreateRectRgnIndirect_(r1)
hRgn2 = CreateRectRgnIndirect_(r2)
hRgn3 = CreateRectRgnIndirect_(r3)
;각 region을 hRgn 하나에 결합.
CombineRgn_(hRgn, hRgn, hRgn2, #RGN_OR)
CombineRgn_(hRgn, hRgn, hRgn3, #RGN_OR)
;불필요한 region 삭제.
DeleteObject_(hRgn2)
DeleteObject_(hRgn3)
;창에 region 설정.
SetWindowRgn_(WindowID(0), hRgn, 1)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #Window_0_Button_0 And EventType = #PB_EventType_LeftClick
Break
EndIf
Case #PB_Event_CloseWindow
Break
Case #WM_LBUTTONDOWN ;창에서 왼 버튼 누르고 드래그하여 창 이동.
SendMessage_(WindowID(0), #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
EndSelect
ForEver
DeleteObject_(hRgn)
EndIf
; IDE Options = PureBasic 4.60 RC 1 (Windows - x86)
; CursorPosition = 37
; CursorColumn = 43
; FirstLine = 27
; Folding = -
; EnableUnicode
; EnableXP
; EnableUser
; EnableBuildCount = 0
; EnableExeConstant
등록된 댓글이 없습니다.