loading...
مرجع مهندسی نرم افزار
آخرین ارسال های انجمن
حامد شیرزاد بازدید : 692 سه شنبه 24 آبان 1390 نظرات (0)
 
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.

 

حامد شیرزاد بازدید : 464 شنبه 21 آبان 1390 نظرات (0)
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;

 

حامد شیرزاد بازدید : 521 شنبه 21 آبان 1390 نظرات (0)
 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

درباره ما
به نام آنکه جان را فکرت آموخت در این وبلاگ سعی می شود به صورت تخصصی به مباحث مربوط به مهندسی نرم افزار به خصوص برنامه نویسی کامپیوتری پرداخته شود. مدیر وبلاگ : حامد شیرزاد
اطلاعات کاربری
  • فراموشی رمز عبور؟
  • آمار سایت
  • کل مطالب : 431
  • کل نظرات : 9
  • افراد آنلاین : 1
  • تعداد اعضا : 109
  • آی پی امروز : 19
  • آی پی دیروز : 185
  • بازدید امروز : 493
  • باردید دیروز : 718
  • گوگل امروز : 0
  • گوگل دیروز : 0
  • بازدید هفته : 1,542
  • بازدید ماه : 4,193
  • بازدید سال : 23,294
  • بازدید کلی : 791,822
  • کدهای اختصاصی

    قالب وبلاگ