如何将像素绘制到TImage但是采用pf1bit位图格式?我试过但结果是整个图像都是黑色的.
这是我试过的代码:
image1.picture.bitmap.loadfromfile('example.bmp'); // an image which is RGB pf24bit with 320 x 240 px resolution
image1.picture.bitmap.pixelformat := pf1bit;
for i:=0 to round(image1.picture.bitmap.canvas.height/2) - 1 do
begin
for j:=0 to round(image1.picture.bitmap.canvas.width/2) - 1 do
begin
image1.picture.bitmap.Canvas.pixels[i,j]:=1; // is this correct? ... := 1? I've tried to set it to 255 (mean white), but still get black
end;
end;
Run Code Online (Sandbox Code Playgroud)
请注意,图像大小为320x240像素.
谢谢你.
如何在消息中使用一些变量来更改消息对话框的标题。我试过了
Application.MessageBox('x * y = ' + result, 'this is title', MBICONINFORMATION);
Run Code Online (Sandbox Code Playgroud)
但是它显示一个错误,指出不兼容的类型:“字符串”和“ PAnsiChar”,我知道这是因为不允许使用“结果”变量。有解决办法吗?之前感谢