آخرین ارسال های انجمن
| عنوان | پاسخ | بازدید | توسط |
| |
0 | 3000 | admin |
| |
0 | 1856 | admin |
| |
0 | 3906 | admin |
| |
0 | 2223 | admin |
| |
0 | 1998 | admin |

| عنوان | پاسخ | بازدید | توسط |
| |
0 | 3000 | admin |
| |
0 | 1856 | admin |
| |
0 | 3906 | admin |
| |
0 | 2223 | admin |
| |
0 | 1998 | admin |
unit AnalysisControl;
interface
uses Winprocs, Messages, Graphics, Controls, Classes;
type
TAnalysisControl = class( TCustomControl)
public
constructor Create(AOwner: TComponent); override;
procedure MouseDown( Button : TMouseButton;
Shift : TShiftState;
X, Y : integer); override;
procedure MouseMove( Shift : TShiftState;
X, Y : Integer);override;
procedure Paint; override;
end;
implementation
const
sizeBorder = 2;
sc_SizeLeft = $F001; { these are the variations }
sc_SizeRight = $F002; { on the SC_SIZE value }
sc_SizeTop = $F003;
sc_SizeTopLeft = $F004;
sc_SizeTopRight = $F005;
sc_SizeBottom = $F006;
sc_SizeBottomRight = $F008;
sc_SizeBottomLeft = $F007;
sc_DragMove = $F012;
constructor TAnalysisControl.Create(AOwner: TComponent);
begin
inherited;
Width := 100;
Height := 100;
end;
procedure TAnalysisControl.MouseDown( Button : TMouseButton;
Shift : TShiftState;
X, Y : integer);
begin
if Button = mbLeft then
begin
WinProcs.ReleaseCapture;
if(X >= Width - sizeBorder) And
NOT((Y <;= sizeBorder) or (Y >= Height -sizeBorder)) then
Self.Perform(WM_SysCommand, sc_SizeRight, 0)
else
if Not((X <;= sizeBorder) or (X >= Width -sizeBorder)) And
(Y <;= sizeBorder) then
Self.Perform(WM_SysCommand, sc_SizeTop, 0)
else
if (X <;= sizeBorder) And (Y <= sizeBorder) then
Self.Perform(WM_SysCommand, sc_SizeTopLeft, 0)
else
if (X >;= Width -sizeBorder) and (Y <= sizeBorder) then
Self.Perform(WM_SysCommand, sc_SizeTopRight , 0)
else
if Not((X <;= sizeBorder) or (X >= Width -sizeBorder)) And
(Y >;= Height - sizeBorder) then
Self.Perform(WM_SysCommand, sc_SizeBottom , 0)
else
if (Y >;= Height -sizeBorder) And (X <= sizeBorder) then
Self.Perform(WM_SysCommand, sc_SizeBottomLeft , 0)
else
if (Y >;= Height -sizeBorder) and (X >= Width - sizeBorder)
then
Self.Perform(WM_SysCommand, sc_SizeBottomRight , 0)
else
if Not((Y <;= sizeBorder) or (Y >= Height -sizeBorder)) And
(X <;= sizeBorder) then
Self.Perform(WM_SysCommand, sc_SizeLeft , 0)
else
begin
Self.Perform(WM_SysCommand, SC_DragMove, 0);
end;
end;
end;
procedure TAnalysisControl.Paint;
begin
With Canvas do
begin
Brush.Color := clRed;
Brush.Style := bsSolid;
FillRect( GetClientRect );
end;
end;
procedure TAnalysisControl.MouseMove( Shift : TShiftState;
X, Y : Integer );
begin
if ( X <;= sizeBorder ) or ( X >= Width -sizeBorder ) then
begin
if ( Y >;= Height - sizeBorder ) then
begin
if ( X >;= Width - sizeBorder ) then
Cursor := crSizeNWSE
else
Cursor := crSizeNESW;
end
else
if ( Y <;= sizeBorder ) then
begin
if ( X >;= Width -sizeBorder ) then
Cursor := crSizeNESW
else
Cursor := crSizeNWSE;
end
else
Cursor := crSizeWE;
end
else
if ( Y <;= sizeBorder ) or ( Y >= Height - sizeBorder ) then
begin
Cursor := crSizeNS;
end
else
Cursor := crDefault;
end;
end.
procedure TForm1.AppMessage (var Msg: TMsg; var Handled: boolean);
begin
if (Msg.Message = WM_SYSCOMMAND) and (Msg.wParam = SC_SCREENSAVE) then
Handled := true;
end;
On the form's OnCreate event, assign
Application.OnMessage := AppMessage;
uses Windows;
const TIME_ZONE_ID_UNKNOWN = 0;
TIME_ZONE_ID_STANDARD = 1;
TIME_ZONE_ID_DAYLIGHT = 2;
var tz : TTimeZoneInformation;
begin case GetTimeZoneInformation(tz) of TIME_ZONE_ID_STANDARD: ShowMessage(tz.StandardName);
TIME_ZONE_ID_DAYLIGHT: ShowMessage(tz.DaylightName);
else ShowMessage('Unknown state');
end;
end;
var FileInfo: TSHFileInfo;
2: begin
3: {to get a small icons}
4: imgListSysSmall := TImageList.Create(nil);
5: with imgListSysSmall do
6: begin
7: Handle := SHGetFileInfo('', 0, FileInfo, SizeOf(TSHFileInfo),
8: SHGFI_SMALLICON or SHGFI_SYSICONINDEX );
9: ShareImages := True;
10: end;
11:
12: {to get a small icons}
13: imgListSysLarge := TImageList.Create(nil);
14: with imgListSysLarge do
15: begin
16: Handle := SHGetFileInfo('', 0, FileInfo, SizeOf(TSHFileInfo),
17: SHGFI_LARGEICON or SHGFI_SYSICONINDEX );
18: ShareImages := True;
19: end;
20: end;
تعداد صفحات : 13