如何在c#中更改消息框和标题的颜色。 [英] how to change the color of messagebox and captions in c#.

查看:102
本文介绍了如何在c#中更改消息框和标题的颜色。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#中更改消息框和标题的颜色。

以及如何在c#

解决方案

无法覆盖MessageBox 以更改其样式。但是,您可以创建自己的一个。您可以创建一个简单的窗口,然后以字符串的形式向其添加内容,该内容将显示给用户并显示一个简单的OK按钮。单击后会关闭窗口。



请记住,自定义MessageBox不是MessageBox,它可能是其他一些类对象,可以是一个简单的Window太。使用一些内容,以及一个按钮作为默认UI。样式可以作为C#对象属性应用,例如背景,前景等。



数据库有自己的东西和数学。在数据库中,您以二进制的形式保存图像。每个文件都以二进制形式保存,以便您可以提取或插入文件的二进制文件。然后由您决定正确获取二进制文件并将其显示为图像。



注意:SQL Server中的Image数据类型用于存储文件的二进制文件,而不是图像本身。




  1. 您不能根据具体情况重新设置默认消息框。 您当然可以创建自己的消息框,允许自定义。

  2. 查看此文章: 在C#中发送/接收PictureBox图像到/从Microsoft SQL SERVER [ ^ ]





请不要在同一篇文章中提出多个不同的问题。



/ ravi


how to change the color of message box and caption in c#.
and how to insert an image into database from a picturebox in c#

解决方案

MessageBox can't be overriden to change the style of it. However you can create one of your own. You can create a simple Window and then add content in the form of string to it, that will be shown to the user and a simple OK button. Which would close the window upon click.

Remember, a custom MessageBox won't be a MessageBox, it would be some other class object, and can be a simple Window too. With some content, and a button as the default UI. Styles can be applied as C# object properties such as Background, Foreground etc.

Database have their own things and maths. In Database you save an image in the form of binary. Every file is saved in the form of binary, so that you can extract or insert the binary of the file to it. It is then upto you, to properly get the binary back and display it as an image.

Note: The Image datatype in SQL Server is for storing the binary of the file, not the image itself.



  1. You can't restyle the default message box on a case by case basis.  You could of course create your own message box that allows customization.
  2. See this article: Sending/Receiving PictureBox Image in C# To/From Microsoft SQL SERVER[^]



Please don't ask multiple disparate questions in the same post.

/ravi


这篇关于如何在c#中更改消息框和标题的颜色。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