473,705 Members | 5,871 Online
Bytes | Software Development & Data Engineering Community
+ 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 3110
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.n et...
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(PaintEv entArgs 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.ne t...
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.n et...
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
2426
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 into a smaller box (that is only around 10x10 pixel so the original image must be comprimized onto that 10x10 pixel field..) and how to center it. ( if you guess that this is about neural networks you're right :) )
1
5200
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 a byte *. I am aware of that internally GDI+ stores RGB as BGR, therefore i have to manually swap the R and B components of each pixel. Since GDI+ internally stores the components in BGR order, there is'nt a way to copy the entire pixel data...
0
2625
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 image has 4 transparent pixels; the upper left, upper right, lower left & lower right. This is to help give the otherwise square button graphic a slightly rounded look to it.
4
2766
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 first then paint it larger? and how would i make the entire image transparent at 75% transparency (25% opaque) thanks!
5
11312
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 x,y,color, where color is predefined. I need to draw my pixel based on the value in my file. So if I get a value for a blue pixel of 50, how do I make that a darker blue than a value of 100? I know Pset is probably not the best way to do it, but...
4
1658
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 recieves the USB data for six consequtive horizontal pixels (or 6 sound/ECG samples). The routine FixChns handles the scaling of the data and puts it into the PlotAry for presentation. The variable RptCnt then handles the placement for the 6 sets...
11
11266
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
4513
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. http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/59ed00adf5eef2d0/444f363036fc64f2?hl=en&lnk=gst&q=paint+a+pixel#444f363036fc64f2 But now the question is: has anybody ever done a 'scaling problem' for a grid where you are 'zooming...
2
8757
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 file, but I have been unable to get any of the overloads to work in VB.NET. I would like to store the *.ico files in a *.resx file so that users do not need anything other than the *.dll, but at the moment I am just trying to get any of the overloads...
0
8768
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9274
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7895
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6606
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5933
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2083
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.