Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "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 files
Bmp.LoadFromFile()
and then
Form1.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
3-1120581828
Starcom
2005-07-05 20:43
2005.08.14
Дату последнего изменения БД в Caption


14-1121805487
radium
2005-07-20 00:38
2005.08.14
Update для D7 - кто ставил?


5-1093259795
Jenek
2004-08-23 15:16
2005.08.14
Windows и меню


1-1122346020
Knop
2005-07-26 06:47
2005.08.14
Поиск в файле (быстрый)


14-1122357192
Ega23
2005-07-26 09:53
2005.08.14
С днем рождения! 26 июля





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский