ProgressBar显示滚动的文字的问题?
ProgressBar显示滚动的文字的问题?最好有代码。我怎么实验都不行呀,郁闷呀。
谢谢啦
------解决方案--------------------什么滚动的文字??百分比的跳动么?
------解决方案--------------------ProcessBar不能重写,只能自己写个控件来实现
------解决方案--------------------参考
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace GameProcessBar
{
public partial class GameProcessBar : UserControl
{
public GameProcessBar()
{
InitializeComponent();
}
int min = 0;
int max = 100;
int val = 0;
Image im;
protected override void OnResize(EventArgs e)
{
this.Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
if (im == null)
im = BackImage.BackgroundImage;
this.BackgroundImage = im;
SolidBrush myBrush = new SolidBrush(Color.GhostWhite);
Graphics g = e.Graphics;
float percent = (float)(val - min) / (max - min);
Rectangle rect = this.ClientRectangle;
rect.Width = (int)((float)rect.Width * percent);
//g.DrawImage(im,rect,rect,GraphicsUnit.Pixel);
g.FillRectangle(myBrush, rect);
//int mini = (max - val) / 60;
//int sec = (max - val) % 60;
//string text = string.Format( "{0} 分 {1} 秒 ", mini, sec);
//Font font = new System.Drawing.Font( "宋体 ", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
//g.DrawString(text, font, Brushes.Black, 140, 5);
Draw3DBorder(g);
myBrush.Dispose();
g.Dispose();
}
public int Minimum
{
get
{
return min;
}
set
{
if (value < 0)
{
min = 0;
}
if (value > max)
{
max = value;
}
min = value;
if (val < min)
{
val = min;
}
this.Invalidate();
}
}
public int Maximum
{
get
{
return max;
}
set
{
if (value < min)
{
min = value;
}
max = value;
if (val > max)
{
val = max;
}
this.Invalidate();
}
}
public int Value
{
get
{
return val;
}
set
{
int oldVal = val;
if (val < min)
{
val = min;
}