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给我的感觉像是一个新生婴儿,不带多余的花俏 ...
随机推荐
- 【 D3.js 高级系列 — 2.0 】 机械图 + 人物关系图
机械图(力路线图)结合老百姓的关系图中的生活,这是更有趣. 本文将以此为证据,所列的如何图插入外部的图像和文字的力学. 在[第 9.2 章]中制作了一个最简单的力学图.其后有非常多朋友有疑问,基本的问 ...
- Springboot系列:@SpringBootApplication注解
在使用 Springboot 框架进行开发的时候,通常我们会在 main 函数上添加 @SpringBootApplication 注解,今天为大家解析一下 @SpringBootApplicatio ...
- 关于easyui-accordion的添加以及显示隐藏菜单的使用
<script type="text/javascript"> $(function() { leftMenus(); }); function leftMenus() ...
- ASP.NET获取web应用程序的路径
服务器磁盘上的物理路径: HttPRuntime.AppDomainAppPath虚拟程序路径: HttpRuntime.AppDomainAppVirtualPath 任何于Request/Http ...
- wpf控件开发基础(3) -属性系统(2)
原文:wpf控件开发基础(3) -属性系统(2) 上篇说明了属性存在的一系列问题. 属性默认值,可以保证属性的有效性. 属性验证有效性,可以对输入的属性进行校验 属性强制回调, 即不管属性有无发生变化 ...
- Linux学习(1)vi编辑器的常用命令
今天对Linux中的vi编辑器进行了学习,对其中的常用命令进行总结: 数字 0 或^:光标移到行首 $ :光标移到行尾 H :光标移到屏幕的首行 L ...
- 从 XML 到 XPath
XPath是 W3C(World Wide Website Consortium) 的一个标准.它最主要的目的是为了在 XML1.0 或 XML1.1 文档节点树中定位节点所设计. XPath 即为 ...
- 学习vi和vim编辑(4):高速移动定位
平时.第一步是编辑文本需要做将光标移动到需要编辑.因此,根据需要,将光标移动到目标数字键来编辑文本的速度在一定程度上. 一篇文章.主要介绍怎样高速移动光标. 依据屏幕来移动: 在一个有几千行文本的文件 ...
- Analysis of variance(ANOVA)
方差分析,也称为"变异数分析",用于两个及两个以上样本均值(group means)差别的显著性检验.在 ANOVA 的环境下,一个观测得到的方差视为是由不同方差的源组合而成.
- C# 比较不错的通用验证码
1 using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging ...