📄 ucxpstyle.pas
字号:
if not IsLine then
begin
if FMenu.IsRightToLeft then
begin
TextFormat := DT_RIGHT + DT_RTLREADING;
Dec(TextRect.Right, 3);
end
else
begin
TextFormat := 0;
Inc(TextRect.Left, 3);
end;
TextRect.Top := TextRect.Top +
((TextRect.Bottom - TextRect.Top) - ACanvas.TextHeight('W')) div 2;
FFontSettings := FUCXPSettings.Font;
DrawTheText(FMenuItem, txt, ShortCutToText(FMenuItem.ShortCut),
ACanvas, TextRect,
Selected, FMenuItem.Enabled, FMenuItem.Default,
FTopMenu, FMenu.IsRightToLeft, FFontSettings, TextFormat);
FUCXPSettings.Font := FFontSettings;
end
else
begin
if FMenu.IsRightToLeft then
begin
X1 := TextRect.Left;
X2 := TextRect.Right - 7;
end
else
begin
X1 := TextRect.Left + 7;
X2 := TextRect.Right;
end;
ACanvas.Pen.Color := FFSeparatorColor;
ACanvas.MoveTo(X1,
TextRect.Top +
Round((TextRect.Bottom - TextRect.Top) / 2));
ACanvas.LineTo(X2,
TextRect.Top +
Round((TextRect.Bottom - TextRect.Top) / 2))
end;
// +jt
BitBlt(origcanvas.Handle,origrect.Left,origrect.Top,buff.Width,buff.Height,ACanvas.Handle,0,0,SRCCOPY);
finally
B.free;
buff.free;
ACanvas := OrigCanvas;
ARect:=origrect;
end;
// +jt
if not (csDesigning in ComponentState) then
begin
if (FUCXPSettings.FlatMenu) and (not FTopMenu) then
begin
hDcM := ACanvas.Handle;
hWndM := WindowFromDC(hDcM);
// +jt
if (hWndM=0) and (Application.Handle<>0) then
begin
if not PeekMessage(msg,Application.Handle,WM_DRAWMENUBORDER,WM_DRAWMENUBORDER2,PM_NOREMOVE) then
PostMessage(Application.Handle,WM_DRAWMENUBORDER,0,Integer(FMenuItem));
end
else
if hWndM <> FForm.Handle then
begin
if not PeekMessage(msg,Application.Handle,WM_DRAWMENUBORDER,WM_DRAWMENUBORDER2,PM_NOREMOVE) then
PostMessage(Application.Handle,WM_DRAWMENUBORDER2,integer(FMenu.IsRightToLeft),Integer(hWndM));
end;
end;
end;
//-----
end;
{$IFDEF VER5U}
procedure TUCXPStyle.ToolBarDrawButton(Sender: TToolBar;
Button: TToolButton; State: TCustomDrawState; var DefaultDraw: Boolean);
var
ACanvas: TCanvas;
ARect, HoldRect: TRect;
B: TBitmap;
HasBitmap: boolean;
{Sylvain ...}
HasHotBitMap : Boolean;
HasDisBitMap : Boolean;
ImglstHand : THandle;
CanDraw : Boolean;
{... Sylvain}
BitmapWidth: integer;
TextFormat: integer;
XButton: TToolButton;
HasBorder: boolean;
HasBkg: boolean;
IsTransparent: boolean;
FBSelectColor: TColor;
FFontSettings: TFont; {fduenas}
procedure DrawBorder;
var
BRect, WRect: TRect;
procedure DrawRect;
begin
ACanvas.Pen.color := FFSelectBorderColor;
ACanvas.MoveTo(WRect.Left, WRect.Top);
ACanvas.LineTo(WRect.Right, WRect.Top);
ACanvas.LineTo(WRect.Right, WRect.Bottom);
ACanvas.LineTo(WRect.Left, WRect.Bottom);
ACanvas.LineTo(WRect.Left, WRect.Top);
end;
begin
BRect := HoldRect;
Dec(BRect.Bottom, 1);
Inc(BRect.Top, 1);
Dec(BRect.Right, 1);
WRect := BRect;
if Button.Style = tbsDropDown then
begin
Dec(WRect.Right, 13);
DrawRect;
WRect := BRect;
Inc(WRect.Left, WRect.Right - WRect.Left - 13);
DrawRect;
end
else
begin
DrawRect;
end;
end;
begin
B := nil;
{Added By Sylvain ...}
HasHotBitmap := (Sender.HotImages <> nil) and
(Button.ImageIndex <> -1) and
(Button.ImageIndex <= Sender.HotImages.Count - 1);
HasDisBitmap := (Sender.DisabledImages <> nil) and
(Button.ImageIndex <> -1) and
(Button.ImageIndex <= Sender.DisabledImages.Count - 1);
{...Sylvain}
HasBitmap := (Sender.Images <> nil) and
(Button.ImageIndex <> -1) and
(Button.ImageIndex <= Sender.Images.Count - 1);
IsTransparent := Sender.Transparent;
ACanvas := Sender.Canvas;
//SetGlobalColor(ACanvas);
if (FUCXPSettings.ColorsChanged) then SetGlobalColor(ACanvas); // +jt
if (Is16Bit) and (not FUCXPSettings.UseSystemColors) then
FBSelectColor := NewColor(ACanvas, FUCXPSettings.SelectColor, 68)
else
FBSelectColor := FFSelectColor;
HoldRect := Button.BoundsRect;
ARect := HoldRect;
if Is16Bit then
ACanvas.brush.color := NewColor(ACanvas, Sender.Color, 16)
else
ACanvas.brush.color := Sender.Color;
if not IsTransparent then
ACanvas.FillRect(ARect);
HasBorder := false;
HasBkg := false;
if (cdsHot in State) then
begin
if (cdsChecked in State) or (Button.Down) or (cdsSelected in State) then
ACanvas.Brush.Color := FCheckedAreaSelectColor
else
ACanvas.brush.color := FBSelectColor;
HasBorder := true;
HasBkg := true;
end;
if ((cdsChecked in State) and not (cdsHot in State)) then
begin
ACanvas.Brush.Color := FCheckedAreaColor;
HasBorder := true;
HasBkg := true;
end;
if (cdsIndeterminate in State) and not (cdsHot in State) then
begin
ACanvas.Brush.Color := FBSelectColor;
HasBkg := true;
end;
if (Button.MenuItem <> nil) and (State = []) then
begin
ACanvas.brush.color := Sender.Color;
if not IsTransparent then
HasBkg := true;
end;
Inc(ARect.Top, 1);
if HasBkg then
ACanvas.FillRect(ARect);
if HasBorder then
DrawBorder;
if ((Button.MenuItem <> nil) or (Button.DropdownMenu <> nil))
and (cdsSelected in State) then
begin
DrawTopMenuItem(Button, ACanvas, ARect, Sender.Color ,false);
DefaultDraw := false;
end;
ARect := HoldRect;
DefaultDraw := false;
if Button.Style = tbsDropDown then
begin
ACanvas.Pen.Color := clBlack;
DrawArrow(ACanvas, (ARect.Right - 14) + ((14 - 5) div 2),
ARect.Top + ((ARect.Bottom - ARect.Top - 3) div 2) + 1);
end;
BitmapWidth := 0;
{ Rem by Sylvain ...
if HasBitmap then
begin
... Sylvain}
try
B := TBitmap.Create;
CanDraw := False;
ImglstHand:=0;
if (cdsHot in State) AND HasHotBitmap then
begin
B.Width := Sender.HotImages.Width;
B.Height := Sender.HotImages.Height;
ImglstHand := Sender.HotImages.Handle;
CanDraw := True;
end
else if (cdsDisabled in State) and HasDisBitmap then
begin
B.Width := Sender.DisabledImages.Width;
B.Height := Sender.DisabledImages.Height;
ImglstHand := Sender.DisabledImages.Handle;
CanDraw := True;
end
else if HasBitMap then
begin
B.Width := Sender.Images.Width;
B.Height := Sender.Images.Height;
ImglstHand := Sender.Images.Handle;
CanDraw := True;
end;
if CanDraw then
begin {CanDraw}
// B.Canvas.Brush.Color := TransparentColor; // ACanvas.Brush.Color; // +jt
B.Canvas.Brush.Color := B.Canvas.Pixels[0, B.Height - 1];//"Todd Asher" <ashert@yadasystems.com>
B.Canvas.FillRect(Rect(0, 0, B.Width, B.Height));
ImageList_DrawEx(ImglstHand, Button.ImageIndex,
B.Canvas.Handle, 0, 0, 0, 0, clNone, clNone, ILD_Transparent);
BitmapWidth := b.Width;
if Button.Style = tbsDropDown then
Dec(ARect.Right, 12);
if TToolBar(Button.Parent).List then
begin
if Button.BiDiMode = bdRightToLeft then
begin
Dec(ARect.Right, 3);
ARect.Left := ARect.Right - BitmapWidth;
end
else
begin
Inc(ARect.Left, 3);
ARect.Right := ARect.Left + BitmapWidth
end
end
else
ARect.Left := Round(ARect.Left + (ARect.Right - ARect.Left - B.Width)/2);
inc(ARect.Top, 2);
ARect.Bottom := ARect.Top + B.Height + 6;
DrawIcon(Button, ACanvas, B, ARect, (cdsHot in State),
(cdsSelected in State), Button.Enabled, (cdsChecked in State), false,
false);
end; {CanDraw}
finally
B.Free;
end;
ARect := HoldRect;
DefaultDraw := false;
{rem by sylvain ...
end;
...Sylvain}
//-----------
if Sender.ShowCaptions then
begin
if Button.Style = tbsDropDown then
Dec(ARect.Right, 12);
if not TToolBar(Button.Parent).List then
begin
TextFormat := DT_Center;
ARect.Top := ARect.Bottom - ACanvas.TextHeight(Button.Caption) - 6;
end
else
begin
TextFormat := DT_VCENTER;
if Button.BiDiMode = bdRightToLeft then
begin
TextFormat := TextFormat + DT_Right;
Dec(ARect.Right, BitmapWidth + 7);
end
else
begin
if BitmapWidth > 0 then //"Dan Downs" <dan@laserformsinc.com>
if Sender.List then //Micha雔 Moreno <michael@weatherderivs.com>
Inc(ARect.Left, BitmapWidth + 6)
else
Inc(ARect.Left, BitmapWidth);
end
end;
if (Button.MenuItem <> nil) then
begin
TextFormat := DT_Center;
//Inc(ARect.Left, 1);
end;
if Button.BiDiMode = bdRightToLeft then
TextFormat := TextFormat + DT_RTLREADING;
if Button.Down and not Button.Enabled then //"felix" <felix@unidreamtech.com> 23/5
InflateRect(ARect, -1, -1);
{alexs alexs75@hotbox.ru}
ARect.Top := ARect.Top + ((ARect.Bottom - ARect.Top) - ACanvas.TextHeight('W')) div 2;
FFontSettings := FUCXPSettings.Font;
DrawTheText(Button, Button.Caption, '',
ACanvas, ARect,
(cdsSelected in State), Button.Enabled, false,
(Button.MenuItem <> nil),
(Button.BidiMode = bdRightToLeft), FFontSettings, TextFormat);
FUCXPSettings.Font := FFontSettings;
ARect := HoldRect;
DefaultDraw := false;
end;
if Button.Index > 0 then
begin
XButton := {TToolBar(Button.Parent)}Sender.Buttons[Button.Index - 1];
if (XButton.Style = tbsDivider) or (XButton.Style = tbsSeparator) then
begin
ARect := XButton.BoundsRect;
if Is16Bit then
ACanvas.brush.color := NewColor(ACanvas, Sender.Color, 16)
else
ACanvas.brush.color := Sender.Color;
if not IsTransparent then
ACanvas.FillRect(ARect);
// if (XButton.Style = tbsDivider) then // Can't get it.
if XButton.Tag > 0 then
begin
Inc(ARect.Top, 2);
Dec(ARect.Bottom, 1);
ACanvas.Pen.color := GetShadeColor(ACanvas,Sender.Color,30);
ARect.Left := ARect.Left + (ARect.Right - ARect.Left) div 2;
ACanvas.MoveTo(ARect.Left, ARect.Top);
ACanvas.LineTo(ARect.Left, ARect.Bottom);
end;
ARect := Button.BoundsRect;
DefaultDraw := false;
end;
end;
{if Button.MenuItem <> nil then
if (xcMainMenu in UCXPControls) then
ActivateMenuItem(Button.MenuItem);}
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -