Anyone with GDI+ .Net Experience

Associate
Joined
1 Feb 2006
Posts
1,868
Location
Reading
Hoping someone can point me in the right direction.

I want to create my own control that functions similarly to a progress bar with text overlaid, with control over the background color and the bar itself.

Hence my question, i want to create a rectangle with a subtle vertical central gradient (e.g. dark to light to dark going vertically).

Anyone that can start me off with the required objects and a code snippit?

Typically I'm one for reading documentation an learning myself but time is short atm and need to get this done!
 
1) Create a custom control
2) Inherit the progress bar
3) OverRide the OnPaint event
4) Within this overridden event, have something like:
[psuedo]
e.Graphics.DrawText(attributes in here, can't remember them attribute per attribute, but it's like font, text, weight, etc)

Sorted! :D
 
1) Create a custom control
2) Inherit the progress bar
3) OverRide the OnPaint event
4) Within this overridden event, have something like:
[psuedo]
e.Graphics.DrawText(attributes in here, can't remember them attribute per attribute, but it's like font, text, weight, etc)

Sorted! :D
Thought about that, but doesn't give me the flexibility i want with controlling back and foreground colours. Thanks though.
Could you reuse the control from here?
Might be easier than rolling your own.

http://www.codeproject.com/KB/miscctrl/exdotnet.aspx

Has potential, doesn't quite fulfill my vision though were the progress bar is subtly two tone like common controls progress bar.
 
^--- agreeing totally.

The OnPaint command is literally overriding what it draws, so by setting public properties like FGColour, BGColour, Shadow, whatever-you-want, etc, you just draw these in the OnPaint event.

It's as flexible as you want it to be because the OnPaint event literally renders the control to the form.
 
Back
Top Bottom