透明Panel
unit TransparentPanel; interface uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;
type
TTransparentPanelClass = class(TPanel)
private
procedure SetParent(AParent: TWinControl); override;
procedure WMEraseBkGnd(var Message: TWMEraseBkGnd); message WM_EraseBkGnd;
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure Paint; override;
public
constructor Create(AOwner: TComponent); override;
procedure Invalidate; override;
end; implementation
constructor TTransparentPanelClass.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle - [csOpaque];
end; procedure TTransparentPanelClass.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_TRANSPARENT;
end; //进行绘制
procedure TTransparentPanelClass.Paint;
begin
Canvas.Brush.Style := bsClear;
Canvas.Rectangle(, , Width, Height);
Canvas.TextOut(Width div , Height div , 'Transparent');
end; procedure TTransparentPanelClass.WMEraseBkGnd(var Message: TWMEraseBkGnd);
begin
Message.Result := ;
end; procedure TTransparentPanelClass.SetParent(AParent: TWinControl);
begin
inherited SetParent(AParent);
if Parent <> nil then
SetWindowLong(Parent.Handle, GWL_STYLE, GetWindowLong
(Parent.Handle, GWL_STYLE) and not WS_ClipChildren);
end; procedure TTransparentPanelClass.Invalidate;
var
oRect: TRect;
begin
//重画
oRect := BoundsRect;
if (Parent <> nil) and Parent.HandleAllocated then
InvalidateRect(Parent.Handle, @oRect, True)
else
inherited Invalidate;
end; end.
透明Panel的更多相关文章
- (转载)c++builder/delphi中透明panel及透明窗口的实现方法_delphi教程
c++builder/delphi中透明panel及透明窗口的实现方法_delphi教程 可能大多数程序员会问:透明窗口,特别是透明Panel有什么应用价值呢?可别小看它们哦,下面我就来讲讲他们的巨大 ...
- Winform下透明Panel
网上很多写着透明Panel的方法,都是把BackColor属性设置为透明,然后指定Parent,实验了一下,对于部分情况下,是可用的,例如下层本身有自带的控件,但是,如果是用Graphic绘制的内容, ...
- 2016.5.30实现透明Panel及控件置顶的方法
想放置一个透明Panel在某控件上端,实现效果是可透过此Panel看见下面控件,但鼠标点击却无任何反应. 1.新建置自定义Panel类 using System; using System.Colle ...
- delphi透明panel组件或者制作方法
//透明Panel控件 unit TranPanel; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, ...
- c#透明panel
先看下效果 纯透明的pane,然后设置一个半透明的图片,可以看出来显示了父控件的button 看代码 public partial class PanelEx : Panel { protected ...
- Delphi控件的透明与不透明(要挨个解释一下原因),对InvalidateControl的关键理解
procedure TForm1.Button3Click(Sender: TObject);begin if (csOpaque in ControlStyle) then ShowMessage( ...
- delphi中panel控件应用
delphi中的panel控件是怎么使用的?研究了很久了,还是搞不懂,只知道把它放到form上面,其他操作一律不懂了,有谁可以请教一下,如何把其他控件放到里面去呢?谢谢 提问者采纳 直接把控件放到 ...
- Debian 7 安装配置总结
最近几天折腾了一下Debian 7 (gnome桌面DVD版,KDE桌面CD版最后会提到),总的来说收获还是挺大的,对比以前使用ubuntu,debian 7给我的感觉像是一个新生婴儿,不带多余的花俏 ...
- debian7 安装配置
最近几天折腾了一下Debian 7 (gnome桌面DVD版,KDE桌面CD版最后会提到),总的来说收获还是挺大的,对比以前使用ubuntu,debian 7给我的感觉像是一个新生婴儿,不带多余的花俏 ...
随机推荐
- Theorems for existence and uniqueness of variational problem
Introduction Among simulation engineers, it is well accepted that the solution of a PDE can be envis ...
- zabbix实操随笔
vmware 9.0安装,vmware tools安装 fedora 15.0安装1G内存以上fedora上基本操作指令1.vmtools 共享文件在linux上安装有问题,出现找不到**.so.1之 ...
- eclipse发布web
elipse集成tomcat 在实际开发中通常在eclipse中集成tomcat,这样在开发中更方便一些.打开eclipse,选择界面下方的servers选项,点击no servers are ava ...
- Codeforces 1140G Double Tree 倍增 + dp
刚开始, 我以为两个点肯定是通过树上最短路径过去的, 无非是在两棵树之间来回切换, 这个可以用倍增 + dp 去维护它. 但是后来又发现, 它可以不通过树上最短路径过去, 我们考虑这样一种情况, 起点 ...
- js防止安卓手机软键盘弹出挤压页面导致变形的方法
5防止安卓手机软键盘弹出挤压页面导致变形的方法 输入框定位在底部,手机端打开,输入框聚焦后软键盘打开为什么会瞬间自动关闭呢? 先看看问题: 1.原来是这样的: 2.在苹果手机里面是正常的: 3.到了安 ...
- MVC(面试)
一般都是三层,表现层(UI).业务逻辑层(BLL).数据访问层(DAL),这些东西不用深究,别为了设计而设计就行.分三层是为了使项目架构体系更加清晰,而且项目参与人员的分工也可以更加明确,也有利于项目 ...
- F(x) 数位dp
Problem Description For a decimal number x with n digits (AnAn-1An-2 ... A2A1), we define its weight ...
- bind注意事项(传引用参数的时候)
默认情况下,bind的那些不是占位符的参数被拷贝到bind返回的可调用对象中. 当需要把对象传到bind中的参数中时,需要使用ref或者cref. 例如: #include<iostream&g ...
- Git branch 出现"HEAD detached at head xxxxx"
Git branch 出现"HEAD detached at head xxxxx" git branch <your-branch-name> xxxxx ...
- IDEA快速入门(Mac版)
[持续更新]一篇今年年头的老文章顺道发布了,大家有任何问题可以留言沟通.当时刚刚加入团团,愿大家有机会还是购买一台MAC,确实能给大家的效率赋能,虽然在一开始会有一些艰难!⛽️ 望借着换工作的东风,好 ...