精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。需要全文内容也请联系孙老师。
This looks a little too familiar with something that I wrote a few years back: 这里的有些东西看起来有点太熟悉了,我几年前写了:
http://christian-helle.blogspot.com/2008/01/transparent-controls-in-netcf.html[^]
I saw ur blog, yeah u r right, these r similar. 我看到了你的博客,你是对的,这些是相似的。
I will repair my article in a few days. 我会在这几天之内修复我的文章。
But the concept of all transparent controls are similar. 但所有透明控件的概念是相似的。
Thanks 谢谢
This is ur code for transparent form. 这是你的透明窗体的代码。
public class FormBase : Form, IControlBackground
{
Bitmap background;
public FormBase()
{
background = new Bitmap(
Assembly.GetExecutingAssembly().GetManifestResourceStream(
"TransparentSample.background.jpg"));
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawImage(background, 0, 0);
}
public Image BackgroundImage
{
get { return background; }
}
}
and this is my code for transparency! I think they are different! Let me know ur idea! 这是我的透明代码!我认为他们是不同的!让我知道你的想法!
public class GForm : Form, IControlBackground { Bitmap background; protected override void OnPaint(PaintEventArgs e) { if (background != null) e.Graphics.DrawImage(background, 0, 0); else base.OnPaint(e); } public Bitmap BackgroundImage { get { return background; } set { background = value; } } }
What made me think was actually the interface IControlBackground, how its used in GForm, and this piece of code:
实际上是IControlBackground接口让我想到,在GForm中如何使用它,还有这段代码:
protected bool HasBackground = false; protected override void OnPaintBackground(PaintEventArgs e) { IControlBackground form = Parent as IControlBackground; if (form == null) { base.OnPaintBackground(e); return; } else { HasBackground = true; } e.Graphics.DrawImage( form.BackgroundImage, 0, 0, Bounds, GraphicsUnit.Pixel); }
You're ImageButton class doesn't seem to be a base class of anything yet you have a protected field called HasBackground and use it the exact same way I did.
I always reference to my articles when I helpout in the newsgroups and the MSDN forums and the entire purpose of the code i share is to help out the community. Its nice that you help out in the community. And that's all that really matters.
你的ImageButton类似乎不是一个基类或者其他什么东西,但是你有一个受保护的字段称为HasBackground,并且使用它的方法和我一样。
当我在新闻讨论组和 MSDN社区帮忙的时候,总是会提及到我的文章,我分享的代码目的是帮助社区。你在社区帮忙是非常好的。真正的事就是这些。
Keep up the good work保持良好的工作。
Thanks for ur sharing ur code, I think it is very help full for someone who want to know the way for making transparent controls.
谢谢你分享你的代码,我认为这对想要知道制作透明控件方法的人来说是非常有帮助的。
Thanks a lot for ur loyalty.
非常感谢你的忠诚。