Click here to Skip to main content
15,890,512 members
Home / Discussions / C#
   

C#

 
AnswerRe: Dynamic Instantiation of Classes. Pin
Guffa10-Aug-08 6:35
Guffa10-Aug-08 6:35 
AnswerRe: Dynamic Instantiation of Classes. Pin
PIEBALDconsult10-Aug-08 7:03
mvePIEBALDconsult10-Aug-08 7:03 
QuestionGraphics.DrawImage Problem Pin
#realJSOP10-Aug-08 4:57
mve#realJSOP10-Aug-08 4:57 
AnswerRe: Graphics.DrawImage Problem Pin
Guffa10-Aug-08 5:21
Guffa10-Aug-08 5:21 
GeneralRe: Graphics.DrawImage Problem Pin
#realJSOP10-Aug-08 5:39
mve#realJSOP10-Aug-08 5:39 
GeneralRe: Graphics.DrawImage Problem Pin
Guffa10-Aug-08 6:37
Guffa10-Aug-08 6:37 
GeneralRe: Graphics.DrawImage Problem Pin
#realJSOP10-Aug-08 23:25
mve#realJSOP10-Aug-08 23:25 
AnswerRe: Graphics.DrawImage Problem Pin
User 665810-Aug-08 5:46
User 665810-Aug-08 5:46 
John Simmons / outlaw programmer wrote:
0) The indicated call to m_graphics.DrawImage() won't compile, despite my using what intellisense claims is a valid overload.


It's Point[], not Point for the second parameter.
So new Point[] { new Point(m_X, m_Y) } should do the trick.

John Simmons / outlaw programmer wrote:
1) The for loop determines the new alpha channel value. The nature of float values causes the alpha value to eventually become some bizarre value (usually by the 7th iteration), which forces me to only do the loop while it's less than 1.0, and then perform the final DrawImage() call after the loop has exited.


As Guffa said, better use a range like 0-255 (or whatever you wish) and calculate the alpha by n/255.

John Simmons / outlaw programmer wrote:
2) Performance quite frankly sucks. I can see the image redraw itself from top to bottom. Is there a better (more efficient) way to fade an image on/off the screen?


Depending on how many iterations you do per second, that's many pixels that need to be modified.
Can't you put the image onto a PictureBox? You could then use the UpdateLayeredWindow interop to change the alpha of the control, which should be faster than your method.
Or just draw the image once on the form and set the Form.Opacity property in a loop.
Both methods will work only on Windows 2000 and upwards, though.

Of course the fastest method would be to use DirectX pixel shaders, but that'd be definitely overkill for your application.

regards

modified 12-Sep-18 21:01pm.

GeneralRe: Graphics.DrawImage Problem Pin
#realJSOP10-Aug-08 23:29
mve#realJSOP10-Aug-08 23:29 
QuestionThe assembly 'mscorlib.XmlSerializers' failed to load in the 'LoadFrom' Pin
ezazazel10-Aug-08 4:27
ezazazel10-Aug-08 4:27 
QuestionRe: The assembly 'mscorlib.XmlSerializers' failed to load in the 'LoadFrom' Pin
Mark Salsbery10-Aug-08 9:02
Mark Salsbery10-Aug-08 9:02 
AnswerRe: The assembly 'mscorlib.XmlSerializers' failed to load in the 'LoadFrom' Pin
ezazazel10-Aug-08 9:39
ezazazel10-Aug-08 9:39 
QuestionUpdating textbox from class running in another thread Pin
__Leeloo__10-Aug-08 2:51
__Leeloo__10-Aug-08 2:51 
AnswerRe: Updating textbox from class running in another thread Pin
Green Fuze10-Aug-08 5:11
Green Fuze10-Aug-08 5:11 
GeneralRe: Updating textbox from class running in another thread Pin
PIEBALDconsult10-Aug-08 7:18
mvePIEBALDconsult10-Aug-08 7:18 
QuestionHow to Intract with Reporting Services by code ? Pin
hdv21210-Aug-08 0:43
hdv21210-Aug-08 0:43 
AnswerRe: How to Intract with Reporting Services by code ? Pin
Wendelius10-Aug-08 1:01
mentorWendelius10-Aug-08 1:01 
GeneralRe: How to Intract with Reporting Services by code ? Pin
hdv21210-Aug-08 1:06
hdv21210-Aug-08 1:06 
GeneralRe: How to Intract with Reporting Services by code ? Pin
Wendelius10-Aug-08 1:19
mentorWendelius10-Aug-08 1:19 
GeneralRe: How to Intract with Reporting Services by code ? Pin
hdv21210-Aug-08 1:49
hdv21210-Aug-08 1:49 
GeneralRe: How to Intract with Reporting Services by code ? Pin
Wendelius10-Aug-08 2:13
mentorWendelius10-Aug-08 2:13 
GeneralRe: How to Intract with Reporting Services by code ? Pin
hdv21210-Aug-08 2:29
hdv21210-Aug-08 2:29 
GeneralRe: How to Intract with Reporting Services by code ? Pin
Wendelius10-Aug-08 2:48
mentorWendelius10-Aug-08 2:48 
QuestionThreading while sharing a Graphics object Pin
JFord12349-Aug-08 23:25
JFord12349-Aug-08 23:25 
AnswerRe: Threading while sharing a Graphics object Pin
Christian Graus10-Aug-08 0:50
protectorChristian Graus10-Aug-08 0:50 

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.