Форум: "KOL";
Текущий архив: 2005.08.14;
Скачать: [xml.tar.bz2];
ВнизКартинки в меню Найти похожие ветки
← →
BelchonkH (2005-01-07 18:04) [0]Доброго Вам!!! Такой вот глюк с картинками в меню, если меню не белого цвета, то картинки сразу отображаются с искажёнными цветами... в VCL этого нет...
← →
thaddy (2005-01-08 15:14) [1]There is a problem with the menu and also with the toolbar that I solve like this:
var
MAP: array[0..1] of Tcolor;
begin
Map[0]:=clOlive;// Your transparent color
Map[1]:=GetSysColor(COLOR_BTNFACE);// Very Important to do this!!
tb.TBAddBitmap(LoadMappedBitmapEx(Result, hInstance, "MYBITMAP", map));
// similar code should be used for menu bitmaps
← →
thaddy (2005-01-08 15:39) [2]for menu like this:
Assumes bitmap in resource
procedure NewForm1( var Result: PForm1; AParent: PControl );
var
Map:array[0..1] of Tcolor;
begin
New(Result,Create);
with Result^ do
begin
Form:= NewForm(AParent,"KOLForm").SetSize(600,400).centeronparent.Tabulate;
Applet:=Form;
Map[0]:=clOlive;
Map[1]:=GetSysColor(COLOR_MENU);
Form.Add2AutoFree(Result);
Menu:=NewMenu(Form,0,["&File","(","&Open","-","E&xit",")"],Domenu);
Menu.ItemBitmap[1]:=LoadMappedBitmapEx(Result, hInstance, "MYBITMAP", map);
end;
end;
← →
thaddy (2005-01-08 15:48) [3]Background:
In Kol.pas the system colors like clMenu are calculated as:
clMenu = TColor(COLOR_MENU or $80000000);
Which is not correct for at least Windows XP.
So you should use GetSysColor with the API declaration from windows.pas (see win32.hlp under GetSysColor for an overview.
Maybe this is a bug in kol? (and the VCL too..)
← →
BelchonokH (2005-01-08 23:48) [4]2 thaddy [2]
>>for menu like this:
It does not work in my case. Images for menu I load from external filesBmp.LoadFromFile()
and thenForm1.PopUpMenu1.ItemBitmap[ Form1.PopUpMenu1.Count-1 ] :=CopyImage( Bmp.Handle, IMAGE_BITMAP, 0, 0, 0);
Tried to correct CreateMappedBitmapEx... It does not work too.
← →
thaddy (2005-01-09 11:36) [5]Can"t you put them in a resource?
I have tested the code on 4 machines at that code works!
I will try to create an example with loadfromfile.
You might get lucky if you load it into a Imagelist! and use the
GetSysColor call to set the transparent color, although I have not tested this yet.
← →
thaddy (2005-01-09 12:02) [6]// I am shure this can be done easier, but this works!
// Uses bitmap(per item) and imagelist
procedure NewForm1( var Result: PForm1; AParent: PControl );
begin
New(Result,Create);
with Result^ do
begin
Form:= NewForm(AParent,"KOLForm").SetSize(600,400).centeronparent.Tabulate;
Applet:=Form;
Form.Add2AutoFree(Result);
Menu:=Newmenu(form,0,["&File","(","&Open","-","E&xit",")"],Domenu);
ImgList:=NewImagelist(form);
Imglist.ImgWidth:=14;
Imglist.ImgHeight:=14;
ImgList.LoadFromFile("bitmap1.bmp", clOlive,itBitmap);
BitMap:=Newbitmap(14,14);
Bitmap.Handle;
ImgList.Draw(0,Bitmap.canvas.handle,0,0);
Menu.Items[1].bitmap:=Bitmap.Handle;
form.onpaint:=formpaint;
end;
end;
← →
BelchonokH (2005-01-09 15:44) [7]Can you have not understood me...
With a transparent color everything is all right...
Look please at a picture, I speak about it http://www.redisog.com/menu.jpg
← →
BelchonokH (2005-01-09 22:18) [8]Попробую поставить вопрос по другому, можно ли как-нибудь исказить цвет картинки для меню так, чтобы при наложении на меню они исказились обратно и получили первоначальные цвета?
Страницы: 1 вся ветка
Форум: "KOL";
Текущий архив: 2005.08.14;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.01 c