![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Buscar | Temas de Hoy | Marcar Foros Como Leídos |
![]() |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
|
|
#1
|
||||
|
||||
|
Se me ocurre una forma sencilla, que es un TPanel con un TShape y alineación alClient; Ya sea por separado o creando un componente nuevo derivado del TPanel y creando el TShape en su interior.
No se si exactamente te refieres a eso y te puede servir...
__________________
Germán Estévez => Web/Blog Guía de estilo, Guía alternativa Utiliza TAG's en tus mensajes. Contactar con el Clubdelphi ![]() P.D: Más tiempo dedicado a la pregunta=Mejores respuestas. |
|
#2
|
|||
|
|||
|
en realidad no...
...lamentablemente no me sirve porque lo que yo quiero es un cuadro vacío, es decir un rectangulo dibujado con una linea y el interior transparente. Digamos algo tipo Bevel o un TShape con BrushStyle bsClear. |
|
#3
|
||||
|
||||
|
Creo que tendrás que hechar mano a las regiones, hechale un vistaso en la ayuda a la función CreatePolygonRgn y CombineRgn
Pues nada que te creas una región como la que necesitas y después al TPanel de Neftali le aplicas un SetWindowRgn y listo. Espero te de resultado esta idea. saludos.
__________________
Lo importante no es llegar primero, sino saber llegar. Para que puedas llegar mejor lee la Guia de Estilo |
|
#4
|
|||
|
|||
|
Pensé en eso, pero no quería hacer sufrir tanto al windows con regiones irregulares, pensé que había formas más sencillas...
|
|
#5
|
||||
|
||||
|
Cita:
Cita:
Saludos
__________________
Lo importante no es llegar primero, sino saber llegar. Para que puedas llegar mejor lee la Guia de Estilo |
|
#6
|
||||
|
||||
|
Un ejemplito para si te decides
Pon en tu form un TPanel de 40 por 40, lo puedes pintar de azul para que se distinga bien y en el Oncreate de tu form
Saludos
__________________
Lo importante no es llegar primero, sino saber llegar. Para que puedas llegar mejor lee la Guia de Estilo Última edición por yusnerqui fecha: 20-07-2005 a las 21:22:26. Razón: Reducir el código |
|
#7
|
|||
|
|||
|
a falta de mejores ideas...
A falta de mejor opción, decidí quedarme con la opción de las regiones de yusnerqui y hacerle pagar a Windows alguna de las que me debe. Por si a alguien le sirve, me hice un componente y lo bauticé "SuperBevel" porque no se me ocurrió un nombre mejor. Una de las utilidades de este cuadro es p. ej. darle un movimiento y simular el efecto que hace el Word cuando guarda un documento, o enmarcar un comentario transparente tipo Hint. Bueno... como sea, considérenlo suyo
.Código:
unit SuperBevel;
interface
uses
SysUtils, Classes, Controls, Messages, Graphics, Windows;
type
TSuperBevel = class(TCustomControl)
private
FBtnPoints : array[1..2] of TPoint;
FRegion : THandle;
FLineWidth: Integer;
FColor: TColor;
procedure FreeRegion;
procedure SetLineWidth(Value: Integer);
procedure SetColor(Value: TColor);
protected
procedure Paint; override;
function CreateRegion(x1,y1,x2,y2: Integer): THandle;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
Property LineWidth: Integer read FLineWidth write SetLineWidth;
property Color: TColor read FColor write SetColor;
end;
procedure Register;
implementation
constructor TSuperBevel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FRegion := 0;
FLineWidth:=1;
Width := 200;
Height := 100;
end;
destructor TSuperBevel.Destroy;
begin
if FRegion <> 0 then FreeRegion;
inherited Destroy;
end;
function TSuperBevel.CreateRegion(x1,y1,x2,y2: Integer): THandle;
var
Excl: THandle;
begin
Result := CreateRectRGN(x1, y1, x2, y2);
Excl := CreateRectRGN(x1+FLineWidth,y1+FLineWidth,x2-FLineWidth,y2-FLineWidth);
try
CombineRGN(Result, Result, Excl, RGN_DIFF);
finally
DeleteObject(Excl);
end;
end;
procedure TSuperBevel.FreeRegion;
begin
if FRegion <> 0 then
DeleteObject(FRegion);
FRegion := 0;
end;
procedure TSuperBevel.Paint;
var
i: Integer;
begin
Canvas.Pen.Width:=1;
Canvas.Pen.Color:=FColor;
Canvas.Brush.Color:=FColor;
Canvas.Brush.Style:=bsSolid;
Canvas.Pen.Style:=psSolid;
Canvas.Rectangle(0, 0, Width, Height);
FRegion := CreateRegion(0,0,width,height);
SetWindowRGN(Handle, FRegion, True);
end;
procedure TSuperBevel.SetLineWidth(Value: Integer);
begin
if (FLineWidth <> Value) and (Value > 0) then begin
FLineWidth := Value;
Invalidate;
end;
end;
procedure TSuperBevel.SetColor(Value: TColor);
begin
if FColor <> Value then begin
FColor := Value;
Invalidate;
end;
end;
procedure Register;
begin
RegisterComponents('Samples', [TSuperBevel]);
end;
end.
|
![]() |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
|