我想做一个winform滚动条,要求只在窗体中间的位置滚动,不超出窗体。希望大家帮帮忙。我自己写了一个。但是它是不是在窗体中间滚动。代码如下;
private void timer2_Tick(object sender, EventArgs e)
{
lblScoll.Left = lblScoll.Left - 5;
if (lblScoll.Left <= -lblScoll.Width )
{
lblScoll.Left = this.Width;
}
}
private void timer2_Tick(object sender, EventArgs e)
{
lblScoll.Left = lblScoll.Left - 5;
if (lblScoll.Left <= -lblScoll.Width )
{
lblScoll.Left = this.Width;
}
}
解决方案 »
- asp.net初学!
- 在WEB应用程序中自定义提供程序的Profile.save()运行不成功?
- 求个时间正则表达式。比如时间是2006/06/27 15:30:36。正确的格式是20060627153036。但是这个表示式怎么写呢?
- (求助)不同的解决方案整合到一起,有没有啥工具呀?
- CS1501: 重载“SqlDataReader”方法未获取“2”参数
- PetShop3.0先从什么地方研究呢?研究过的提提建议!
- 树形数据绑定Dropdrownlist控件
- 求高手赐教???????? 它已经被别的用户以独占方式打开,或没有查看数据的权限
- 各位大虾,急问两个简单的问题,抢分了!
- asp.net中datagrid自动生成表格,怎样给tr加上mousein和mouseout事件?
- 一段C#代码出错??
- 高手来看...存储过程问题..在线等待两天没搞定了.
private void UserPictureBox_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
g.FillRectangle(Brushes.White,this.ClientRectangle);
if (TheImage != null)
{
// Draw the Image Offset by the scroll positions inside the Client Rectangle
g.DrawImageUnscaled(TheImage, -OffsetX, -OffsetY, TheImage.Width, TheImage.Height);
// Draw a little gray rectangle in the portion of the control where the two scrollbars touch
g.FillRectangle(Brushes.Gray, ClientRectangle.Width - vScrollBar1.Width,
ClientRectangle.Height - hScrollBar1.Height, vScrollBar1.Width, hScrollBar1.Height);
}
}