$PBExportHeader$u_cst_gradient.sru forward global type u_cst_gradient from u_cst_canvas end type type st_name from statictext within u_cst_gradient end type type rect from structure within u_cst_gradient end type end forward type rect from structure long left long top long right long bottom end type global type u_cst_gradient from u_cst_canvas integer width = 1070 integer height = 612 long backcolor = 8421376 st_name st_name end type global u_cst_gradient u_cst_gradient type prototypes Function Boolean GetClientRect( & Long hWnd, & Ref RECT lpRect & ) Library "user32.dll" end prototypes type variables Public: Boolean VertGradientFill Boolean HorzGradientFill Private: Long GradientColor1 = 12639424 // Mint Long GradientColor2 = 15780518 // Sky end variables forward prototypes protected subroutine of_paintbackcolor (long hdc) public subroutine setgradientcolor (long al_color1, long al_color2) public subroutine setvertgradientfill (boolean ab_value) public subroutine sethorzgradientfill (boolean ab_value) end prototypes protected subroutine of_paintbackcolor (long hdc);RECT rc n_gradient ln_gradient Integer li_Width, li_Height Long ll_hWnd, ll_backcolor1, ll_backcolor2 // get control size ll_hWnd = Handle(this) GetClientRect(ll_hWnd, rc) // determine background colors If VertGradientFill Or HorzGradientFill Then ll_backcolor1 = GetPBColor(GradientColor1) ll_backcolor2 = GetPBColor(GradientColor2) Else // normal background ll_backcolor1 = GetPBColor(BackColor) ll_backcolor2 = ll_backcolor1 End If // draw the background If VertGradientFill Then ln_gradient.Vertical(hdc, rc.Top, rc.Left, & rc.Right, rc.Bottom, ll_backcolor1, ll_backcolor2) Else ln_gradient.Horizontal(hdc, rc.Top, rc.Left, & rc.Right, rc.Bottom, ll_backcolor1, ll_backcolor2) End If end subroutine public subroutine setgradientcolor (long al_color1, long al_color2);GradientColor1 = al_color1 GradientColor2 = al_color2 SetRedraw(True) end subroutine public subroutine setvertgradientfill (boolean ab_value);VertGradientFill = ab_value SetRedraw(True) end subroutine public subroutine sethorzgradientfill (boolean ab_value);HorzGradientFill = ab_value SetRedraw(True) end subroutine on u_cst_gradient.create int iCurrent call super::create this.st_name=create st_name iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.st_name end on on u_cst_gradient.destroy call super::destroy destroy(this.st_name) end on event constructor;call super::constructor;// set control transparency of_SetTransparent(True) end event event wm_paint;call super::wm_paint;// draw the background of_PaintBackColor(hdc) Return 0 end event type st_name from statictext within u_cst_gradient integer x = 37 integer y = 32 integer width = 517 integer height = 68 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 16777215 long backcolor = 8421376 string text = "Gradient" boolean focusrectangle = false end type event constructor;this.Visible = False end event
File: u_cst_gradient.sru
Size: 3280
Date: Mon, 31 Dec 2018 21:14:38 +0100
Size: 3280
Date: Mon, 31 Dec 2018 21:14:38 +0100
- u_cst_canvas u_cst_gradient(sru)
- of_paintbackcolor (long hdc)
- setgradientcolor (long al_color1, long al_color2)
- sethorzgradientfill (boolean ab_value)
- setvertgradientfill (boolean ab_value)
- statictext st_name