Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能修改文字字体字号颜色吗? #1

Open
YonlinZ opened this issue Feb 28, 2019 · 5 comments
Open

能修改文字字体字号颜色吗? #1

YonlinZ opened this issue Feb 28, 2019 · 5 comments

Comments

@YonlinZ
Copy link

YonlinZ commented Feb 28, 2019

No description provided.

@ahdung
Copy link
Owner

ahdung commented Feb 28, 2019

@ZhuYonglin 这个消息框是仿系统向的,追求的是一种正规的感觉,所以没有提供视觉元素方面的修改接口。要修改的话只能从源码着手,文本是在这里绘制的:
https://github.com/ahdung/MessageBoxEx/blob/163620a0716644bd118afdff503b084bbc251d74/MsgBox.cs#L674

@YonlinZ
Copy link
Author

YonlinZ commented Feb 28, 2019

static readonly Font GlobalFont = SystemFonts.MessageBoxFont;

我找到了一个全局的字体,修改后有效过,但是下方panel高度有问题,上方的标题大小也有问题
image

@ahdung
Copy link
Owner

ahdung commented Feb 28, 2019

@ZhuYonglin 因为GlobalFont用在多个地方,牵连较大,所以如果你只想改消息区,还只能在 TextRenderer.DrawText处指定特别字体,另外,颜色也可以在这里改。
至于标题栏字体,由于这是标准的Windows窗体,标题边框等元素由系统控制,并不是自绘的,所以改不了~或者说只能改系统主题。

@YonlinZ
Copy link
Author

YonlinZ commented Feb 28, 2019

@ahdung 能告知下如何改个提示窗大小,和下方panel区域大小的代码段在哪吗? 3Q

@ahdung
Copy link
Owner

ahdung commented Feb 28, 2019

@ZhuYonglin 这些是根据内容自动确定的,如果你想手动,可以在MessageForm的构造里改ClientSize,这控制的是整个消息窗体的尺寸,至于按钮区的尺寸,可在CreateButtonsPanel中找找。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants