Форум по Delphi программированию

Delphi Sources



Вернуться   Форум по Delphi программированию > Все о Delphi > [ "Начинающим" ]
Ник
Пароль
Регистрация <<         Правила форума         >> FAQ Пользователи Календарь Поиск Сообщения за сегодня Все разделы прочитаны

Ответ
 
Опции темы Поиск в этой теме Опции просмотра
  #1  
Старый 20.10.2008, 13:49
Ama Ama вне форума
Активный
 
Регистрация: 15.07.2008
Сообщения: 260
Репутация: 23
По умолчанию Hint под XP Vista

Здрасте!!!!
Вот представляю на показ созданный мною компонент TVistaHint.
Конечно, я понимаю что таких компонентов "море", но прошу заценить.
Отзывы, которые очень жду, прошу писать на аську: 412636666.
Вот код:
Код:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
unit MyHintWindow;
 
interface
 
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Math, ExtCtrls;
 
const DefColFrom: TColor = $00FFFFFF;
      DefColTo: TColor = $00F0E5E5;
 
type
  THintStyle = (hsXP, hsVista);
  TShowHintType = (stNone, st_LtoR, st_RtoL, st_UtoD, st_DtoU, st_Centr, st_Blend);
 
type
  TVistaHint = class(TComponent)
  private
    FHintStyle: THintStyle;
    FColorFrom, FColorTo: TColor;
    FShowingTime: Cardinal;
    FHintPause, FHintHidePause: Cardinal;
    FShowHintType: TShowHintType;
    FDefaultColors: boolean;
    FirstChanged: boolean;
    FFont: TFont;
    procedure SetHintPause(const Value: Cardinal);
    procedure SetHintHidePause(const Value: Cardinal);
    procedure SetHintStyle(const Value: THintStyle);
    procedure SetColorFrom(const Value: TColor);
    procedure SetColorTo(const Value: TColor);
    procedure SetDefaultColors(const Value: boolean);
    procedure SetFont(const Value: TFont);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure ColorsToVistaStyle;
    procedure ColorsToXPStyle;
  published
     property HintStyle: THintStyle read FHintStyle write SetHintStyle;
     property ColorFrom: TColor read FColorFrom write SetColorFrom;
     property ColorTo: TColor read FColorTo write SetColorTo;
     property ShowType: TShowHintType read FShowHintType write FShowHintType;
     property ShowingTime: Cardinal read FShowingTime write FShowingTime;
     property HintPause: Cardinal read FHintPause write SetHintPause;
     property HintHidePause: Cardinal read FHintHidePause write SetHintHidePause;
     property DefaultColors: boolean read FDefaultColors write SetDefaultColors;
     property Font: TFont read FFont write SetFont;
  end;
 
type
  TMyHintWindow = class(THintWindow)
  private
    { Private declarations }
    FHint: TVistaHint;
    FBitmap: TBitmap;
    FRegion: THandle;
    procedure FreeRegion;
  protected
    { Protected declarations }
    procedure CreateParams (var Params: TCreateParams); override;
    procedure Paint; override;
    procedure Erase(var Message: TMessage); message WM_ERASEBKGND;
  public
    { Public declarations }
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     procedure ActivateHint(Rect: TRect; const AHint: String); Override;
  end;
 
procedure Register;
 
implementation
 
procedure Register;
begin
  RegisterComponents('Samples', [TVistaHint]);
end;
 
{ TMyHintWindow }
 
constructor TMyHintWindow.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FBitmap := TBitmap.Create;
  FBitmap.PixelFormat := pf24bit;
end;
 
procedure TMyHintWindow.CreateParams(var Params: TCreateParams);
const
  CS_DROPSHADOW = $20000;
begin
  inherited;
  Params.Style := Params.Style - WS_BORDER;
  Params.WindowClass.Style := Params.WindowClass.style or CS_DROPSHADOW;
end;
 
procedure TMyHintWindow.ActivateHint(Rect: TRect; const AHint: String);
var
  i: Integer;
  aniType: Cardinal;
