Well... inspired by Arnold BCX GUI framework i think that
winH or called
awinhor whatever you whish deserve that is presented here on forum because it is
very simple and easy to use for GUI application.
I know that is not
the best and need some additions but work
here is the first example which show larger version without one small include
file called
miniH.inc which contain few drawing functions / nothing special /..
$ Filename "simple.exe" ' Oxygen Basic
Include "RTL32.inc"
Include "awinh.inc"
#lookahead
'GLOBALS for drawing to DC /// also caN BE INSIDE INCLUDE FILE //
INT hdc, hdcMem, hbmMem, oldBmp, oldBrush, oldPen, oldFont, fColor,bColor
INT textX,textY,hBrush
INT ww,hh
INT win,x=0,y=0,w=400,h=300,wstyle = WS_MINMAXSIZE,
win=SetWindow("Simple GUI App...",x,y,w,h,0,wstyle)
InitDrawing(win)
TextOn(win,100,100, "Hello World from BCX!")
Wait() 'message loop
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
Select hwnd
Case win
Select wmsg
CASE WM_PAINT
BitBlt(hDC, 0, 0, ww, hh, hdcMem, 0, 0, SRCCOPY)
Case WM_CLOSE
CloseWindow(win)
EndProgram
End Select
End Select
Return Default
End Function
'====================================================
'== NEXT BLOCK OF CODE YOU CAN PUT IN INCLUDE FILE ==
'====================================================
SUB InitDrawing(byval wnd as INT)
'INT ww,hh
''get current size of window
GetSize(wnd,0,0,ww,hh)
'get window DC
hdc=GetDC(wnd)
hdcMem = CreateCompatibleDC(0)
hbmMem = CreateCompatibleBitmap(hdc, ww, hh)
oldBmp = SelectObject( hdcMem, hbmMem )
oldBrush = SelectObject(hdcMem, CreateSolidBrush( RGB(231,223,231)) )
oldPen = SelectObject(hdcMem, CreatePen(PS_SOLID,1,RGB(231,223,231)))
'fill rectangle memDC with brush color
FillRect ( hdcMem,rc, oldBrush)
SetTextColor( hDC,RGB(0,0,0))
SetBkColor( hDC, RGB(231,223,231))
'blit to memDC
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wnd, hdc)
End SUB
'=================================================
SUB TextColor (wID as INT,byval frontColor as sys)
hdc = GetDC(wID)
sys bColor
fColor=frontColor
bColor = RGB(231,223,231)
SetTextColor( hDC, frontColor)
SetBkColor( hDC, bColor)
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wID, hdc)
End SUB
'=================================================
Sub TextOn( int wnd,sys x, y, string txt)
'INT ww,hh
hdc=GetDC(wnd)
GetSize(wnd,0,0,ww,hh)
TextOut sys_hdc,x,y,txt,Len(txt)
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC(wnd,Hdc)
End Sub
'=================================================
SUB LineXY (wID as INT,Lx as INT,Ly as INT,Lx1 as INT,Ly1 as INT)
hdc = GetDC(wID)
GetSize(wID,0,0,ww,hh)
SelectObject(hdc, CreatePen(PS_SOLID,1,fColor))
MoveToEx hdc,Lx,Ly,Byval 0
LineTo hdc,Lx1,Ly1
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wID, hdc)
End SUB
'=================================================
SUB Pset (wID as int , px as int ,py as int)
hdc = GetDC(wID)
'GetSize(wID,0,0,ww,hh)
SetPixel ( hdc, px, py, fColor)
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wID, hdc)
End SUB
'//////////////////////////////////////////////
SUB CleanUp
DeleteDC(hdcMem)
DeleteObject(SelectObject(hdcMem, oldBrush))
DeleteObject(SelectObject(hdcMem, oldPen))
DeleteObject(SelectObject(hdcMem, oldBmp))
End SUB