Click here to Skip to main content
15,903,362 members
Home / Discussions / C#
   

C#

 
AnswerRe: google search engine api using c# Pin
Aman Bhullar22-Sep-09 3:22
Aman Bhullar22-Sep-09 3:22 
QuestionBind txt Box to database [modified] Pin
Manish7922-Sep-09 2:12
Manish7922-Sep-09 2:12 
AnswerRe: Bind txt Box to database Pin
Henry Minute22-Sep-09 2:26
Henry Minute22-Sep-09 2:26 
GeneralRe: Bind txt Box to database Pin
Manish7922-Sep-09 2:50
Manish7922-Sep-09 2:50 
GeneralRe: Bind txt Box to database Pin
Programm3r22-Sep-09 3:00
Programm3r22-Sep-09 3:00 
GeneralRe: Bind txt Box to database Pin
Manish7922-Sep-09 3:14
Manish7922-Sep-09 3:14 
GeneralRe: Bind txt Box to database Pin
Programm3r22-Sep-09 3:19
Programm3r22-Sep-09 3:19 
GeneralRe: Bind txt Box to database Pin
Keith Barrow22-Sep-09 3:16
professionalKeith Barrow22-Sep-09 3:16 
GeneralRe: Bind txt Box to database Pin
Manish7922-Sep-09 3:23
Manish7922-Sep-09 3:23 
GeneralRe: Bind txt Box to database Pin
Programm3r22-Sep-09 3:31
Programm3r22-Sep-09 3:31 
GeneralRe: Bind txt Box to database Pin
OriginalGriff22-Sep-09 3:32
mveOriginalGriff22-Sep-09 3:32 
GeneralRe: Bind txt Box to database Pin
Manish7922-Sep-09 3:46
Manish7922-Sep-09 3:46 
GeneralRe: Bind txt Box to database Pin
Keith Barrow22-Sep-09 3:50
professionalKeith Barrow22-Sep-09 3:50 
GeneralRe: Bind txt Box to database Pin
OriginalGriff22-Sep-09 3:56
mveOriginalGriff22-Sep-09 3:56 
AnswerRe: Bind txt Box to database Pin
Robert_Pan22-Sep-09 4:13
Robert_Pan22-Sep-09 4:13 
QuestionCustom progressbar doesn't update Pin
teknolog12322-Sep-09 1:56
teknolog12322-Sep-09 1:56 
QuestionRe: Custom progressbar doesn't update Pin
Programm3r22-Sep-09 3:21
Programm3r22-Sep-09 3:21 
AnswerRe: Custom progressbar doesn't update Pin
teknolog12322-Sep-09 4:02
teknolog12322-Sep-09 4:02 
GeneralRe: Custom progressbar doesn't update Pin
Programm3r22-Sep-09 21:21
Programm3r22-Sep-09 21:21 
GeneralRe: Custom progressbar doesn't update Pin
teknolog12323-Sep-09 9:26
teknolog12323-Sep-09 9:26 
QuestionBinary Serialization of Dictionary Pin
FJJCENTU22-Sep-09 1:28
FJJCENTU22-Sep-09 1:28 
AnswerRe: Binary Serialization of Dictionary Pin
Henry Minute22-Sep-09 1:44
Henry Minute22-Sep-09 1:44 
QuestionText over Progressbar - Question Pin
Programm3r22-Sep-09 1:25
Programm3r22-Sep-09 1:25 
AnswerRe: Text over Progressbar - Question Pin
Programm3r22-Sep-09 1:36
Programm3r22-Sep-09 1:36 
AnswerRe: Text over Progressbar - Question Pin
firda-cze18-Apr-10 22:21
firda-cze18-Apr-10 22:21 
public class ProgressLabel: ProgressBar {
	private static StringFormat sfCenter = new StringFormat() {
		Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center };
	private Color textColor = DefaultTextColor;
	private string progressString;
	public ProgressLabel() { SetStyle(ControlStyles.AllPaintingInWmPaint, true); }
	protected override void OnCreateControl() {
		progressString = null;
		base.OnCreateControl();
	}
	protected override void WndProc(ref Message m) {
		switch(m.Msg) {
		case 15: if(HideBar) base.WndProc(ref m);
			else {
				ProgressBarStyle style = Style;
				if(progressString == null) {
					progressString = Text;
					if(!HideBar && style != ProgressBarStyle.Marquee) {
						int range = Maximum-Minimum;
						int value = Value;
						if(range > 42949672) { value = (int)((uint)value>>7); range = (int)((uint)range>>7); }
						if(range > 0) progressString = string.Format(progressString.Length == 0 ? "{0}%" : "{1}: {0}%",
						value*100/range, progressString);
					}
				}
				if(progressString.Length == 0) base.WndProc(ref m);
				else using(Graphics g = CreateGraphics()) {
					base.WndProc(ref m);
					OnPaint(new PaintEventArgs(g, ClientRectangle));
				}
			}
			break;
		case 0x402: goto case 0x406;
		case 0x406: progressString = null;
			base.WndProc(ref m);
			break;
		default:
			base.WndProc(ref m);
			break;
		}
	}
	protected override void OnPaint(PaintEventArgs e) {
		Rectangle cr = ClientRectangle;
		RectangleF crF = new RectangleF(cr.Left, cr.Top, cr.Width, cr.Height);
		using(Brush br = new SolidBrush(TextColor))
			e.Graphics.DrawString(progressString, Font, br, crF, sfCenter);
		base.OnPaint(e);
	}
	public bool HideBar {
		get { return GetStyle(ControlStyles.UserPaint); }
		set { if(HideBar != value) { SetStyle(ControlStyles.UserPaint, value); Refresh(); } }
	}
	public static Color DefaultTextColor {
		get { return SystemColors.ControlText; }
	}
	public Color TextColor {
		get { return textColor; }
		set { textColor = value; }
	}
	public override string Text {
		get { return base.Text; }
		set { if(value != Text) { base.Text = value; progressString = null; } }
	}
	public override Font Font {
		get { return base.Font; }
		set { base.Font = value; }
	}
}

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.