c#透明panel
先看下效果
纯透明的pane,然后设置一个半透明的图片,可以看出来显示了父控件的button
看代码
public partial class PanelEx : Panel
{
protected Graphics graphics; protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00000020; // 实现透明样式 return cp;
}
}
public PanelEx()
{
InitializeComponent();
this.BackColor = Color.Transparent;
this.ForeColor = Color.Transparent;
}
protected override void OnPaintBackground(PaintEventArgs pevent)
{ }
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
this.graphics = e.Graphics; this.graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
this.graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear;
this.graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
this.graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
this.graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; if (this.BackgroundImage != null)
{
int width = this.Width;
int height = this.Height;
Rectangle recModel = new Rectangle(, , width, height);
this.graphics.DrawImage(this.BackgroundImage, recModel);
}
else if (this.ForeColor != Color.Transparent)
{
this.graphics.Clear(this.ForeColor);
} } }
c#透明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, ...
- 透明Panel
unit TransparentPanel; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Varia ...
- 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给我的感觉像是一个新生婴儿,不带多余的花俏 ...
随机推荐
- 【t003】string
Time Limit: 1 second Memory Limit: 50 MB [问题描述] 设有字符串X,我们称在X的头尾及中间插入任意多个空格后构成的新字符串为X的扩展串,如字符串X为" ...
- spring boot jar包 linux 部署
前提: jar包路径:/usr/local/lib/app/app.jar 1.首先先用vi创建文件 命令: cd /usr/local/lib/app/vi app-start.sh 2.在文件ap ...
- Android菜鸟的成长笔记(21)——跨进程调用Service
我们都知道在Android中的每一个应用是一个进程,其实每一个应用就相当于Linux系统里面的一个用户,进程和进程之间的通信其实就相当于用户和用户之间的通信,为了实现这种跨进程通信,Android提供 ...
- 获取web.config配置文件的sectionGroup
1)web.config 文件内容如下: <configuration> <configSections> <sectionGroup name="KaiXin ...
- Gram 矩阵性质及应用
v1,v2,-,vn 是内积空间的一组向量,Gram 矩阵定义为: Gij=⟨vi,vj⟩,显然其是对称矩阵. 其实对于一个XN⋅d(N 个样本,d 个属性)的样本矩阵而言,X⋅X′ 即为 Gram ...
- 1.跟着微软 https://docs.microsoft.com/zh-cn/dotnet/core/ 学习.net core
10分钟快速使用 安装之后 打开cmd 第一步. dotnet new console -o firstApp 第二步. cd firstApp 第三部.dotnet run 这样就运行了hello ...
- 从JDBC到commons-dbutils
1.前言 玩过Java web的人应该都接触过JDBC,正是有了它,Java程序才能轻松地访问数据库.JDBC很多人都会,但是为什么我还要写它呢?我曾经一度用烂了JDBC,一度认为JDBC不过如此,后 ...
- SICP 锻炼 (1.40)解决摘要
SICP 锻炼1.40 是一个休闲的工作非常easy,但它看起来很复杂,单的一道题. 题目原题例如以下: 请定义一个过程cubic, 它和newtons-method过程一起使用在以下形式的表达式里: ...
- crossplatform---Nodejs in Visual Studio Code 02.学习Nodejs
1.开始 源码下载:https://github.com/sayar/NodeMVA 在线视频:https://mva.microsoft.com/en-US/training-courses/usi ...
- easyui的datebox最简单的方法来格式化
看了网上有很多解决方案,我也写了一个比较简单的方法. 实现easyui的datebox格式化. 效果例如以下.用"++"隔开,看你喜欢用什么都能够. 1.html <span ...