水平耀斑

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can be easily solved by simply using a graphics creation tool such as Paint, Gimp, or Adobe Photoshop and the Transparency key tool found within the C# program.

我们都知道,功能代码是任何好的程序赖以生存的基础,但是,如果您的程序缺少良好的用户界面,则您的产品可能没有吸引客户满意的吸引力。 只需使用图形创建工具(例如Paint,Gimp或Adobe Photoshop)和C#程序中的透明键工具,就可以轻松解决此问题。

To ensure you have the correct amount of space for all form objects needed and even room for adding features down the road, design of your new program becomes the key to a successful build. In keeping with that tradition of design we will need to first layout how we would like our form to look at the end of our project.

为了确保为所有需要的表单对象留有适当的空间,甚至为将来添加功能留出空间,新程序的设计成为成功构建的关键。 为了保持设计的传统,我们将需要首先布局,以使我们的表单在项目结束时显示。

For this example we will be creating a mock MP3 Player. I have decided to make the form appear in the shape of a banner with the display information and buttons in the center. Here is how I would like my form to look when it is complete:

对于此示例,我们将创建一个模拟MP3播放器。 我决定使表格以横幅的形式出现,并在显示信息和按钮的中央。 这是我希望表单完成后的样子:

image001.jpg image001.jpg

As you can tell I am not an artist but for the purpose of this article let’s pretend it is the greatest design ever. You can do this step with nothing but a scratch piece of paper and pen just so you have a visual goal to work towards. Next we want to conceptualize a layout on the form to see if it meets your needs.

如您所知,我不是艺术家,但就本文而言,我们假设它是有史以来最出色的设计。 您只需要草稿纸和笔就可以完成此步骤,因此您有一个视觉目标可以实现。 接下来,我们要概念化表单上的布局,以查看其是否满足您的需求。

image002.jpg image002.jpg

Once again, despite the artistry it appears to be in line with my concept.

再说一次,尽管具有技巧性,但它似乎与我的概念一致。

The next step is where we turn idea into reality. From here going forward we will need to use an image creation program. I will use the basic MS PAINT program to create the form mask that we need. In your program of choice re-create the form that you want to see. It is best to put it in the middle of a slightly larger image. Remember to outline where your form items will be located.

下一步是我们将想法变为现实。 从这里开始,我们将需要使用图像创建程序。 我将使用基本的MS PAINT程序来创建所需的表单掩码。 在您选择的程序中,重新创建要查看的表单。 最好将其放在稍大的图像中间。 记住要概述表单项的位置。

image003.jpg image003.jpg

Next we want to fill the surrounding area with a solid color. This color should usually be something obnoxious as it will be easier to locate later down the line. In this example I choose lime green. The white area where your objects will be placed should also be colored to your liking at this point.

接下来,我们要用纯色填充周围区域。 这种颜色通常应该是令人讨厌的,因为以后可以很容易地找到它。 在此示例中,我选择石灰绿色。 此时,您放置对象的白色区域也应按您喜欢的颜色进行着色。

image004.jpg image004.jpg

This final mask image will show our form in the middle area and the surrounding green area as the mask. Save the image to your desktop or an equally accessible location.

最终的蒙版图像将在中间区域和周围的绿色区域显示我们的表单作为蒙版。 将图像保存到桌面或同样可访问的位置。

Now we will move to the Visual Studio / C# portion of this process. Create a new Windows Application in Visual Studio and add a PictureBox to the form. Next you will want to select the image mask you just created.

现在,我们将转到此过程的Visual Studio / C#部分。 在Visual Studio中创建一个新的Windows应用程序,并将一个PictureBox添加到窗体。 接下来,您将要选择刚刚创建的图像蒙版。

Expand the image and form until it fits correctly. At the end your form should look similar to this example:

展开图像和表格,直到正确适合为止。 最后,您的表单应类似于以下示例:

image005.jpg image005.jpg

In the properties box we will be setting the FormBorderStyle property to “None” to eliminate the top blue title bar. This is where our first bit of code comes into play. Because of a lack of the title bar we need to move the form directly. To achieve this effect you will need to add the following:

在属性框中,我们将FormBorderStyle属性设置为“ None”以消除顶部的蓝色标题栏。 这是我们第一部分代码开始发挥作用的地方。 由于缺少标题栏,我们需要直接移动表单。 为了达到这种效果,您将需要添加以下内容:

[At the top]

[在顶部]

using System.Runtime.InteropServices;

[Above public Form1()]

[在公共Form1()之上]

public static extern bool ReleaseCapture();
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd,int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")][In pictureBox1_MouseDown event]private void Form1_MouseDown(object sender,System.Windows.Forms.MouseEventArgs e)
{if (e.Button == MouseButtons.Left){ReleaseCapture();SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);}

Source: http://www.codeproject.com/KB/cs/csharpmovewindow.aspx

资料来源: http : //www.codeproject.com/KB/cs/csharpmovewindow.aspx

You should now be able to move your form without a title bar.

现在,您应该可以在没有标题栏的情况下移动表单。

The final step is setting the transparency key. Please note that you need to select Form1 for this and not the picturebox. From the properties box scroll down to TransparencyKey and set it to the same obnoxious color at your pictures background.

最后一步是设置透明度键。 请注意,您需要为此选择Form1,而不是图片框。 从属性框中向下滚动到TransparencyKey,然后将其设置为图片背景上相同的令人讨厌的颜色。

Add and code your objects, run the program and there you have it, a sweet looking form ready to impress your end users.