begin
  FHint:= nil;
  with Application.MainForm do
  begin
    for I:= 0 to ComponentCount - 1 do
      if Components[i] is TVistaHint then
      begin
        FHint := TVistaHint(Components[i]);
        Break;
      end;
  end;
  if not Assigned(FHint) then Exit;
 
  Caption := AHint;
  Canvas.Font := Screen.HintFont;
  FBitmap.Canvas.Font := Screen.HintFont;
  DrawText(Canvas.Handle, PChar(Caption), Length(Caption), Rect, DT_CALCRECT  or DT_NOPREFIX);
  case FHint.FHintStyle of
    hsVista:
      begin
        Width := (Rect.Right - Rect.Left) + 16;
        Height := (Rect.Bottom - Rect.Top) + 10;
      end;
    hsXP:
      begin
        Width := (Rect.Right - Rect.Left) + 10;
        Height := (Rect.Bottom - Rect.Top) + 6;
      end;
  end;
  FBitmap.Width := Width;
  FBitmap.Height := Height;
  Left := Rect.Left;
  Top := Rect.Top;
  FreeRegion;
  case FHint.FShowHintType of
   st_LtoR: aniType:= AW_HOR_POSITIVE;
   st_RtoL: aniType:= AW_HOR_NEGATIVE;
   st_UtoD: aniType:= AW_VER_POSITIVE;
   st_DtoU: aniType:= AW_VER_NEGATIVE;
   st_Centr: aniType:= AW_CENTER;
   st_Blend: aniType:= AW_BLEND;
   else aniType:= AW_ACTIVATE;
  end;
  if FHint.FHintStyle = hsVista then
  begin
    with Rect do
      FRegion := CreateRoundRectRgn(1, 1, Width, Height, 3, 3);
    if FRegion <> 0 then
      SetWindowRgn(Handle, FRegion, True);
  end;
  AnimateWindowProc(Handle, FHint.FShowingTime, aniType);
  SetWindowPos(Handle, HWND_TOPMOST, Left, Top, 0, 0, SWP_SHOWWINDOW or SWP_NOACTIVATE or SWP_NOSIZE);
end;
 
destructor TMyHintWindow.Destroy;
begin
  FBitmap.Free;
  FreeRegion;
  inherited;
end;
 
procedure TMyHintWindow.Erase(var Message: TMessage);
begin
  Message.Result := 0;
end;
 
procedure TMyHintWindow.FreeRegion;
begin
  if FRegion <> 0 then
  begin
    SetWindowRgn(Handle, 0, True);
    DeleteObject(FRegion);
    FRegion := 0;
  end;
end;
 
procedure DrawGradientVertical(Canvas: TCanvas; Rect: TRect; FromColor, ToColor: TColor);
var
  i, Y: Integer;
  R, G, B: Byte;
begin
   i := 0;
   for Y := Rect.Top to Rect.Bottom - 1 do
   begin
      R := GetRValue(FromColor) + Ceil(((GetRValue(ToColor) - GetRValue(FromColor)) / Rect.Bottom-Rect.Top) * i);
      G := GetGValue(FromColor) + Ceil(((GetGValue(ToColor) - GetGValue(FromColor)) / Rect.Bottom-Rect.Top) * i);
      B := GetBValue(FromColor) + Ceil(((GetBValue(ToColor) - GetBValue(FromColor)) / Rect.Bottom-Rect.Top) * i);
      Canvas.Pen.Color := RGB(R, G, B);
      Canvas.MoveTo(Rect.Left, Y);
      Canvas.LineTo(Rect.Right, Y);
      Inc(i);
   end;
end;
 
procedure TMyHintWindow.Paint;
var
  CaptionRect: TRect;
begin
  if not Assigned(FHint) then exit;
  case FHint.FHintStyle of
    hsVista:
      begin
        DrawGradientVertical(FBitmap.Canvas, GetClientRect, FHint.FColorFrom,
                                                            FHint.FColorTo);
        with FBitmap.Canvas do
        begin
          {Font.Color := clGray;}
          Font:= FHint.FFont;
          Brush.Style := bsClear;
          Pen.Color := RGB(118, 118, 118);
          RoundRect(1, 1, Width - 1, Height - 1, 6, 6);
          RoundRect(1, 1, Width - 1, Height - 1, 3, 3);
        end;
        CaptionRect := Rect(8, 5, Width, Height);
      end;
    hsXP:
      begin
        with FBitmap.Canvas do
        begin
          {Font.Color := clBlack;}
          Font:= FHint.FFont;
          Brush.Style := bsSolid;
          Brush.Color := FHint.FColorFrom;
          Pen.Color := RGB(0, 0, 0);
          Rectangle(0, 0, Width, Height);
        end;
        CaptionRect := Rect(5, 3, Width, Height);
      end;
  end;
  DrawText(FBitmap.Canvas.Handle, PChar(Caption), Length(Caption), CaptionRect, DT_WORDBREAK or DT_NOPREFIX);
  BitBlt(Canvas.Handle, 0, 0, Width, Height, FBitmap.Canvas.Handle, 0, 0, SRCCOPY);
end;
 
{ TVistaHint }
 
procedure TVistaHint.ColorsToVistaStyle;
begin
 FHintStyle:= hsVista;
 FColorFrom:= DefColFrom;
 FColorTo:= DefColTo;
end;
 
procedure TVistaHint.ColorsToXPStyle;
begin
 FHintStyle:= hsXP;
 FColorFrom:= clInfoBk;
end;
 
constructor TVistaHint.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FColorFrom:= DefColFrom;
  FColorTo:= DefColTo;
  FHintStyle:= hsVista;
  FShowHintType:= st_Blend;
  FShowingTime:= 300;
  FHintPause:= 500;
  FHintHidePause:= 5000;
  FDefaultColors:= false;
  FFont:= TFont.Create;
  FirstChanged:= false;
  if not (csDesigning in ComponentState) then
  begin
    with Application do
    begin
      HintWindowClass := TMyHintWindow;
      HintPause := FHintPause;
      HintHidePause := FHintHidePause;
    end;
  end;
end;
 
destructor TVistaHint.Destroy;
begin
  FFont.Free;
  inherited;
end;
 
procedure TVistaHint.SetColorFrom(const Value: TColor);
begin
  if not FDefaultColors then
    FColorFrom := Value;
  FirstChanged:= true;
end;
 
procedure TVistaHint.SetColorTo(const Value: TColor);
begin
  if not FDefaultColors then
    FColorTo := Value;
  FirstChanged:= true;
end;
 
procedure TVistaHint.SetDefaultColors(const Value: boolean);
begin
  FDefaultColors := Value;
  if Value then
   case FHintStyle of
    hsXP: ColorsToXPStyle;
    hsVista: ColorsToVistaStyle;
   end;
end;
 
procedure TVistaHint.SetFont(const Value: TFont);
begin
  FFont.Assign(Value);
end;
 
procedure TVistaHint.SetHintHidePause(const Value: Cardinal);
begin
  FHintHidePause := Value;
  if not (csDesigning in ComponentState) then
    with Application do  HintHidePause := FHintHidePause;
end;
 
procedure TVistaHint.SetHintPause(const Value: Cardinal);
begin
  FHintPause := Value;
  if not (csDesigning in ComponentState) then
    with Application do  HintPause := FHintPause;
end;
 
procedure TVistaHint.SetHintStyle(const Value: THintStyle);
begin
  FHintStyle := Value;
  if not FirstChanged then
   case Value of
    hsXP: FColorFrom:= clInfoBk;
    hsVista: FColorFrom:= DefColFrom
   end;
end;
 
end.
Ответить с цитированием
  #2  
Старый 20.10.2008, 14:54
Rat Rat вне форума
Активный
 
Регистрация: 12.09.2008
Сообщения: 391
Репутация: 6078
По умолчанию

А маленький Example можно?
Ответить с цитированием
  #3  
Старый 20.10.2008, 16:32
Ama Ama вне форума
Активный
 
Регистрация: 15.07.2008
Сообщения: 260
Репутация: 23
По умолчанию

Цитата:
Сообщение от Rat
А маленький Example можно?
Лучше тебе испробовать этот компонент самому, так есть настройки вида появления окна Hintа, цфет фона, шрифт, время, короче прикольно
Ответить с цитированием
  #4  
Старый 21.10.2008, 07:19
Rat Rat вне форума
Активный
 
Регистрация: 12.09.2008
Сообщения: 391
Репутация: 6078
По умолчанию

Затестил. При изменении размера шрифта, рамка остается старых размеров и не видно ничего...
Ответить с цитированием
  #5  
