Click here to Skip to main content
15,904,339 members
Home / Discussions / C#
   

C#

 
GeneralRe: conditional operator (?:) performance Pin
Daniel Turini26-Apr-04 11:21
Daniel Turini26-Apr-04 11:21 
GeneralRe: conditional operator (?:) performance Pin
Mike Dimmick26-Apr-04 23:53
Mike Dimmick26-Apr-04 23:53 
GeneralRe: conditional operator (?:) performance Pin
Anonymous27-Apr-04 2:49
Anonymous27-Apr-04 2:49 
GeneralDataGrid row: RowState unchange problem Pin
Chris#26-Apr-04 10:47
Chris#26-Apr-04 10:47 
GeneralRe: DataGrid row: RowState unchange problem Pin
Heath Stewart26-Apr-04 11:50
protectorHeath Stewart26-Apr-04 11:50 
GeneralRe: DataGrid row: RowState unchange problem Pin
Chris#27-Apr-04 4:49
Chris#27-Apr-04 4:49 
GeneralGarbage collector Pin
Ruchi Gupta26-Apr-04 10:39
Ruchi Gupta26-Apr-04 10:39 
GeneralRe: Garbage collector Pin
SJ_Phoenix26-Apr-04 19:16
SJ_Phoenix26-Apr-04 19:16 
GeneralRe: Garbage collector Pin
Stefan Troschuetz26-Apr-04 20:40
Stefan Troschuetz26-Apr-04 20:40 
GeneralRe: Garbage collector Pin
Mike Dimmick27-Apr-04 0:04
Mike Dimmick27-Apr-04 0:04 
GeneralRe: Garbage collector Pin
Stefan Troschuetz27-Apr-04 0:28
Stefan Troschuetz27-Apr-04 0:28 
GeneralDockable main Program Pin
camasmartin26-Apr-04 10:35
camasmartin26-Apr-04 10:35 
GeneralRe: Dockable main Program Pin
surgeproof26-Apr-04 11:18
surgeproof26-Apr-04 11:18 
GeneralSystem.Web.Services.Protocols.SoapException Pin
Code Toad26-Apr-04 9:46
Code Toad26-Apr-04 9:46 
GeneralRe: System.Web.Services.Protocols.SoapException Pin
Heath Stewart26-Apr-04 10:11
protectorHeath Stewart26-Apr-04 10:11 
GeneralRe: System.Web.Services.Protocols.SoapException Pin
Code Toad27-Apr-04 3:58
Code Toad27-Apr-04 3:58 
GeneralCustomizing Controls in c# - Help Pin
stan2826-Apr-04 9:01
stan2826-Apr-04 9:01 
GeneralRe: Customizing Controls in c# - Help Pin
Heath Stewart26-Apr-04 9:28
protectorHeath Stewart26-Apr-04 9:28 
GeneralRe: Customizing Controls in c# - Help Pin
stan2827-Apr-04 3:26
stan2827-Apr-04 3:26 
GeneralRe: Customizing Controls in c# - Help Pin
Heath Stewart27-Apr-04 3:41
protectorHeath Stewart27-Apr-04 3:41 
GeneralSending POST HTTP request truncates the last character Pin
Le centriste26-Apr-04 8:15
Le centriste26-Apr-04 8:15 
GeneralRe: Sending POST HTTP request truncates the last character Pin
Heath Stewart26-Apr-04 8:54
protectorHeath Stewart26-Apr-04 8:54 
GeneralGDI+ OnPaint Pin
mookeroo26-Apr-04 5:54
mookeroo26-Apr-04 5:54 
I have been coding a media player for a school project with GDI+ and C#. My app displays alot of bitmaps to change the colors of the player (eye candy). If I have another app window open (ex. Calculator) on top of my player and I move the calculator around, my player window draws really slow and the remnants of the calculator window are displayed over the bitmaps for a short period before a complete refresh. My mem usage for the player is always around 30M - 50M which seems like alot to me for an app that can only change skin textures. My OnPaint creates a bitmap to draw to before refreshing the screen.

protected override void OnPaint(PaintEventArgs e)<br />
		{<br />
			Image screen = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);<br />
			Graphics graphics = e.Graphics;<br />
			Graphics temp = Graphics.FromImage(screen);<br />
