Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Gráficos (https://www.clubdelphi.com/foros/forumdisplay.php?f=8)
-   -   PopupMenu con imagen (https://www.clubdelphi.com/foros/showthread.php?t=16509)

ramonibk 30-11-2004 19:34:54

PopupMenu con imagen
 
Hola a todos. estoi intentando colocar en un popupmenu una imagen en el laterar. no una por boton sino una que recorra todo el popup y no tengo ni la menor idea de como hacerlo. agradeceria buestra ayuda
gracias

Neftali [Germán.Estévez] 01-12-2004 10:10:47

La tarea no en simple, ya que deberás redibujar todo el menú.

Revisa ésta dirección:
http://www.bluecave.net/

A ver si es ésto lo que necesitas:
http://www.bluecave.net/products/bar.../BarMenus1.gif
http://www.bluecave.net/products/bar.../BarMenus2.gif
http://www.bluecave.net/products/bar.../BarMenus3.gif
http://www.bluecave.net/products/bar.../BarMenus5.gif

ramonibk 01-12-2004 11:56:52

Gracias Neftali. Lo que tu me has mandado lo estoy mirando.



He estado mirando en los ejemplos que vienen con los RXLib y he conseguido poner un texto de la siguiente manera

Código:


function CreateRotatedFont(Font: TFont; Angle: Integer): HFont;

var

  LogFont: TLogFont;

begin

  FillChar(LogFont, SizeOf(LogFont), 0);

  with LogFont do begin

        lfHeight := Font.Height;

        lfWidth := 0;

        lfEscapement := Angle * 10;

        lfOrientation := 0;

        if fsBold in Font.Style then lfWeight := FW_BOLD

        else lfWeight := FW_NORMAL;

        lfItalic := Ord(fsItalic in Font.Style);

        lfUnderline := Ord(fsUnderline in Font.Style);

        lfStrikeOut := Byte(fsStrikeOut in Font.Style);

{$IFDEF RX_D3}

        lfCharSet := Byte(Font.Charset);

        if AnsiCompareText(Font.Name, 'Default') = 0 then

          StrPCopy(lfFaceName, DefFontData.Name)

        else

          StrPCopy(lfFaceName, Font.Name);

{$ELSE}

  {$IFDEF VER93}

        lfCharSet := Byte(Font.Charset);

  {$ELSE}

        lfCharSet := DEFAULT_CHARSET;

  {$ENDIF}

        StrPCopy(lfFaceName, Font.Name);

{$ENDIF}

        lfQuality := DEFAULT_QUALITY;

        lfOutPrecision := OUT_DEFAULT_PRECIS;

        lfClipPrecision := CLIP_DEFAULT_PRECIS;

        case Font.Pitch of

          fpVariable: lfPitchAndFamily := VARIABLE_PITCH;

          fpFixed: lfPitchAndFamily := FIXED_PITCH;

          else lfPitchAndFamily := DEFAULT_PITCH;

        end;

  end;

  Result := CreateFontIndirect(LogFont);

end;



En el evento OnDrawMargin Se añade

Código:


procedure TfrmAlarma.PopupMenuDrawMargin(Sender: TMenu; Rect: TRect);

const

  Txt = 'Texto';

begin

  With PopUpMenu.Canvas.Font do begin

        Name := 'Courier New';

        Style := [fsBold];

        Size := 20;

        Color := clWhite;

        Handle := CreateRotatedFont(PopUpMenu.Canvas.Font, 90);

  end;

  PopUpMenu.DefaultDrawMargin(Rect, clLime, RGB(GetRValue(clLime) div 4,

        GetGValue(clLime) div 4, GetBValue(clLime) div 4));

  SetBkMode(PopUpMenu.Canvas.Handle, TRANSPARENT);

  ExtTextOut(PopUpMenu.Canvas.Handle, Rect.Left, Rect.Bottom - 5, ETO_CLIPPED,

        @Rect, Txt, Length(Txt), nil);

  End;





Y bueno después se pueden cambiar los colores, tamaños, etc, etc.



Pero sigo dándole Vueltas a como poder insertar una imagen. Yo seguiré mirando pero si alguien me puede dar alguna pista os lo agradecería.


La franja horaria es GMT +2. Ahora son las 17:51:51.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi