Page 1 of 1
API RoundRect function
Posted: Sat May 28, 2005 8:46 pm
by Num3
What's wrong with my code!
It simply does not draw a rounded rectangle....
Grrrrrrrrr
Code: Select all
dc.l=OpenWindow(0,10,10,600,400,#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget,"teste")
If dc
Debug roundrect_(dc,50, 50, 250, 150, 50, 50)
Repeat
Event=WaitWindowEvent()
Until Event=#PB_EventCloseWindow
EndIf
Posted: Sat May 28, 2005 8:51 pm
by Polo
Code: Select all
OpenWindow(0,10,10,600,400,#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget,"teste")
hwnd=WindowID()
hdc=GetDC_(hwnd)
roundrect_(hdc,50, 50, 250, 150, 50, 50)
Repeat
Event=WaitWindowEvent()
Until Event=#PB_EventCloseWindow
OpenWindow doesn't return the hdc handle.
Posted: Sat May 28, 2005 8:54 pm
by Num3
I'm so stupid....
Too much time looking at VB code
BTW:
Anyone knows how to make these kind of artifacts not get destroyed when you overlap another window !??!?!?
Posted: Sat May 28, 2005 8:59 pm
by Polo
I think there's an event that tell you when there's a need of redrawing but I can't remember which one
Sparkie, we need your help

Posted: Sat May 28, 2005 9:01 pm
by Num3
Ehehehe
I'm just trying to make Firefox like Frame3DGadgets (rounded corners)
Posted: Sat May 28, 2005 11:04 pm
by Sparkie
This isn't my strong area but this seems to work. Maybe someone with more knowledge will improve on it.
Code: Select all
Procedure myCallback(hwnd, msg, wparam, lparam)
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_PAINT
hdc = BeginPaint_(hwnd, @ps.PAINTSTRUCT)
RoundRect_(hdc,50, 50, 250, 150, 50, 50)
EndPaint_(hwnd,@ps)
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(0,10,10,600,400,#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget,"teste")
SetWindowCallback(@myCallback())
UpdateWindow_(WindowID())
Repeat
event=WaitWindowEvent()
Until event=#PB_EventCloseWindow
Posted: Mon May 30, 2005 12:26 am
by einander
Another one:
Code: Select all
Procedure RoundRect(DC,x,y,x1,y1,Rim,RimRGB,BkRGB,angle1,angle2)
If Rim=0:RimRGB=BkRGB:EndIf
Pen=CreatePen_( #ps_insideframe,Rim,RimRGB)
brush = CreateSolidBrush_(BkRGB )
SelectObject_(DC,pen)
SelectObject_(DC,brush)
RoundRect_(DC,x,y,x1,y1,angle1,angle2)
DeleteObject_(pen)
DeleteObject_(brush)
EndProcedure
hWnd = OpenWindow(0,0,0,0,0 , #WS_OVERLAPPEDWINDOW | #WS_MAXIMIZE,"")
hDC = GetDC_(hWnd)
RoundRect(hdc,100,100,400,300,4,#blue,RGB(230,230,255) ,20,20)
Repeat
Until WaitWindowEvent()= #PB_Event_CloseWindow