Last active
December 18, 2016 11:41
-
-
Save superswanman/217dbbf0de4db81de60c279eb3171039 to your computer and use it in GitHub Desktop.
TEditControl内にあるTImageListの画像の置き換えサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit USushiBreak; | |
interface | |
uses | |
System.Classes, Vcl.Controls, Vcl.Graphics, Vcl.Forms, ToolsAPI; | |
procedure Register; | |
implementation | |
procedure Register; | |
var | |
envOptions: TComponent; | |
images: TImageList; | |
bmp: TBitmap; | |
begin | |
envOptions := Application.FindComponent('EnvironmentOptions'); | |
if envOptions = nil then Exit; | |
// 1行の高さが15pxより小さい環境では'LargeGutterImages'の代わりに'SmallGutterImages'を使用する | |
images := TImageList(envOptions.FindComponent('LargeGutterImages')); | |
if images = nil then Exit; | |
bmp := TBitmap.Create; | |
try | |
bmp.LoadFromFile('C:\img\sushi.bmp'); | |
// TImageList内のインデックスはこちらを参照: http://imgur.com/wur8hIn | |
images.ReplaceMasked(0, bmp, bmp.Canvas.Pixels[0, bmp.Height-1]); | |
finally | |
bmp.Free; | |
end; | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment