Dimming the background.

2023-10-17 06:59
文章标签 background dimming

本文主要是介绍Dimming the background.,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

实际是用一个Form遮盖另一个。

 

 

I've received a question from the customer the other day asking me how he can implement functionality of "dimming" background effect when a message box is shown in his Windows Mobile application. In fact it should be pretty easy to do utilizing the DrawAlpha method from the GraphicsExtender class that I showed you in this webcast . Take a look at the following code snippet:

 

protected override void OnPaint(PaintEventArgs e)

{

// Create a temp bitmap

Bitmap dimBackGround = new Bitmap (this .Width, this .Height);

Graphics gxTemp = Graphics .FromImage(dimBackGround);

// Color it black

gxTemp.Clear(Color .Black);

// Draw it with alpha transparency

e.Graphics.DrawAlpha(dimBackGround, 100, 0, 0);

// Clean up

gxTemp.Dispose();

dimBackGround.Dispose();

}

The code above shows OnPaint override method in the BackgroundForm class that I've added to the demo project. I've set the FormBorderStyle to None and WindowState to Maximized for this from to make it full screen.

So, now before displaying a message box you will need to show the BackroundForm:

 

 


 

BackgroundForm form = new BackgroundForm();

form.Show();

MessageBox.Show(txtMessage.Text);

form.Close();

 

And here's the result:

Download the sample code from here





     本文转自xyz_lmn51CTO博客,原文链接:http://blog.51cto.com/xyzlmn/819924,如需转载请自行联系原作者

这篇关于Dimming the background.的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/223719

相关文章

混合模式属性background-blend-mode

background-blend-mode 是 CSS 中的一个属性,它允许你将背景图像与背景颜色或背景图像之间以一种特定的混合模式进行混合。这个属性为网页设计师提供了一种强大的方式来创建视觉上吸引人的背景效果,无需使用图像编辑软件或额外的图像文件。 background-blend-mode 可以应用于单个背景图像与背景颜色之间,或者当设置多个背景图像时,应用于这些图像之间。混合模式包括了许多

【CSS】background样式没有生效

1. 问题背景 设置了background-size:"100% 100%" 没有生效。 background: `url(${this.getUrl(this.state.scenelist.length > 1 ? item.bannerLongUrl : item.bannerShortUrl)})`,\background-size:"100% 100%" 2.分析 2.1 结

css background学习

background中背景单词 background-color: 设置颜色作为对象背景颜色 background-image :设置图片作为背景图片 background-repeat :设置背景平铺重复方向 background-attachment 设置或检索背景图像是随对象内容滚动还是固定的。 background-position 设置或检索对象的背景图像位置。 使用方法 B

【vue css】background设置背景图片不显示问题

问题: 如上图所示,添加背景图片页面没有显示 解决: 添加background-position: center center 即可显示 但是不知道为什么添加这个属性就可以,求大神解惑

vue ----background-image (注意事项)

vue ----background-image坑 <div class="test"></div><style lang="scss">.test {width:100px;height:100px;background-image:url("../../assects/img/test.png")}</style> 这种使用webpack打包会出现图片资源文件找不到问题

IE下background无法显示的问题

在做下拉框select的时候用一个箭头符号,作为下拉框的三角,在firefox和chrome下均可以正常显示,但是在IE下无法显示。 查找了很久,发现是图片格式问题,把png格式的转换成gif的就没有问题了。。。。 附相关代码,主要是html的: <style type="text/css"> .select{ width:180px; height:29px; overflow:hidde

前端开发_HTML5_CSS部分-背景(background)

背景(background) 1.引入    为了更好对内容有更好的颜色搭配和设置,我们可以使用背景做一些美化效果,那么接下来我们一起学习以下背景相关的属性。 2.背景(background)相关的属性样式 背景(background)相关的样式属性1.background-color:设置元素的背景颜色,可以使用关键字,也可以使用HEX和RGB2.background-image:设置背

启动redis提醒WARNING overcommit_memory is set to 0!Background save may fail under low memory condition.

前言 本人在Centos7服务器上启动redis,报如下问题: WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and the

Android13 app后台无法启动Abort background activity starts from

总纲 android13 rom 开发总纲说明 目录 1.前言 2.log分析 3.代码查找分析 4.修改方法 5.编译测试 6彩蛋 1.前言 Android13 用户app后台无法启动,提示Abort background activity starts from 10111 2.log分析 08-07 21:37:36.703: W/ActivityTask

Core Bluetooth Background Processing for iOS Apps

之前做了一个蓝牙的项目,但该项目的特点是,并不进行连接动作,而是始终依靠外设的广播去更新IOS的UI,获得一些数据进行处理,当设备在前台时,处理没有问题,并且能扫描到多台外设: NSDictionary* scanOptions = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:CBCent