Старый 21.10.2008, 14:27
Ama Ama вне форума
Активный
 
Регистрация: 15.07.2008
Сообщения: 260
Репутация: 23
По умолчанию

Цитата:
Сообщение от Rat
Затестил. При изменении размера шрифта, рамка остается старых размеров и не видно ничего...

Благодору за тест, здесь исходник с исправлением:
Код:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
unit MyHintWindow;
 
interface
 
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Math, ExtCtrls;
 
const DefColFrom: TColor = $00FFFFFF;
      DefColTo: TColor = $00F0E5E5;
 
type
  THintStyle = (hsXP, hsVista);
  TShowHintType = (stNone, st_LtoR, st_RtoL, st_UtoD, st_DtoU, st_Centr, st_Blend);
 
type
  TVistaHint = class(TComponent)
  private
    FHintStyle: THintStyle;
    FColorFrom, FColorTo: TColor;
    FShowingTime: Cardinal;
    FHintPause, FHintHidePause: Cardinal;
    FShowHintType: TShowHintType;
    FDefaultColors: boolean;
    FirstChanged: boolean;
    FFont: TFont;
    procedure SetHintPause(const Value: Cardinal);
    procedure SetHintHidePause(const Value: Cardinal);
    procedure SetHintStyle(const Value: THintStyle);
    procedure SetColorFrom(const Value: TColor);
    procedure SetColorTo(const Value: TColor);
    procedure SetDefaultColors(const Value: boolean);
    procedure SetFont(const Value: TFont);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure ColorsToVistaStyle;
    procedure ColorsToXPStyle;
  published
     property HintStyle: THintStyle read FHintStyle write SetHintStyle;
     property ColorFrom: TColor read FColorFrom write SetColorFrom;
     property ColorTo: TColor read FColorTo write SetColorTo;
     property ShowType: TShowHintType read FShowHintType write FShowHintType;
     property ShowingTime: Cardinal read FShowingTime write FShowingTime;
     property HintPause: Cardinal read FHintPause write SetHintPause;
     property HintHidePause: Cardinal read FHintHidePause write SetHintHidePause;
     property DefaultColors: boolean read FDefaultColors write SetDefaultColors;
     property Font: TFont read FFont write SetFont;
  end;
 
type
  TMyHintWindow = class(THintWindow)
  private
    { Private declarations }
    FHint: TVistaHint;
    FBitmap: TBitmap;
    FRegion: THandle;
    procedure FreeRegion;
  protected
    { Protected declarations }
    procedure CreateParams (var Params: TCreateParams); override;
    procedure Paint; override;
    procedure Erase(var Message: TMessage); message WM_ERASEBKGND;
  public
    { Public declarations }
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     procedure ActivateHint(Rect: TRect; const AHint: String); Override;
  end;
 
procedure Register;
 
implementation
 
procedure Register;
begin
  RegisterComponents('Samples', [TVistaHint]);
end;
 
{ TMyHintWindow }
 
constructor TMyHintWindow.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FBitmap := TBitmap.Create;
  FBitmap.PixelFormat := pf24bit;
end;
 
procedure TMyHintWindow.CreateParams(var Params: TCreateParams);
const
  CS_DROPSHADOW = $20000;
begin
  inherited;
  Params.Style := Params.Style - WS_BORDER;
  Params.WindowClass.Style := Params.WindowClass.style or CS_DROPSHADOW;
end;
 
procedure TMyHintWindow.ActivateHint(Rect: TRect; const AHint: String);
var
  i: Integer;
  aniType: Cardinal;