<br />
			GraphicsPath texturePath = new GraphicsPath(new Point[] {new Point(30, 50),		//start point<br />
																	   new Point(30, 50),<br />
																	   new Point(30, 30),<br />
																	   new Point(50, 30),<br />
																	   new Point((this.Right - this.Left) - 20, 30), <br />
																	   new Point((this.Right - this.Left) - 20, 30),<br />
																	   new Point(this.Right - this.Left, 30),<br />
																	   new Point(this.Right - this.Left, 50),<br />
																	   new Point(this.Right - this.Left, (this.Bottom - this.Top) - 20),<br />
																	   new Point(this.Right - this.Left, this.Bottom - this.Top - 20),<br />
																	   new Point(this.Right - this.Left, this.Bottom - this.Top),<br />
																	   new Point((this.Right - this.Left) - 20, this.Bottom - this.Top),<br />
																	   new Point(50, this.Bottom - this.Top),<br />
																	   new Point(50, this.Bottom - this.Top),<br />
																	   new Point(30, this.Bottom - this.Top),<br />
																	   new Point(30, (this.Bottom - this.Top) - 20),<br />
																	   new Point(30, 50)},<br />
																	new byte[] {(byte)PathPointType.Start, <br />
																	(byte)PathPointType.Bezier,<br />
																	(byte)PathPointType.Bezier,<br />
																	(byte)PathPointType.Bezier, <br />
																	(byte)PathPointType.Line,<br />
																	(byte)PathPointType.Bezier,<br />
																	(byte)PathPointType.Bezier,<br />
																	(byte)PathPointType.Bezier,<br />
																	(byte)PathPointType.Line,<br />
																	(byte)PathPointType.Bezier,<br />
																	(byte)PathPointType.Bezier,<br />
																	(byte)PathPointType.Bezier, <br />
																	(byte)PathPointType.Line, <br />
																	(byte)PathPointType.Bezier,<br />
																	(byte)PathPointType.Bezier,<br />
																	(byte)PathPointType.Bezier,<br />
																	(byte)PathPointType.Line});		//finish back at start<br />
<br />
			GraphicsPath navButtonsPath = new GraphicsPath(new Point[] {new Point(this.panel1.Left, this.panel1.Top),<br />
																		   new Point(60, this.panel1.Top),<br />
																		   new Point(60, this.panel1.Top),<br />
																		   new Point(50, this.panel1.Top),<br />
																		   new Point(50, this.panel1.Top + 10),<br />
																		   new Point(50, this.panel1.Top + 90),<br />
																		   new Point(50, this.panel1.Top + 90),<br />
																		   new Point(50, this.panel1.Top + 100),<br />
																		   new Point(60, this.panel1.Top + 100),<br />
																		   new Point(this.panel1.Left, this.panel1.Top + 100),<br />
																		new Point(this.panel1.Left, this.panel1.Top + 110),<br />
																		new Point(60, this.panel1.Top + 110),<br />
																		new Point(60, this.panel1.Top + 110),<br />
																		new Point(50, this.panel1.Top + 110),<br />
																		new Point(50, this.panel1.Top + 120),<br />
																		new Point(50, this.panel1.Top + 200),<br />
																		new Point(50, this.panel1.Top + 200),<br />
																		new Point(50, this.panel1.Top + 210),<br />
																		new Point(60, this.panel1.Top + 210),<br />
																		new Point(this.panel1.Left, this.panel1.Top + 210)},<br />
															new byte[] {(byte)PathPointType.Start,<br />
																		   (byte)PathPointType.Line,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Line,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Line,<br />
																		   (byte)PathPointType.Line,<br />
																		   (byte)PathPointType.Line,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Line,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Bezier,<br />
																		   (byte)PathPointType.Line});<br />
<br />
			Brush tBrush = new TextureBrush(background);<br />
<br />
			temp.FillRectangle(new LinearGradientBrush(<br />
				new Point(0, 0), new Point(this.Right - this.Left, 0), Color.SlateGray, Color.WhiteSmoke), this.ClientRectangle);<br />
<br />
			temp.FillPath(tBrush, texturePath);<br />
			temp.DrawPath(new Pen(<br />
				new LinearGradientBrush(<br />
				new Point(30, 30), new Point(this.Right - this.Left, this.Bottom - this.Top), Color.WhiteSmoke, Color.SlateGray), 3.5F), texturePath);<br />
			temp.FillPath(new LinearGradientBrush(<br />
				new Point(50, this.panel1.Top), new Point(this.panel1.Left, this.panel1.Top), Color.WhiteSmoke, Color.CadetBlue), navButtonsPath);<br />
			temp.DrawPath(Pens.Black, navButtonsPath);<br />
<br />
			graphics.DrawImage(screen, ClientRectangle);<br />
<br />
			temp.Dispose();<br />
			navButtonsPath.Dispose();<br />
			texturePath.Dispose();<br />
			screen.Dispose();<br />
		}


any help on resolving these issues is appreciated.
GeneralRe: GDI+ OnPaint Pin
Heath Stewart26-Apr-04 6:10
protectorHeath Stewart26-Apr-04 6:10 
GeneralRe: GDI+ OnPaint Pin
mookeroo27-Apr-04 0:52
mookeroo27-Apr-04 0:52 

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.