By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,104 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

Drawing a simple pixel to the foreground

P: n/a
Hello,

I want to draw a simple pixel (i.e. a red pixel in the center of the
screen), which is always in the foreground - even when running a fullscreen
application like a DirectX game.

I need this as an easy entry for programming later a HUD, which shows
several informations, like date, time, company logo, etc.

Any help or just a simple code example would be appreciated.

Thank you.

Carsten
Oct 23 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
If your dx scene is attached and rendered to the winform, you will need to
use a panel wih transparency, place that over the form and then draw using
the Graphics object in gdi of the panel.

However off the top of my head i cannot remeber if a transparent panel ends
up showing the forms background rather than the dxscene through it. i know i
had issues with a dx scene going through a winform control.

Placing controls and so forth that dont require transparency over the
dxscene is easy tho. Use them as usual. So if your buttons are simple shapes
you'll have no issues.

Why are you not making your interface in dx?

D
"Carsten Schmitt" <cs*******@gmx.netwrote in message
news:kv*****************************@40tude.net...
Hello,

I want to draw a simple pixel (i.e. a red pixel in the center of the
screen), which is always in the foreground - even when running a
fullscreen
application like a DirectX game.

I need this as an easy entry for programming later a HUD, which shows
several informations, like date, time, company logo, etc.

Any help or just a simple code example would be appreciated.

Thank you.

Carsten


Oct 23 '06 #2

P: n/a
Daniel, thank you. I have no experience programming dx. I'm only searching
for a simple way, placing a red pixel in the foreground of the screen. That
should be easy for me to understand for my further learning. That I want to
create (later, when I have the knowledge) a HUD should be uninteressting at
this point.

Carsten
Oct 23 '06 #3

P: n/a
Ah i see.

Ok well for very basic graphics requirements, use GDI, its very simple.
Their are good tutorials on the web, its how all forms are drawn. You can do
things such as overriding the pain fucntion of controls to make them look
how you want and so on by accessing the Graphics object.

OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics; //access graphics object in a control
}

That shoul dget you started. When you draw onto the graphics object that is
what appears on the screen. There is a lot of scope to this so tutorials and
practice is best.

For directx search for chads tutorials Cunit i believe its called. Quite a
good starting tutorial for dx, but it does teach you how to make his
framework and then use that which i found a little restricting. But basic
rendering is covered.

Hope that doesn't all scare you too much.

D

"Carsten" <cs*******@gmx.netwrote in message
news:1d****************************@40tude.net...
Daniel, thank you. I have no experience programming dx. I'm only searching
for a simple way, placing a red pixel in the foreground of the screen.
That
should be easy for me to understand for my further learning. That I want
to
create (later, when I have the knowledge) a HUD should be uninteressting
at
this point.

Carsten

Oct 23 '06 #4

P: n/a
Because you think it _should_ be simple doesn't mean it is.

To do this you will neeed to create a shaped form or a toplevel window using
the LayeredWindow API. This can be set to be always on top and click events
in the window, red dot, other icon etc, will be directed to your code.

You can change this window out for the read HUD or draw on the window
directly to change it's shape. This will work with the LayeredWindow API's
and a per-pixel alpha window but not so well on the simple shaped form using
a region.
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Carsten Schmitt" <cs*******@gmx.netwrote in message
news:kv*****************************@40tude.net...
Hello,

I want to draw a simple pixel (i.e. a red pixel in the center of the
screen), which is always in the foreground - even when running a
fullscreen
application like a DirectX game.

I need this as an easy entry for programming later a HUD, which shows
several informations, like date, time, company logo, etc.

Any help or just a simple code example would be appreciated.

Thank you.

Carsten


Oct 24 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.