$PBExportHeader$u_paint.sru $PBExportComments$Base visual for custom painting forward global type u_paint from u_base_container end type type uo_pbnicanvas from uo_canvas within u_paint end type end forward global type u_paint from u_base_container integer width = 722 integer height = 140 boolean border = true long backcolor = 134217731 event ke_paint ( ref n_svc_mgr anv_svc, readonly unsignedlong hdc ) event type long ke_doubleclicked ( readonly unsignedlong flags, readonly integer xpos, readonly integer ypos ) event ke_mousemove pbm_mousemove event type long ke_lbuttondown ( readonly unsignedlong flags, readonly integer xpos, readonly integer ypos ) event type long ke_clicked ( readonly unsignedlong flags, readonly integer xpos, readonly integer ypos ) event type long ke_rbuttondown ( readonly unsignedlong flags, readonly integer xpos, readonly integer ypos ) uo_pbnicanvas uo_pbnicanvas end type global u_paint u_paint type prototypes FUNCTION ulong SetBkMode(ulong hdc,ulong nBkMode) LIBRARY "gdi32.dll" FUNCTION ulong SetTextColor(ulong hdc,ulong crColor) LIBRARY "gdi32.dll" FUNCTION ulong SelectObject(ulong hdc,ulong hObject) LIBRARY "gdi32.dll" FUNCTION ulong DeleteObject(ulong hObject) LIBRARY "gdi32.dll" FUNCTION ulong DrawText(ulong hdc,ref string lpStr,ulong nCount,ref RECT lpRect,ulong wFormat) LIBRARY "user32.dll" ALIAS FOR "DrawTextA;Ansi" FUNCTION ulong CreateFontIndirect(ref LOGFONT lpLogFont) LIBRARY "gdi32.dll" ALIAS FOR "CreateFontIndirectA;Ansi" FUNCTION ulong GetSysColor(ulong nIndex) LIBRARY "user32.dll" FUNCTION long FillRect(ulong hdc, ref RECT rc, ulong hBrush) LIBRARY "user32.dll" FUNCTION long CreateSolidBrush(long color) LIBRARY "gdi32.dll" FUNCTION ulong CreatePen(ulong nPenStyle,ulong nWidth,ulong crColor) LIBRARY "gdi32.dll" FUNCTION ulong MoveToEx(ulong hdc,ulong lx,ulong ly,ref POINT lpPoint) LIBRARY "gdi32.dll" alias for "MoveToEx;Ansi" FUNCTION ulong LineTo(ulong hdc,ulong lx,ulong ly) LIBRARY "gdi32.dll" FUNCTION Boolean Polygon(ulong hdc, ref POINT ppoint[], int count) Library "GDI32.DLL" FUNCTION boolean GetClientRect (ulong hWnd, ref RECT lpRect) Library "USER32.DLL" alias for "GetClientRect;Ansi" FUNCTION long FillRect(ulong hdc, ref RECT rc, long hBrush) LIBRARY "user32.dll" end prototypes type variables Public: Boolean #ShowBorder Protected: rect istr_rect end variables event ke_paint(ref n_svc_mgr anv_svc, readonly unsignedlong hdc);//triggered on paint end event event type long ke_doubleclicked(readonly unsignedlong flags, readonly integer xpos, readonly integer ypos);RETURN CRet.NO_ACTION end event event type long ke_lbuttondown(readonly unsignedlong flags, readonly integer xpos, readonly integer ypos);RETURN EVENT ke_clicked(flags, xpos, ypos) end event event type long ke_clicked(readonly unsignedlong flags, readonly integer xpos, readonly integer ypos);RETURN CRet.NO_ACTION end event event type long ke_rbuttondown(readonly unsignedlong flags, readonly integer xpos, readonly integer ypos);//fired on right click RETURN CRet.NO_ACTION end event on u_paint.create int iCurrent call super::create this.uo_pbnicanvas=create uo_pbnicanvas iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.uo_pbnicanvas end on on u_paint.destroy call super::destroy destroy(this.uo_pbnicanvas) end on event ke_preopen;call super::ke_preopen;this.Border = FALSE //set the background color n_svc_theme lnv_theme n_svc_mgr lnv_svc lnv_svc.of_LoadSvc(lnv_theme, CSvc.THEME) this.BackColor = lnv_theme.of_GetBorderColor(lnv_svc) end event event ke_resize;call super::ke_resize;int lx, ly lx = PixelsToUnits(1, XPixelsToUnits!) ly = PixelsToUnits(1, YPixelsToUnits!) IF #ShowBorder THEN uo_pbnicanvas.Move(lx, ly) uo_pbnicanvas.Resize(newwidth - (lx * 2), newheight - (ly * 2)) ELSE uo_pbnicanvas.Move(0, 0) uo_pbnicanvas.Resize(newwidth, newheight) END IF end event type uo_pbnicanvas from uo_canvas within u_paint event resize pbm_size event ondoubleclick pbm_lbuttondblclk event onmousemove pbm_mousemove event onlbuttondown pbm_lbuttondown integer width = 713 integer height = 136 integer taborder = 10 long backcolor = 67108864 end type event resize;n_svc_mgr lnv_svc n_svc_win32 lnv_win32 lnv_svc.of_LoadSvc(lnv_win32, CSvc.WIN32) lnv_win32.GetClientRect(Handle(this), istr_rect) end event event ondoubleclick;RETURN parent.EVENT ke_doubleclicked(flags, xpos, ypos) end event event onmousemove;RETURN parent.EVENT ke_mousemove(flags, xpos, ypos) end event event onlbuttondown;RETURN parent.EVENT ke_lbuttondown(flags, xpos, ypos) end event on uo_pbnicanvas.destroy call uo_canvas::destroy end on event onpaint;call super::onpaint;n_svc_mgr lnv_svc parent.EVENT ke_paint(lnv_svc, hdc) RETURN 0 end event event rbuttondown;call super::rbuttondown;RETURN parent.EVENT ke_rbuttondown(flags, xpos, ypos) end event event other;call super::other;CONSTANT long WM_PRINTCLIENT = 792 //process this message for AnimateWindow IF ISVALID(Message) THEN IF Message.Number = WM_PRINTCLIENT THEN n_svc_mgr lnv_svc parent.EVENT ke_paint(lnv_svc, wparam) RETURN 0 END IF END IF end event
- Sources
- Kodigo
- OpenExplorer
- u_paint.sru
File: u_paint.sru
Size: 5281
Date: Mon, 07 Apr 2008 21:31:56 +0200
Size: 5281
Date: Mon, 07 Apr 2008 21:31:56 +0200
- u_base_container u_paint(sru)
- ke_clicked(readonly unsignedlong flags, readonly integer xpos, readonly integer ypos) returns long
- ke_doubleclicked(readonly unsignedlong flags, readonly integer xpos, readonly integer ypos) returns long
- ke_lbuttondown(readonly unsignedlong flags, readonly integer xpos, readonly integer ypos) returns long
- ke_rbuttondown(readonly unsignedlong flags, readonly integer xpos, readonly integer ypos) returns long
- ke_paint(ref n_svc_mgr anv_svc, readonly unsignedlong hdc)
- ke_preopen
- ke_resize
- uo_canvas uo_pbnicanvas