默认是横的进度。如何改成向上的进度?请指教
解决方案 »
- 【速度结贴!!!】有关窗体控件的奇怪问题
- 谁用过compact Framwork的,给一个思路
- 高手帮忙看看Delphi代码转C#代码问题
- 存储过程中数据表的名字是变量
- 在CommandText中如何写模糊查询语句呢
- XML数据导入接口(万分火急~~请教高手)
- 如何实现c#拖拽文件到控件时得到文件路径
- 请问高手:怎样实现窗体内的上下两部分进行拖动?
- 被杀,SONAR.Heuristic.113 啊~~~~
- ListView在Scroll时触发了什么事件?ListViewItem的高度怎么设置?
- [IE编程]pasteHTML问题
- C# 如何在一个窗口中调用另外一个窗体的InitializeComponent方法?
http://msdn.microsoft.com/zh-cn/library/system.windows.forms.progressbar(VS.80).aspx
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;namespace test
{
public partial class UpPro : UserControl
{
private int _Value;
private Image b;
public int Width { get; set; }
public int Height { get; set; }
public int MaxValue { get; set; }
public int Value
{
get {
return _Value;
}
set {
this._Value = value;
SetValue();
}
}
public UpPro()
{
InitializeComponent();
}
public UpPro(int width, int height)
: this()
{
this.Width = width;
this.Height = height;
} private void UpPro_Load(object sender, EventArgs e)
{
this.Size = new Size { Width = this.Width, Height = this.Height };
b = new Bitmap(this.Width, this.Height, PixelFormat.Format24bppRgb);
// 将PictureBox Dock设为Fill以自适应宽高
Bar.Dock = DockStyle.Fill;
} private void SetValue()
{
int BarHeight = 进度条进度部分高度 根据_Value和MaxValue按比例计算;
int BarWidth = 进度条进度部分宽度 想显示的高度;
using (Graphics g = Graphics.FromImage(b))
{
// 绘制进度条
g.FillRectangle( new SolidBrush(Color.Black), x坐标,y坐标,宽度,高度 );
// 将图象写入PictureBox
Bar.Image = b;
}
}
}
}//调用
UpPro up = new UpPro(40,100);
up.MaxValue = 100;
up.Value = 50;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;namespace Toncent.Control
{
/// <summary>
/// 垂直进度条
/// </summary>
public class ProgressBarVertical : ProgressBar
{
const int PBS_VERTICAL = 4; protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.Style |= PBS_VERTICAL;
return cp;
}
}
} }
声明:非原创,非常对不起原作者,没有记录原作者相关信息
在此顺便向原作者至敬。
不用搬显示器也能转,大家试试这种方法:桌面 --> 右键菜单 --> 图形选项 --> 旋转 --> 90度
{
const int PBS_VERTICAL = 4;
//重载 CreateParams 属性
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.Style |= PBS_VERTICAL;
return cp;
}
}
}
我晕~~
要不用第三方控件,要不自己做个自定义控件,要不把脸横过来看屏幕!
楼主可以看看!