gpt4 book ai didi

c# - Delphi 7 Glyph.Data 十六进制到数据 URI

转载 作者:太空宇宙 更新时间:2023-11-04 16:06:41 26 4
gpt4 key购买 nike

<分区>

我正在尝试将 Delphi-7 用户界面转换为网络界面。 Delphi 将按钮图标作为十六进制字符串存储在属性 Glyph.Data 中。例如:

object Btn1: TSpeedButton
Left = -1
Top = -1
Width = 26
Height = 27
Anchors = [akTop, akRight]
Flat = True
Glyph.Data = {
36060000424D3606000000000000360000002800000020000000100000000100
1800000000000006000000000000000000000000000000000000BECACDBECACD
BECACDBECACDBECACDBECACDD9D3E6BAB4E3E8E2E8BECACD9A96DE0000CC0000
CC5E5BD6BECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD8D
A2A7BECACDBECACDBECACD8C8C8C8C8C8C8DA2A7BECACDBECACDBECACDBECACD
BECACDBECACDBECACDD9D3E6100FCD0000CC100FCDE8E2E93E3DD20000CC0000
CC0000CCBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD64646464
6464646464BECACD8C8C8C646464646464646464BECACDBECACDBECACDBECACD
BECACDBECACDBECACDBAB4E40000CC0000CC0000CCBAB4E44E4CD60000CC0000
CC100FCDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD64646464
64646464648DA2A78C8C8C646464646464646464BECACDBECACDBECACDBECACD
BECACDBAB4E4D9D3E6E8E2E91F1ECF0000CC2F2ED0BECACDC9C3E54E4CD63E3D
D2AAA5E0BECACDBECACDBECACDBECACDBECACD8DA2A78DA2A7BECACD64646464
6464646464BECACDBECACD8C8C8C8C8C8C8DA2A7BECACDBECACDBECACDBECACD
6D6AD90000CC0000CCBAB4E4BECACDC9C3E5BECACDBECACDBECACDBECACDBECA
CDBECACDBECACDBECACDBECACDBECACD8DA2A76464646464648DA2A7BECACDBE
CACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD
3E3DD20000CC0000CC7B78DBBECACDBECACDBECACDBECACDBECACDBECACDBECA
CDBECACDBECACDBECACDBECACDBECACD8C8C8C6464646464648DA2A7BECACDBE
CACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD
AAA5E01F1ECF3E3DD2D9D3E6BECACDBECACDBECACDBECACDBECACDBECACDBECA
CDBECACDBECACDBECACDBECACDBECACD8DA2A7646464646464BECACDBECACDBE
CACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD
BECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECA
CDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBE
CACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD
2F2ED00000CC8B87DDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECA
CDBECACDBECACDBECACDBECACDBECACD646464646464646464BECACDBECACDBE
CACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD
0000CC0000CC3E3DD2BECACDBECACDBECACDBECACDBECACDBECACDBECACDBECA
CDBECACDBECACDBECACDBECACDBECACD646464646464646464BECACDBECACDBE
CACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD
6D6AD93E3DD2AAA5E0BECACDBECACDBECACDBECACDBECACDBECACDBECACDBECA
CDBECACDBECACDBECACDBECACDBECACD8C8C8C6464648DA2A7BECACDBECACDBE
CACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD
BECACDBECACDBECACDBAB4E4BECACDBECACDBECACDBECACDBECACDBECACDBECA
CDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD8C8C8CBECACDBE
CACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD
BECACDBECACD4E4CD60000CC7B78DBBECACDBECACDBECACDBECACDBECACDBECA
CDBECACDBECACDBECACDBECACDBECACDBECACDBECACD6464646464648C8C8CBE
CACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD
BECACDBECACD4E4CD60000CC7B78DBE8E2E98B87DDC9C3E5BECACDBECACDBECA
CDBECACDBECACDBECACDBECACDBECACDBECACDBECACD6464646464648C8C8CBE
CACD6464648DA2A7BECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD
BECACDBECACDE8E2E9BAB4E4BECACD8B87DD0000CC3E3DD2BECACD7B78DB4E4C
D6BECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACD8DA2A7BECACD64
6464646464646464BECACD6464646464648C8C8CBECACDBECACDBECACDBECACD
BECACDBECACDBECACDBECACDBECACDD9D3E63E3DD29A96DEBECACD4E4CD60000
CCD9D3E6BECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBECACDBE
CACD6464648C8C8CBECACD6464646464648C8C8CBECACDBECACD}
NumGlyphs = 2

如何将此字符串转换为 HTML 的数据 URI?我试图将其转换为字节数组以从中制作位图,但这也失败了。我写了一个小的 C# Helper 工具来进行对话,但我无法让它运行。它在 Image.FromStream(ms) 上抛出 ArgumentException。

    private void button1_Click(object sender, EventArgs e)
{
byte[] bytes = StringToByteArray(textBox1.Text);
byte[] newBytes = new byte[bytes.Length - 4];
for(var i = 4; i < bytes.Length; i++)
{
newBytes[i - 4] = bytes[i];
}
using (var ms = new MemoryStream(bytes))
{
Image image = Image.FromStream(ms);
pictureBox_originalImage.Image = image;
}
}
public static byte[] StringToByteArray(String hex)
{
int NumberChars = hex.Length;
byte[] bytes = new byte[NumberChars / 2];
for (int i = 0; i < NumberChars; i += 2)
bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
return bytes;
}

提前致谢。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com