|
Вопрос # 3 878/ вопрос решён / |
|
Здравствуйте, эксперты!
Делаю форму, компоненты которой пропорционально изменяются с изменением её размера. При этом изображение компонентах также претерпевает трансформации. В ходе экспериментов не смог побороть казус связанный со SpeedButton. Первоночально форма выглядит так:
При изменении размера формы по горизонтали на определенном размере рисунок обрубается справа, а остаток прыгает на середину кнопки.
И в таком состоянии он остаётся до тех пор пока не достигнет какой-то неопределённой мною пропорции.
ЗЫ: Для тех кто хочет повторить эксперимент: Форму изменять плавно чтобы не проскочить глючный размер.
Приложение: Переключить в обычный режим- Unit1.pas:
-
- unit Unit1;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ImgList, Buttons;
-
- type
- TForm1 = class(TForm)
- SpeedButton1: TSpeedButton;
- ImageList1: TImageList;
- procedure FormCreate(Sender: TObject);
- procedure FormResize(Sender: TObject);
- private
- { Private declarations }
- StartRect: TRect;
- procedure UpdateButtonGlyph;
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- const
- str = 'Test!';
-
- {$R *.dfm}
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- StartRect := SpeedButton1.BoundsRect;
- end;
-
- procedure TForm1.UpdateButtonGlyph;
- Var BitMap: TBitMap;
- begin
- BitMap := TBitMap.Create;
- try
- BitMap.Width := SpeedButton1.Width-4;
- BitMap.Height := SpeedButton1.Height-4;
- BitMap.TransparentColor := clFuchsia;
- BitMap.Canvas.Brush.Color := clYellow;
- BitMap.Canvas.FillRect(Rect(0, 0, BitMap.Width, BitMap.Height));
- ImageList1.Draw(BitMap.Canvas, (BitMap.Width - ImageList1.Width) div 2,
- (BitMap.Height - ImageList1.Height) div 2, 0);
- BitMap.Canvas.TextOut((BitMap.Width - BitMap.Canvas.TextWidth(str)) div 2,0, str);
- BitMap.Canvas.TextOut((BitMap.Width - BitMap.Canvas.TextWidth(str)) div 2,
- BitMap.Height - BitMap.Canvas.TextHeight(str), str);
- SpeedButton1.Glyph := BitMap;
- finally
- BitMap.Free;
- end;
- end;
-
- procedure TForm1.FormResize(Sender: TObject);
- var dX, dY: integer;
- begin
- dX := Width - Constraints.MinWidth;
- dY := Height - Constraints.MinHeight;
- SpeedButton1.SetBounds(StartRect.Left + dX div 2, StartRect.Top + dY div 2,
- Round((StartRect.Right - StartRect.Left) * Width / Constraints.MinWidth),
- Round((StartRect.Bottom - StartRect.Top) * Height / Constraints.MinHeight));
- UpdateButtonGlyph;
- end;
-
- end.
-
- Unit1.dfm:
-
- object Form1: TForm1
- Left = 384
- Top = 252
- Width = 318
- Height = 176
- Caption = 'Form1'
- Color = clBtnFace
- Constraints.MinHeight = 176
- Constraints.MinWidth = 318
- Font.Charset = DEFAULT_CHARSET
- Font.Color = clWindowText
- Font.Height = -11
- Font.Name = 'MS Sans Serif'
- Font.Style = []
- OldCreateOrder = False
- OnCreate = FormCreate
- OnResize = FormResize
- PixelsPerInch = 96
- TextHeight = 13
- object SpeedButton1: TSpeedButton
- Left = 248
- Top = 88
- Width = 49
- Height = 41
- end
- object ImageList1: TImageList
- Height = 22
- Width = 42
- Left = 272
- Top = 24
- Bitmap = {
- 494C01010100040004002A001600FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600
- 0000000000003600000028000000A8000000160000000100200000000000C039
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000808080008080
- 8000808080008080800080808000808080008080800080808000808080008080
- 8000808080008080800080808000808080008080800080808000808080008080
- 8000808080008080800080808000808080008080800080808000808080008080
- 8000808080008080800080808000808080008080800080808000808080008080
- 8000808080008080800080808000808080008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B0000BD4B0000BD4B0000BD4B0000BD4B0000BD4B0000BD4B
- 0000BD4B0000BD4B0000BD4B0000BD4B0000BD4B0000BD4B0000BD4B0000BD4B
- 000080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B000000000000FFFAF400FFEBD900ADA499009A979000ADBC
- BA00BDBAAB00FFDDBF00FFDAB700FFD5AD00FFD0A500FFCE9E00FFC69200BD4B
- 000080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B00000000000000000000FFFAF400FFFAF400164D6A003B99
- BA00BA631A00D57A2D00DE904B00FBD0A700FFD5AD00FFD0A500FFCE9E00BD4B
- 000080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B0000F7F7F7009F9F9F009F9F9F009F9D9A008C9295003655
- 5800E6AC7600FFE2C700F7C29200D9803500D9833A00EEB07600FFD0A500BD4B
- 000080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B0000F7F7F700F7F7F700F7F7F700F7F7F700F7F7F700F7F7
- F700E6AD7900D17A3000E6AC7800FFE6CE00FBCEA3007E66500075706C00977D
- 8E0080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B0000F7F7F700818181008181810081818100818181008181
- 8100818181008181810090735800B66B2D00B6835600AAAAAA005050B0000821
- AC00090B810080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B0000F7F7F700EEEEEE00EEEEEE00EEEEEE00EEEEEE00EEEE
- EE00EEEEEE00EEEEEE00EEEEEE00FFF2E500B1937700696969001D217B00114A
- D100020A920080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B0000F7F7F7009F9F9F009F9F9F009F9F9F009F9F9F009F9F
- 9F009F9F9F009F9F9F009F9F9F009F9F9F009F9F9F009F9F9F00FFE2C6008172
- A40080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B0000F7F7F700F7F7F700F7F7F700F7F7F700F7F7F700F7F7
- F700F7F7F700F7F7F700F7F7F700FFF6EB00FFF2E500FFEBD900FFE7D100BD4B
- 000080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B0000F7F7F7009F9F9F009F9F9F009F9F9F009F9F9F009F9F
- 9F009F9F9F009F9F9F009F9F9F009F9F9F009F9F9F009F9F9F00FFEBD900BD4B
- 000080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B0000F7F7F700F7F7F700F7F7F700F7F7F700F7F7F700F7F7
- F700F7F7F700F7F7F700F7F7F700F7F7F700FFFBF700FFF2E500FFEBD900BD4B
- 000080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B0000D55F0000D55F0000D55F0000D55F0000D55F0000D55F
- 0000D55F0000D55F0000D55F0000D55F0000D55F0000D55F0000D55F0000BD4B
- 000080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000C04D0000C14E0000C14E0000C14E0000C14E0000C14E0000C14E
- 0000C14E0000C14E0000C14E0000C14E0000C14E0000C14E0000C14E0000C04D
- 000080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF8000BD4B0000C5580800C5580800C5580800C5580800C5580800C558
- 0800C5580800C5580800C5580800C5580800C5580800C5580800C5580800BD4B
- 000080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF80000000000080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF8000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000080FF80008080800000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF800080FF800080FF800080FF800080FF
- 800080FF800080FF800080FF800080FF80000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000000000000424D3E000000000000003E000000
- 28000000A8000000160000000100010000000000100200000000000000000000
- 000000000000000000000000FFFFFF00FFFFFFFFFFC000000000000000000000
- 0000000000000000C00000000040000000000000000000000000000000000000
- 800000000040000000000000000000000000000000000000A000000000400000
- 00000000000000000000000000000000A0000000004000000000000000000000
- 0000000000000000A00200000040000000000000000000000000000000000000
- A00300000040000000000000000000000000000000000000A000000000400000
- 00000000000000000000000000000000A0000000004000000000000000000000
- 0000000000000000A00000000040000000000000000000000000000000000000
- A00000000040000000000000000000000000000000000000A000000000400000
- 00000000000000000000000000000000A0000000004000000000000000000000
- 0000000000000000A00000000040000000000000000000000000000000000000
- A00000000040000000000000000000000000000000000000A000000000400000
- 00000000000000000000000000000000A0000000004000000000000000000000
- 0000000000000000A00000000040000000000000000000000000000000000000
- A00000000040000000000000000000000000000000000000BFFFFFFFFE400000
- 000000000000000000000000000000008000000000C000000000000000000000
- 0000000000000000FFFFFFFFFFC0000000000000000000000000000000000000}
- end
- end
|
Вопрос задал: DNK (статус: Студент)
Вопрос отправлен: 12 марта 2010, 16:00
Состояние вопроса: решён, ответов: 1.
|
Ответ #1. Отвечает эксперт: Егор
Здравствуйте, DNK!
Долго сидел, разбирался. В чём дело, до конца не понял. Если делать вывод непосредственно на канву какого-либо объекта, то всё отображается корректно. Возможно, глюк связан с тем, что Bitmap не отображается на экране и потому некоторые вещи с ним работают некорректно. Но точно не скажу, не знаю.
Если же нужно не разобраться "почему не работает", а найти решение, при котором оно работает, то можно все операции делать прямо на канве кнопки, не создавая новый объект в памяти:
procedure TForm1.UpdateButtonGlyph;
begin
with SpeedButton1.Glyph do
begin
Width := SpeedButton1.Width-4;
Height := SpeedButton1.Height-4;
TransparentColor := clFuchsia;
Canvas.Brush.Color := clYellow;
Canvas.FillRect(Rect(0, 0, Width, Height));
ImageList1.Draw(Canvas, (Width - ImageList1.Width) div 2,
(Height - ImageList1.Height) div 2, 0);
Canvas.TextOut((Width - Canvas.TextWidth(str)) div 2, 0, str);
Canvas.TextOut((Width - Canvas.TextWidth(str)) div 2,
Height - Canvas.TextHeight(str), str);
end;
end;
|
Ответ отправил: Егор (статус: 10-ый класс)
Время отправки: 15 марта 2010, 11:06
Оценка за ответ: 5
Комментарий к оценке: Работает. Спасибо.
|
Мини-форум вопроса
Всего сообщений: 14; последнее сообщение — 15 марта 2010, 14:10; участников в обсуждении: 4.
|
min@y™ (статус: Доктор наук), 12 марта 2010, 19:44 [#1]:
Выложи ссылки на скриншоты, а то не видно. Вытаскивать их из исходников HTML влом.
Делаю лабы и курсачи по Delphi и Turbo Pascal. За ПИВО! Пишите в личку, а лучше в аську. А ещё лучше - звоните в скайп!
|
|
Егор (статус: 10-ый класс), 13 марта 2010, 19:24 [#4]:
Цитата (DNK):
только без двоеточий
блин! ))
Опасайтесь багов в приведенном выше коде; я только доказал корректность, но не запускал его.
— Donald E. Knuth.
|
|
DNK (статус: Студент), 15 марта 2010, 07:51 [#5]:
Блин, люди!
Ну альтернативу тогда предложите что ли!
"Digital Networked Knight"
|
|
Егор (статус: 10-ый класс), 15 марта 2010, 10:39 [#6]:
а зачем так сложно?
SpeedButton1.SetBounds(StartRect.Left + dX div 2, StartRect.Top + dY div 2,
Round((StartRect.Right - StartRect.Left) * Width / Constraints.MinWidth),
Round((StartRect.Bottom - StartRect.Top) * Height / Constraints.MinHeight));
не знаем про свойства Anchors?
...ImageList1.Draw(BitMap.Canvas, (BitMap.Width - ImageList1.Width) div 2,...
ImageList1 не является видимым компонентом. ширина этого компонента равна 42 независимо ни от чего. в том числе и от размера картинки
Опасайтесь багов в приведенном выше коде; я только доказал корректность, но не запускал его.
— Donald E. Knuth.
|
|
DNK (статус: Студент), 15 марта 2010, 12:31 [#7]:
Цитата (Егор):
не знаем про свойства Anchors? Тогда скажи, как с их помощью сделать так, чтоб размер компонента изменялся пропорционально дельте окна, и при этом он сдвигался ровно на столько, что бы другие компоненты на него не "наезжали".
Цитата (Егор):
ImageList1 не является видимым компонентом. ширина этого компонента равна 42 независимо ни от чего. в том числе и от размера картинки И чё?..
"Digital Networked Knight"
|
|
Вадим К (статус: Академик), 15 марта 2010, 12:36 [#8]:
и то, что "ImageList1.Width" бессмысленная конструкция. Нельзя брать размер у компонента, у которого ее физически нет.
А почему же все таки она есть? а это такой хитрый ход, что бы все таки можно было компонент разместить на форме редактора. Исключительно для упрощения.
И наверно надо ещё изучить свойство Align
Галочка "подтверждения прочтения" - вселенское зло.
|
|
Егор (статус: 10-ый класс), 15 марта 2010, 12:57 [#9]:
Anchors: выставляем все поля в true - тогда компонент будет изменяться пропорционально размерам формы
фактически, строки
dX := Width - Constraints.MinWidth;
dY := Height - Constraints.MinHeight;
SpeedButton1.SetBounds(StartRect.Left + dX div 2, StartRect.Top + dY div 2,
Round((StartRect.Right - StartRect.Left) * Width / Constraints.MinWidth),
Round((StartRect.Bottom - StartRect.Top) * Height / Constraints.MinHeight));
делает как раз то, что можно было бы не делать, если установит Anchors так, как я написал
Опасайтесь багов в приведенном выше коде; я только доказал корректность, но не запускал его.
— Donald E. Knuth.
|
|
Вадим К (статус: Академик), 15 марта 2010, 13:04 [#10]:
Anchors - это не "пропорционально".
Это свойство приводит к тому, что для каждой с указанных сторон сохраняется растояние до родительского контрола.
По умолчанию выставлено только для top и left и относительно верхнего левого угла растояние будет одно и тоже всегда. если ещё выставить right в true, то при изменении размеров формы будет меняться ширина. расширили форму на 20 пикселей, компонент станет на 20 шире. А высота не будет меняться (потому что не надо в этом случае). Ну и так дальше?
Галочка "подтверждения прочтения" - вселенское зло.
|
|
min@y™ (статус: Доктор наук), 15 марта 2010, 13:19 [#11]:
Цитата (Вадим К):
и то, что "ImageList1.Width" бессмысленная конструкция. Нельзя брать размер у компонента, у которого ее физически нет.
А почему же все таки она есть? а это такой хитрый ход, что бы все таки можно было компонент разместить на форме редактора. Исключительно для упрощения.
Да ладно! TImageList.Width и Height - это размер картинок, которые он хранит.
Имхо, в данном случае Anchors достаточно.
Делаю лабы и курсачи по Delphi и Turbo Pascal. За ПИВО! Пишите в личку, а лучше в аську. А ещё лучше - звоните в скайп!
|
|
DNK (статус: Студент), 15 марта 2010, 13:39 [#12]:
Цитата (Вадим К):
и то, что "ImageList1.Width" бессмысленная конструкция. Нельзя брать размер у компонента, у которого ее физически нет.
При чём тут размер компонента?
Цитата:
Specifies the width of all images within the image list.
Delphi syntax:
property Width: Integer;
C++ syntax:
__property int Width = {read=FWidth, write=SetWidth, default=16};
Description
Use the Width property to specify the width of images before any are added to the image list. The image list is cleared when this value changes.
"Digital Networked Knight"
|
|
DNK (статус: Студент), 15 марта 2010, 13:44 [#13]:
Цитата (Егор):
Anchors: выставляем все поля в true - тогда компонент будет изменяться пропорционально размерам формы
фактически, строки Егор!
У меня для тебя упражнение: Поставь кнопки в виде таблицы 2 на 3. Выставь все поля в true и сообщи что у тебя в итоге получилось.
"Digital Networked Knight"
|
|
Вадим К (статус: Академик), 15 марта 2010, 14:10 [#14]:
давно я с виндой в делфи не сидел. вроде там было другое свойство для размера картинок... посмотрим, посмотрим...
Галочка "подтверждения прочтения" - вселенское зло.
|
13 мая 2011, 09:40: Статус вопроса изменён на решённый (изменил автор вопроса — DNK)
Чтобы оставлять сообщения в мини-форумах, Вы должны авторизироваться на сайте.
|