How would I change the appearance of some controls in the windows form, such as turning the tabs color from the normal color to say a gradient green to white or change the buttons shape and color from a rectangle to a circle and the color from a solid to a gradient. That kind of thing.

Appearance
sdoc
Wow, I appreciate that a lot. Except when I put the first code in button3_Paint, it changed the form's appearance instead of the button's appearance, because of the "this.ClientRectangle" thing. Not to sound like a total noob, but I am new at GDI+ and the whole designing thing, so if you could maybe explain to me about the button class, like what I should put in there, where I should start because I honestly don't have a clue what to put in the new class.
fripper
Try this sample
http://www.c-sharpcorner.com/2/gdi_plus.asp
Jabs
jaegd
Tery Emilson
HI sniper,
Sorry for being late is helping you out.I was out of station for a couple of days.
By the example what I meant was just to give an illustration of using garphics path.You have to modify it according as per your need .The sample code posted is for carving the top corners of a big GUI for example a form .The diamter of the arc which is given is in conjuction with that form.So if you application's client rect is very small,that value has to be varied..(obviously it has to be small).
Regarding the this.ClientRectangle;this denotes the class whose edges have to be carved.That means our implementation has to be in the class whose edges has to be carved.For that you can make a button by deriving from System.Windows.Forms.button class an implement the logic inside that.Hopes that this helps you
gooon
cracklestudios
For making a button round,make your own button class deriving from Button,you can then carve the edges to appropriate shape using Graphices path.
Example for carving using graphics path.This example wille be providing the carving at the top left and right corners
Rectangle rect =
this.ClientRectangle;using
(GraphicsPath path = new GraphicsPath ()){
const int diameter = 20;Rectangle arcRect =
new Rectangle (rect.Location, new Size (diameter, diameter));path.AddArc (arcRect, 180, 90);
arcRect.X = rect.Right - diameter;
path.AddArc (arcRect, 270, 90);
arcRect.X = rect.Right- diameter;
arcRect.Y = rect.Height - diameter-1;
//One is added to produce the fineness at bottom right cornerpath.AddArc(arcRect,360,90);
arcRect.X = rect.X ;
arcRect.Y = rect.Height - diameter;
path.AddArc(arcRect,90,90);
path.CloseFigure ();
Region =
new Region (path);}
You can give little bit of shining effect drawing using colour blendnig.
The following code snippet is a simple example for colour blending
System.Drawing.Drawing2D.ColorBlend clrBlend =
new ColorBlend();Color []clrs = {
this.ForeColor,Color.White,this.ForeColor,this.ForeColor,this.ForeColor}; float []flts = { 0.0f,0.3f,0.6f,0.7f,1.0f } ;clrBlend.Colors = clrs;
clrBlend.Positions = flts;
Brush.InterpolationColors = clrBlend;
g.FillRectangle(Brush,0,0,
this.Width,this.Height);The other approach is to make use of an image of a curved button.You can make the button to have transparent back ground so that the button seems to be a curved one.
tall_matt
Rafael Mores
Tom Lichtenstein
Mainiac007
You will have to handle the Paint event or override the OnPaint method (in the case of subclassing).
You can then use utility methods in the System.Windows.Forms.ControlPaint class to perform drawing and retrieval of colors to match how the currently running version of Windows draws certain aspects of the controls (like DrawBorder() and Dark()).