首页 > 代码库 > 创建调色板
创建调色板
procedure TForm1.Button1Click(Sender: TObject); var lpPalette : PLogPalette; hPal : hPalette; i : integer; begin {Allocate the memory used by the palette} GetMem(lpPalette, sizeof(TLogPalette) + (255 * sizeof(TPaletteEntry))); {Fill out the palette header} lpPalette^.palVersion := $300; lpPalette^.palNumEntries := 256; {Turn range checking off if it is on and} {remember the range checking state} {$IFOPT R+} {$DEFINE CKRANGE} {$R-} {$ENDIF} {Fill in the palette structure color table with shades of gray} for i := 0 to 255 do begin lpPalette^.PalPalEntry[i].peRed := i; lpPalette^.PalPalEntry[i].peGreen := i; lpPalette^.PalPalEntry[i].peBlue := i; end; {Turn range checking back on if it was on when we started} {$IFDEF CKRANGE} {$UNDEF CKRANGE} {$R+} {$ENDIF} {Create a palette handle} hPal := CreatePalette(lpPalette^); {Free the memory use by the palette structure} FreeMem(lpPalette, sizeof(TLogPalette) + (255 * sizeof(TPaletteEntry))); {Do something with the palette here} {Delete the palette handle after use} DeleteObject(hPal); end;
创建调色板
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。