delphi - 将图像放入绘图网格的特定单元格
问题描述
我正在delpi中制作connect 4游戏。我需要根据用户单击的位置将正确的彩色圆圈放在正确的位置。您如何将图像(最好是JPEG)加载到特定单元格中?
我不知道从哪里开始(因为我的老师没用哈哈)所以任何帮助都会非常感激。!
在表单上创建:
images:=timagelist.Create(self);
image1:=tjpegimage.Create;
image2:=tjpegimage.Create;
bimage1:=tbitmap.Create;
bimage2:=tbitmap.Create;
try
image1.loadfromfile('red.jpg') ;
bimage1.Assign(image1);
image2.loadfromfile('yellow.jpg') ;
bimage2.Assign(image2);
finally
image1.free;
image2.free;
end;
images.Add(bimage1,nil);
images.Add(bimage2,nil) ;
在drawcell上:
row:=c4grid.Row;
col:=c4grid.Col;
images.Draw(c4grid.Canvas,row,col,0);
到目前为止,没有任何反应,也没有证据表明您实际上可以单击该单元格。任何帮助/建议/指导将不胜感激!
解决方案
推荐阅读
- javascript - 无法使用 switch 语句在函数之间切换
- flutter - 如何创建 StreamBuilder 的实例
- javascript - 如何在 Chrome 扩展程序中启用和禁用事件侦听器?
- tensorflow - Tensorflow 对象检测 api - 获取训练和评估数据集的准确性和损失
- python - Python Pandas 从 excel 导入数据后删除空白区域
- php - 在 PHP 中获取单个 FileMaker 记录 ID
- angular - 如何根据所选国家/地区以角度显示城市
- reactjs - getServerSideProps 返回布尔值时序列化错误
- javascript - V 选择下拉位置看起来不正确
- linux-kernel - 使用 allmodconfig 编译时未定义对 ipv6_dev_find 的引用,使用 allyesconfig 编译时不存在