473,473 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Drawing a simple pixel to the foreground

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
4 3096
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: T. F. | last post by:
Hi, I need to create a box / field that the user can draw into (with some kind of pen). I also need to know how I can edit the size of the pen style and how I can "transport" the drawn image...
1
by: Dennis Myrén | last post by:
Hi. I use System.Drawing.Bitmap to copy bitmap pixel data. I use LockBits to retrieve a BitmapData which in turn provides me with the Scan0 property which i then use to loop the pixel data using...
0
by: eruess | last post by:
Here's the scenario: I've got a whole bunch (for the sake of argument, let's say thousands) of different little 32x14 .png files that act as buttons all over a very large website. Each button...
4
by: Brian Henry | last post by:
I have an icon I want to draw onto the screen, but I want to streatch it out to be about 256x256 and make it about 75% transparent how would I go about this? do i need to convert it to a bitmap...
5
by: Ringo | last post by:
I'm new to C# and want a simple app to display a bitmap that is in bayer format. I searched the group and have an app that can draw pixels in a picturebox using Pset. My problem is that Pset uses...
4
by: Galen Somerville | last post by:
My VB2005 app gets real time Heart sounds and an ECG from a USB device. I'm looking for a way to speed up the drawing of the traces on the screen. In the following code the routine GetSounds...
11
by: dongarbage | last post by:
Hi there, I'm very much a C# novice. How do you do freehand drawing on a panel with a mouse in c#? Thanks, Don
9
by: raylopez99 | last post by:
After refering to the below thread, I take it for C# Forms 2.0, there a way to draw a 1 pixel by 1 pixel rectangle, which I was able to do just now successfully. ...
2
by: Nathan Sokalski | last post by:
I am attempting to create icons for controls I have created using VB.NET by using the System.Drawing.ToolboxBitmap attribute. I have managed to do this in C# by specifying the path to the *.ico...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.