begin
  FHint:= nil;
  with Application.MainForm do
  begin
    for I:= 0 to ComponentCount - 1 do
      if Components[i] is TVistaHint then
      begin
        FHint := TVistaHint(Components[i]);
        Break;
      end;
  end;
  if not Assigned(FHint) then Exit;
 
  Caption := AHint;
{  Canvas.Font := Screen.HintFont;
  FBitmap.Canvas.Font := Screen.HintFont;}
  Canvas.Font := FHint.FFont;
  FBitmap.Canvas.Font := FHint.FFont;
  DrawText(Canvas.Handle, PChar(Caption), Length(Caption), Rect, DT_CALCRECT  or DT_NOPREFIX);
  case FHint.FHintStyle of
    hsVista:
      begin
        Width := (Rect.Right - Rect.Left) + 16;
        Height := (Rect.Bottom - Rect.Top) + 10;
      end;
    hsXP:
      begin
        Width := (Rect.Right - Rect.Left) + 10;
        Height := (Rect.Bottom - Rect.Top) + 6;
      end;
  end;
  FBitmap.Width := Width;
  FBitmap.Height := Height;
  Left := Rect.Left;
  Top := Rect.Top;
  FreeRegion;
  case FHint.FShowHintType of
   st_LtoR: aniType:= AW_HOR_POSITIVE;
   st_RtoL: aniType:= AW_HOR_NEGATIVE;
   st_UtoD: aniType:= AW_VER_POSITIVE;
   st_DtoU: aniType:= AW_VER_NEGATIVE;
   st_Centr: aniType:= AW_CENTER;
   st_Blend: aniType:= AW_BLEND;
   else aniType:= AW_ACTIVATE;
  end;
  if FHint.FHintStyle = hsVista then
  begin
    with Rect do
      FRegion := CreateRoundRectRgn(1, 1, Width, Height, 3, 3);
    if FRegion <> 0 then
      SetWindowRgn(Handle, FRegion, True);
  end;
  AnimateWindowProc(Handle, FHint.FShowingTime, aniType);
  SetWindowPos(Handle, HWND_TOPMOST, Left, Top, 0, 0, SWP_SHOWWINDOW or SWP_NOACTIVATE or SWP_NOSIZE);
end;
 
destructor TMyHintWindow.Destroy;
begin
  FBitmap.Free;
  FreeRegion;
  inherited;
end;
 
procedure TMyHintWindow.Erase(var Message: TMessage);
begin
  Message.Result := 0;
end;
 
procedure TMyHintWindow.FreeRegion;
begin
  if FRegion <> 0 then
  begin
    SetWindowRgn(Handle, 0, True);
    DeleteObject(FRegion);
    FRegion := 0;
  end;
end;
 
procedure DrawGradientVertical(Canvas: TCanvas; Rect: TRect; FromColor, ToColor: TColor);
var
  i, Y: Integer;
  R, G, B: Byte;
begin
   i := 0;
   for Y := Rect.Top to Rect.Bottom - 1 do
   begin
      R := GetRValue(FromColor) + Ceil(((GetRValue(ToColor) - GetRValue(FromColor)) / Rect.Bottom-Rect.Top) * i);
      G := GetGValue(FromColor) + Ceil(((GetGValue(ToColor) - GetGValue(FromColor)) / Rect.Bottom-Rect.Top) * i);
      B := GetBValue(FromColor) + Ceil(((GetBValue(ToColor) - GetBValue(FromColor)) / Rect.Bottom-Rect.Top) * i);
      Canvas.Pen.Color := RGB(R, G, B);
      Canvas.MoveTo(Rect.Left, Y);
      Canvas.LineTo(Rect.Right, Y);
      Inc(i);
   end;
end;
 
procedure TMyHintWindow.Paint;
var
  CaptionRect: TRect;
begin
  if not Assigned(FHint) then exit;
  case FHint.FHintStyle of
    hsVista:
      begin
        DrawGradientVertical(FBitmap.Canvas, GetClientRect, FHint.FColorFrom,
                                                            FHint.FColorTo);
        with FBitmap.Canvas do
        begin
          {Font.Color := clGray;}
          Font:= FHint.FFont;
          Brush.Style := bsClear;
          Pen.Color := RGB(118, 118, 118);
          RoundRect(1, 1, Width - 1, Height - 1, 6, 6);
          RoundRect(1, 1, Width - 1, Height - 1, 3, 3);
        end;
        CaptionRect := Rect(8, 5, Width, Height);
      end;
    hsXP:
      begin
        with FBitmap.Canvas do
        begin
          {Font.Color := clBlack;}
          Font:= FHint.FFont;
          Brush.Style := bsSolid;
          Brush.Color := FHint.FColorFrom;
          Pen.Color := RGB(0, 0, 0);
          Rectangle(0, 0, Width, Height);
        end;
        CaptionRect := Rect(5, 3, Width, Height);
      end;
  end;
  DrawText(FBitmap.Canvas.Handle, PChar(Caption), Length(Caption), CaptionRect, DT_WORDBREAK or DT_NOPREFIX);
  BitBlt(Canvas.Handle, 0, 0, Width, Height, FBitmap.Canvas.Handle, 0, 0, SRCCOPY);
