Click here to Skip to main content
16,006,373 members
Home / Discussions / C#
   

C#

 
AnswerRe: object to intialize and some function call question Pin
Luc Pattyn20-Dec-11 10:19
sitebuilderLuc Pattyn20-Dec-11 10:19 
GeneralRe: object to intialize and some function call question Pin
Blubbo21-Dec-11 2:30
Blubbo21-Dec-11 2:30 
AnswerRe: object to intialize and some function call question Pin
Luc Pattyn21-Dec-11 2:55
sitebuilderLuc Pattyn21-Dec-11 2:55 
AnswerRe: object to intialize and some function call question Pin
RobCroll20-Dec-11 10:30
RobCroll20-Dec-11 10:30 
GeneralRe: object to intialize and some function call question Pin
Blubbo21-Dec-11 2:12
Blubbo21-Dec-11 2:12 
AnswerRe: object to intialize and some function call question Pin
SilimSayo20-Dec-11 15:06
SilimSayo20-Dec-11 15:06 
AnswerRe: object to intialize and some function call question Pin
BillWoodruff21-Dec-11 18:21
professionalBillWoodruff21-Dec-11 18:21 
QuestionProblem withhalo effect using .MakeTransparent and .AntiAlias in GDI+ C# Pin
jerute20-Dec-11 7:01
jerute20-Dec-11 7:01 
I have a user drawn form with rounded corners. I have set the .TransparencyKey of the form to the background color but when I set the SmoothingMode to .AntiAlias I get a halo effect on the corners when the form is displayed against a light background, as the background color is black. If I change the background color to SystemColors.Control I get the halo when the form is displayed against my dark desktop.

Is there a quick fix to this problem or do I have to (painfully) sample all of the colours used in the anti-alias effect and make them all transparent (if this is indeed possible) to get rid of this halo?

C#
protected override void OnPaint(PaintEventArgs e)
{
	Graphics gr = e.Graphics;
	LinearGradientBrush GrBrush;
	GraphicsPath gPath;
	int w;
	int h;

	w = this.Width;
	h = this.Height;
	gr.SmoothingMode = SmoothingMode.HighQuality;

	GrBrush = new LinearGradientBrush(new Point(0, 0), new Point(0, 75), Color.FromArgb(255, 51, 51, 51), Color.FromArgb(255, 0, 0, 0));
	gPath = new GraphicsPath();
	gPath.AddArc(new Rectangle(0, 0, 15, 15), 180, 90);
	gPath.AddArc(new Rectangle(w-16, 0, 15, 15), 270, 90);
	gPath.AddLine(new Point(w-1, 75), new Point(0, 75));
	gPath.CloseAllFigures();
	gr.FillPath(GrBrush, gPath);
	gr.DrawPath(new Pen(GrBrush), gPath);

	GrBrush = new LinearGradientBrush(new Point(0, 14), new Point(0, h-1), Color.FromArgb(255, 1, 1, 1), Color.FromArgb(255, 0, 0, 80));
	gPath = new GraphicsPath();
	gPath.AddArc(new Rectangle(-10, 15, 400, 50), 180, 45);
	gPath.AddLine(new Point(w-1, 15), new Point(w-1, 75));
	gPath.AddArc(new Rectangle(w-16, h-21, 15, 15), 0, 90);
	gPath.AddArc(new Rectangle(0, h-21, 15, 15), 90, 90);
	gPath.CloseAllFigures();
	gr.FillPath(GrBrush, gPath);
	gr.DrawPath(new Pen(GrBrush), gPath);

	GrBrush = new LinearGradientBrush(new Point(5, 80), new Point(5, h-6), Color.FromArgb(255, 245, 245, 255), Color.FromArgb(255, 150, 150, 160));
	gPath = new GraphicsPath();
	gPath.StartFigure();
	gPath.AddArc(new Rectangle(5, 80, 10, 10), 180, 90);
	gPath.AddArc(new Rectangle(w-16, 80, 10, 10), 270, 90);
	gPath.AddArc(new Rectangle(w-16, h-21, 10, 10), 0, 90);
	gPath.AddArc(new Rectangle(5, h-21, 10, 10), 90, 90);
	gPath.CloseAllFigures();
	gr.FillPath(GrBrush, gPath);
	gr.DrawPath(new Pen(GrBrush), gPath);
}


Any help would be appreciated. Thx.
QuestionMarshalDirectiveException Pin
korrea8020-Dec-11 4:13
korrea8020-Dec-11 4:13 
AnswerRe: MarshalDirectiveException Pin
Richard Andrew x6420-Dec-11 6:39
professionalRichard Andrew x6420-Dec-11 6:39 
GeneralRe: MarshalDirectiveException Pin
korrea8021-Dec-11 0:48
korrea8021-Dec-11 0:48 
QuestionXML Serialization Pin
rk288120-Dec-11 2:42
rk288120-Dec-11 2:42 
AnswerRe: XML Serialization Pin
Subin Mavunkal20-Dec-11 4:39
Subin Mavunkal20-Dec-11 4:39 
GeneralRe: XML Serialization Pin
rk288120-Dec-11 19:35
rk288120-Dec-11 19:35 
AnswerRe: XML Serialization Pin
Eddy Vluggen20-Dec-11 6:30
professionalEddy Vluggen20-Dec-11 6:30 
AnswerRe: XML Serialization Pin
SledgeHammer0120-Dec-11 6:37
SledgeHammer0120-Dec-11 6:37 
GeneralRe: XML Serialization Pin
rk288120-Dec-11 19:54
rk288120-Dec-11 19:54 
QuestionDatagridView Adds Extra Empty Row Pin
AmbiguousName20-Dec-11 1:07
AmbiguousName20-Dec-11 1:07 
AnswerRe: DatagridView Adds Extra Empty Row Pin
PIEBALDconsult20-Dec-11 4:27
mvePIEBALDconsult20-Dec-11 4:27 
Questionapp working in window Xp but not in window 7 Pin
Hum Dum19-Dec-11 22:44
Hum Dum19-Dec-11 22:44 
AnswerRe: app working in window Xp but not in window 7 Pin
OriginalGriff19-Dec-11 23:03
mveOriginalGriff19-Dec-11 23:03 
GeneralRe: app working in window Xp but not in window 7 Pin
Hum Dum19-Dec-11 23:37
Hum Dum19-Dec-11 23:37 
AnswerRe: app working in window Xp but not in window 7 Pin
Luc Pattyn20-Dec-11 7:03
sitebuilderLuc Pattyn20-Dec-11 7:03 
GeneralRe: app working in window Xp but not in window 7 Pin
Hum Dum8-Jan-12 22:43
Hum Dum8-Jan-12 22:43 
AnswerRe: app working in window Xp but not in window 7 Pin
Luc Pattyn9-Jan-12 5:17
sitebuilderLuc Pattyn9-Jan-12 5:17 

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.