Changeset 14 for trunk/Components/ButtonB.pas
- Timestamp:
- Jan 7, 2017, 8:54:23 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Components/ButtonB.pas
r10 r14 30 30 procedure Register; 31 31 begin 32 RegisterComponents('Samples', [TButtonB]);32 RegisterComponents('Samples', [TButtonB]); 33 33 end; 34 34 35 35 constructor TButtonB.Create(aOwner: TComponent); 36 36 begin 37 inherited Create(aOwner);38 ShowHint:=true;39 SetBounds(0,0,25,25);37 inherited Create(aOwner); 38 ShowHint := true; 39 SetBounds(0, 0, 25, 25); 40 40 end; 41 41 42 42 procedure TButtonB.Paint; 43 43 begin 44 with Canvas do45 if FGraphic<>nil then44 with Canvas do 45 if FGraphic <> nil then 46 46 begin 47 BitBlt(Canvas.Handle,0,0,25,25,FGraphic.Canvas.Handle,48 169,243+26*Byte(FDown),SRCCOPY);49 if FIndex>=0 then47 BitBlt(Canvas.Handle, 0, 0, 25, 25, FGraphic.Canvas.Handle, 169, 48 243 + 26 * Byte(FDown), SRCCOPY); 49 if FIndex >= 0 then 50 50 begin 51 BitBlt(Canvas.Handle,0,0,25,25,FMask.Canvas.Handle,52 1+FIndex mod 12 *26,337+FIndex div 12 *26,SRCAND);53 BitBlt(Canvas.Handle,0,0,25,25,FGraphic.Canvas.Handle,54 1+FIndex mod 12 *26,337+FIndex div 12 *26,SRCPAINT);51 BitBlt(Canvas.Handle, 0, 0, 25, 25, FMask.Canvas.Handle, 52 1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCAND); 53 BitBlt(Canvas.Handle, 0, 0, 25, 25, FGraphic.Canvas.Handle, 54 1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCPAINT); 55 55 end 56 56 end 57 else begin Brush.Color:=$0000FF; FrameRect(Rect(0,0,25,25)) end 57 else 58 begin 59 Brush.Color := $0000FF; 60 FrameRect(Rect(0, 0, 25, 25)) 61 end 58 62 end; 59 63 60 64 procedure TButtonB.SetIndex(x: integer); 61 65 begin 62 if x<>FIndex then66 if x <> FIndex then 63 67 begin 64 FIndex:=x;65 Invalidate68 FIndex := x; 69 Invalidate 66 70 end 67 71 end; 68 72 69 73 end. 70
Note:
See TracChangeset
for help on using the changeset viewer.