添加对象并编写代码,运行程序,然后就可以使用它了,它看起来很漂亮,可以打动最终用户。

image006.jpg image006.jpg

If you are unhappy with the layout just re-draw another form and try again. The possibilities are endless.

如果您对布局不满意,请重新绘制另一张表格,然后重试。 可能性是无止境。

翻译自: https://www.experts-exchange.com/articles/4382/Add-Flare-with-Paint-and-Transparency-Keys-to-your-C-projects.html

水平耀斑

水平耀斑_将带有油漆和透明度键的耀斑添加到您的C#项目中相关推荐

  1. 技术面试问项目难题如何解决的_【知识】同轴线如何当quot;网线quot;使用?解决改造项目中难题...

    新朋友请 点上方蓝字"中博智能"免费关注 很多的项目原先是用的同轴线,但是随着网络发展,不得不改造使用网线了,但很多早期的项目之前是没有放网线的,由于减少改造的难度与成本问题,因此 ...

  2. git项目中的子git项目_使用子模块和子树管理Git项目

    git项目中的子git项目 如果您从事开源开发,则可能与Git一起管理源代码. 您可能遇到过具有大量依赖项和/或子项目的项目. 您如何管理它们? 对于开源组织,为社区和产品实现单源文档和依赖性管理可能 ...

  3. java 数字字母进位_使用带有进位的8085微处理器将两个8位数字相乘

    java 数字字母进位 Problem statement: 问题陈述: Multiplication of two 8 bits numbers using 8085 microprocessor ...

  4. 产品硬件成本分析_硬件项目中的错误成本

    产品硬件成本分析 Hello everyone! 大家好! In this article, we will consider common errors in the design of elect ...

  5. 前端开发从项目中获得什么_我如何获得副项目的前10个客户以及从他们那里学到的东西...

    前端开发从项目中获得什么 by Tigran Hakobyan 由Tigran Hakobyan 我如何获得副项目的前10个客户以及从他们那里学到的东西 (How I got my first 10 ...

  6. OpenCV函数简记_第三章数字图像的滤波处理(方框,均值,高斯,中值和双边滤波)

    系列文章目录 OpenCV函数简记_第一章数字图像的基本概念(邻域,连通,色彩空间) OpenCV函数简记_第二章数字图像的基本操作(图像读写,图像像素获取,图像ROI获取,图像混合,图形绘制) Op ...

  7. ios 容器类_在新的ios项目中使用的10个容器

    ios 容器类 If you start developing a new iOS app, you probably need to use several external libraries. ...

  8. 前端大型开源项目_在大型开源项目中管理问题

    前端大型开源项目 We're honored by the amount of positive feedback we get from folks using Flutter. As one of ...

  9. 第五届北大青鸟杯全国IT精英挑战赛华中区一等奖项目——中商百货分销系统_关键代码说明书

    第五届北大青鸟杯全国IT精英挑战赛华中区一等奖项目--中商百货分销系统 关键代码说明书 作者:武汉宏鹏田超凡 版权所有,转载请注明原作者,仿冒侵权必究法律责任 中商百货分销商城关键代码说明...... ...

最新文章

  1. NSInvocation
  2. 防止过拟合,采用的手段有哪些?
  3. 产品经理十二时辰:内容过于真实,扎心了!
  4. java微信web支付开发_微信支付java开发详细第三方支付功能开发之支付宝web端支...
  5. python 高阶函数一 概念
  6. 关于github上开源nineoldandroids兼容动画的笔记
  7. 我是如何查找RFC官方资料的
  8. ubuntu安装pip,setuptools
  9. 阿里云环境迁移记录 - RabbitMQ集群搭建
  10. 直播APP源码功能详解
  11. beego框架:static目录下的apk文件浏览器下载使用正常,手机浏览器下载无法解析安装
  12. 匿名发脉脉的拼多多员工,是如何被发现的?背后真相令人发指...
  13. Eclipse新建Android项目报错解决方案详细汇总
  14. 君明乐官,不明乐音。
  15. NOIP训练 czy的后宫6(线性dp)
  16. 计算机ip怎么换路由器,教你如何修改路由器LAN口IP地址的方法
  17. 从win7到win10的那些事~
  18. 浪潮之巅第十三章 — 高科技公司的摇篮:斯坦福大学
  19. vb.net程序可以在触摸屏上运行么_【干货】触摸屏控制变频器的方法与步骤
  20. bzoj 4627: [BeiJing2016]回转寿司 -- 权值线段树

热门文章

  1. Flink一站式平台 StreamX 1.2.2 正式发布, 迄今最稳定可用版本
  2. Python字典以及方法的测试
  3. 研究人员通过监听你的电脑处理器发出的细小声音破解了世界上最困难的加密算法之壹:4096 位 RSA
  4. OpenCV常用函数记载
  5. C语言-己有变量定义和西数调用语句,输入字符型a ,整型n 利用函数调用语句mypow(a,n);用来求a的n次方
  6. C#WinForm实现对Excel的数据处理
  7. 成都市武侯区计算机实验小学校长,成都市武侯区群文阅读研究活动在棕北小学召开...
  8. OpenAI Codex,GitHub Copilot 和cheat.sh 三个代码建议工具对比
  9. IDEA创建maven项目没有src目录问题解决
  10. Norton AntiVirus (诺顿杀毒)v9.0 简体中文企业版http://down.hotlife.cn/html/download/2006/5/30/1148978165.shtml