Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2008.05.04;
Скачать: CL | DM;

Вниз

Помогите поправить компонент   Найти похожие ветки 

 
Study   (2008-03-21 05:56) [0]

unit PageControlEx;

interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, ComCtrls, ExtCtrls, StdCtrls;

type
 TBorderStyleEx = (pcbsNone, pcbsOnePixel);

 TPageControlEx = class (ComCtrls.TPageControl)
 private
   FBorderStyleEx : TBorderStyleEx;
   procedure SetBorderStyleEx(const Value: TBorderStyleEx);
 protected
   property BorderStyleEx : TBorderStyleEx read FBorderStyleEx write SetBorderStyleEx;
   procedure WndProc(var Message : TMessage); override;
 end;

 procedure Register;

implementation

procedure TPageControlEx.SetBorderStyleEx(const Value: TBorderStyleEx);
begin
 FBorderStyleEx := Value;
end;

procedure TPageControlEx.WndProc(var Message : TMessage);
const
 TCM_FIRST       = $1300;      { Tab control messages }
 TCM_ADJUSTRECT  = TCM_FIRST + 40;
begin
 if Message.Msg = TCM_ADJUSTRECT then begin
   inherited WndProc(Message);

   case FBorderStyleEx of
     pcbsNone : begin
           // Совсем без границ
         PRect(Message.LParam)^.Left   := 0;
         PRect(Message.LParam)^.Right  := ClientWidth;
         PRect(Message.LParam)^.Top    := PRect(Message.LParam)^.Top-4;
         PRect(Message.LParam)^.Bottom := ClientHeight;
       end;
     pcbsOnePixel : begin
           // Шириной в один пиксел:
         PRect(Message.LParam)^.Left   := 1;
         PRect(Message.LParam)^.Right  := ClientWidth-1;
         PRect(Message.LParam)^.Top    := PRect(Message.LParam)^.Top-3;
         PRect(Message.LParam)^.Bottom := ClientHeight-1;
       end;
   end;
 end else inherited WndProc(Message);
end;

procedure Register;
begin
 RegisterComponents("Samples", [TPageControlEx]);
end;

end.


Проблема в том, что когда я меняю BorderStyleEx, у меня перерисовки не происходит. А как сделать, чтобы происходила? Repain, Invalidate и UpdateActivePage не помогают.


 
icWasya ©   (2008-03-21 15:55) [1]

procedure TPageControlEx.SetBorderStyleEx(const Value: TBorderStyleEx);
begin
 if FBorderStyleEx = Value then Exit;
 FBorderStyleEx := Value;
 invalidate;
end;


 
Study   (2008-03-22 05:39) [2]


> icWasya ©   (21.03.08 15:55) [1]
>
> procedure TPageControlEx.SetBorderStyleEx(const Value: TBorderStyleEx);
>
> begin
>  if FBorderStyleEx = Value then Exit;
>  FBorderStyleEx := Value;
>  invalidate;


Я же говорю Invalidate не помогает.


 
Study   (2008-03-23 05:31) [3]

Удалено модератором


 
Study   (2008-03-25 07:49) [4]

Удалено модератором


 
Жуков Олег   (2008-03-25 08:35) [5]

RecreateWnd()?


 
icWasya ©   (2008-03-25 12:57) [6]

А если поместить inherited WndProc(Message); после того, как что-то поправишь в Message.LParam ??



Страницы: 1 вся ветка

Текущий архив: 2008.05.04;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.041 c
3-1196589626
Каяна
2007-12-02 13:00
2008.05.04
Подключение к полю типа Binary


2-1207644188
Ri2008
2008-04-08 12:43
2008.05.04
0x0004


15-1206107308
Поп Гапон
2008-03-21 16:48
2008.05.04
GDI+ и Delphi


4-1188562548
Krants
2007-08-31 16:15
2008.05.04
GetTextExtentPoint32 при


2-1207587747
assassin8899
2008-04-07 21:02
2008.05.04
добавление в DBGrid