end;
 
{ TVistaHint }
 
procedure TVistaHint.ColorsToVistaStyle;
begin
 FHintStyle:= hsVista;
 FColorFrom:= DefColFrom;
 FColorTo:= DefColTo;
end;
 
procedure TVistaHint.ColorsToXPStyle;
begin
 FHintStyle:= hsXP;
 FColorFrom:= clInfoBk;
end;
 
constructor TVistaHint.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FColorFrom:= DefColFrom;
  FColorTo:= DefColTo;
  FHintStyle:= hsVista;
  FShowHintType:= st_Blend;
  FShowingTime:= 300;
  FHintPause:= 500;
  FHintHidePause:= 5000;
  FDefaultColors:= false;
  FFont:= TFont.Create;
  FirstChanged:= false;
  if not (csDesigning in ComponentState) then
  begin
    with Application do
    begin
      HintWindowClass := TMyHintWindow;
      HintPause := FHintPause;
      HintHidePause := FHintHidePause;
    end;
  end;
end;
 
destructor TVistaHint.Destroy;
begin
  FFont.Free;
  inherited;
end;
 
procedure TVistaHint.SetColorFrom(const Value: TColor);
begin
  if not FDefaultColors then
    FColorFrom := Value;
  FirstChanged:= true;
end;
 
procedure TVistaHint.SetColorTo(const Value: TColor);
begin
  if not FDefaultColors then
    FColorTo := Value;
  FirstChanged:= true;
end;
 
procedure TVistaHint.SetDefaultColors(const Value: boolean);
begin
  FDefaultColors := Value;
  if Value then
   case FHintStyle of
    hsXP: ColorsToXPStyle;
    hsVista: ColorsToVistaStyle;
   end;
end;
 
procedure TVistaHint.SetFont(const Value: TFont);
begin
  FFont.Assign(Value);
end;
 
procedure TVistaHint.SetHintHidePause(const Value: Cardinal);
begin
  FHintHidePause := Value;
  if not (csDesigning in ComponentState) then
    with Application do  HintHidePause := FHintHidePause;
end;
 
procedure TVistaHint.SetHintPause(const Value: Cardinal);
begin
  FHintPause := Value;
  if not (csDesigning in ComponentState) then
    with Application do  HintPause := FHintPause;
end;
 
procedure TVistaHint.SetHintStyle(const Value: THintStyle);
begin
  FHintStyle := Value;
  if not FirstChanged then
   case Value of
    hsXP: FColorFrom:= clInfoBk;
    hsVista: FColorFrom:= DefColFrom
   end;
end;
 
end.
Ответить с цитированием
  #6  
Старый 21.10.2008, 15:14
Rat Rat вне форума
Активный
 
Регистрация: 12.09.2008
Сообщения: 391
Репутация: 6078
По умолчанию

Ну и еще. Я не знаю, глюк это или нет, но если на форме несколько элементов у которых включен Hint, то эффект у хинта появляется только у первого элемента. На остальных оно показывается без эффектов.
Ответить с цитированием
  #7  
Старый 23.10.2008, 09:55
Ama Ama вне форума
Активный
 
Регистрация: 15.07.2008
Сообщения: 260
Репутация: 23
По умолчанию

У меня все работает нормально
Ответить с цитированием
  #8  
Старый 28.07.2009, 21:54
Zorkov Igor Zorkov Igor вне форума
Новичок
 
Регистрация: 28.07.2009
Сообщения: 85
Репутация: 50
По умолчанию

Созданный Rouse http://rouse.drkb.ru/components.php#fwhint, содранный мной у Rouse'а, содранный тобой у меня http://www.delphisources.ru/pages/so...int-style.html
Ответить с цитированием
Ответ


Delphi Sources

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения

BB-коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход


Часовой пояс GMT +3, время: 00:42.


 

Сайт

Форум

FAQ

Соглашения

Прочее

 

Copyright © Форум "Delphi Sources" by BrokenByte Software, 2004-2025