C# winform中如何控制背景图片的垂直位置? 在web中,一个背景图片的位置我们可以用CSS来控制,例如 background:url(xx.jpg) no-repeat 0(水平) -40(垂直);现在,我想在winform中控制一个背景图片的垂直位置.容器是picturebox,有什么属性或者应该怎么设置呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 好像除了在Paint事件里重画没有办法来设置这个坐标。 这个简单啊,参考如下:public partial class Form3 : Form{ private Point m_ImagePoint; public Point ImagePoint { get { return m_ImagePoint; } set { m_ImagePoint = value; } } private Image m_Image; public Image Image { get { return m_Image; } set { m_Image = value; } } public Form3() { InitializeComponent(); this.DoubleBuffered = true; } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (this.m_Image != null) { e.Graphics.DrawImage(this.m_ImagePoint.X, this.m_ImagePoint.Y, this.m_Image.Width, this.m_Image.Height); } }} 改一下,代码有误:protected override void OnPaint(PaintEventArgs e){ base.OnPaint(e); if (this.m_Image != null) { e.Graphics.DrawImage(this.m_Image, this.m_ImagePoint.X, this.m_ImagePoint.Y, this.m_Image.Width, this.m_Image.Height); }} Remoting通信,本机测试通过,局域网内不同机器通信失败?求解 背包问题 疑问:如果这样引用,C#还会懂得自动垃圾回收吗? wince5.0上SQLCE数据库问题 SQL事件探查器显示问题 求助:请问怎么用C#编写产生10个不重复的数字 insert 语句问题? Mci播放局域网wav文件的问题 大家帮帮看俺应该怎么处理,需要多线程吗? 如何定时弹出一个窗口 已有打开的与此命令相关联的 DataReader,必须首先将它关闭。 为什么我的删除不了
{
private Point m_ImagePoint; public Point ImagePoint
{
get { return m_ImagePoint; }
set { m_ImagePoint = value; }
} private Image m_Image; public Image Image
{
get { return m_Image; }
set { m_Image = value; }
} public Form3()
{
InitializeComponent();
this.DoubleBuffered = true;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (this.m_Image != null)
{
e.Graphics.DrawImage(this.m_ImagePoint.X, this.m_ImagePoint.Y, this.m_Image.Width, this.m_Image.Height);
}
}
}
{
base.OnPaint(e);
if (this.m_Image != null)
{
e.Graphics.DrawImage(this.m_Image, this.m_ImagePoint.X, this.m_ImagePoint.Y, this.m_Image.Width, this.m_Image.Height);
}
}