ExtractIcon関数やExtractIconEx関数で取得したアイコンをTSpeedButtonやTBitBtnに描画すると
一部のアイコンの縁が黒く表示されます。キレイに表示する方法を教えて下さい。
Delphi
1procedure TForm1.Button1Click(Sender: TObject); 2var 3 OpenDialog : TOpenDialog; 4 ButtonImage : TBitmap; 5 GetIcon : TIcon; 6 phiconLarge, phiconSmall : HICON; 7begin 8 OpenDialog := TOpenDialog.Create(Self); 9 with OpenDialog do 10 begin 11 Title := 'ファイルの選択'; 12 Filter := 'PEファイル(*.exe;*.dll)|*.exe;*.dll|すべてのファイル(*.*)|*.*'; 13 Options := [ofFileMustExist, ofPathMustExist, ofHideReadOnly, ofEnableSizing]; 14 end; 15 if OpenDialog.Execute = true then 16 begin 17 Application.MessageBox(PChar(OpenDialog.FileName + 'のアイコンを取得'), PChar(Application.Title)); 18 if ExtractIconEx(PChar(OpenDialog.FileName), 0, phiconLarge, phiconSmall, 1) = 0 then 19 Exit; 20 Image1.Picture.Icon.Handle := phiconLarge; 21 Image2.Picture.Icon.Handle := phiconLarge; 22 ButtonImage := TBitmap.Create; 23 GetIcon := TIcon.Create; 24 GetIcon.Handle := phiconLarge; 25 GetIcon.AssignTo(ButtonImage); 26 27 BitBtn1.Glyph := ButtonImage; 28 SpeedButton1.Glyph := ButtonImage; 29 end; 30end;
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。