473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

bitmap is the wrong color

using SetPixel to set all the pixels of a bitmap to Color.Red.
Problem is the bitmap displays as Color.Turqoise.

if all the pixels of the bitmap are Red, why does it not display as
Red?

thanks,

Bitmap bm = new Bitmap(5, 12 );

// set the bitmap pixels to color.Red
for (int x = 0; x < bm.Width; x++)
{
for (int y = 0; y < bm.Height; y++)
{
bm.SetPixel(x, y, Color.Red);
}
}

CreateCaret(this.Handle, bm.GetHbitmap( ), bm.Width, bm.Height);
Apr 1 '08 #1
2 1713
On Tue, 01 Apr 2008 12:36:40 -0700, Steve Richter
<St************@gmail.comwrote:
using SetPixel to set all the pixels of a bitmap to Color.Red.
Problem is the bitmap displays as Color.Turqoise.

if all the pixels of the bitmap are Red, why does it not display as
Red?
What happens if you try to just display the Bitmap instance conventionally?

I suspect that the caret implementation is using some transformation (XOR,
NOT, etc.) to ensure that it's visible over whatever content is in the
window where you're showing the caret. It's unlikely to have anything to
do with how you're creating the Bitmap instance, but rather how you're
using it.

Given that your usage of the bitmap has nothing to do with C# or .NET per
se, I think your question is likely to get a better answer if you ask in a
newsgroup specific to unmanaged Windows programming.

Pete
Apr 1 '08 #2
On Apr 1, 3:41*pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Tue, 01 Apr 2008 12:36:40 -0700, Steve Richter *

<StephenRich...@gmail.comwrote:
using SetPixel to set all the pixels of a bitmap to Color.Red.
Problem is the bitmap displays as Color.Turqoise.
if all the pixels of the bitmap are Red, why does it not display as
Red?

What happens if you try to just display the Bitmap instance conventionally?
it is red! problem solved.
>
I suspect that the caret implementation is using some transformation (XOR,*
NOT, etc.) to ensure that it's visible over whatever content is in the *
window where you're showing the caret. *It's unlikely to have anything to *
do with how you're creating the Bitmap instance, but rather how you're *
using it.

Given that your usage of the bitmap has nothing to do with C# or .NET per *
se, I think your question is likely to get a better answer if you ask in a*
newsgroup specific to unmanaged Windows programming.
will do, thanks.
Apr 1 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mark Johnson | last post by:
How can you save all or a portion of the Grafics object to a Image/Bitmap ? I am try to save the Images from Cards.dll to a BitMap file. I can read in the Images to the Grafics, but when I try this...
2
by: James Dean | last post by:
I create a bitmap like this. The width and height are got from the compressed file i am reading. The width and height are in pixels.....1bpp bitmap = new...
5
by: Lance | last post by:
I need to create a Drawing.Bitmap from an array of integer values. My current technique creates a bitmap that eventually becomes corrupt (i.e., the bitmap's pixels change to a different color...
4
by: vbdotnetmania | last post by:
I have the following snippet of code with bm being a succesfully stored bitmap (not including all the code just the relevant bits) Dim g As Graphics Dim g2 As Graphics Dim bm As Bitmap Dim bm2...
3
by: CSH | last post by:
Hi all, I've run into a small problem opening and saving bitmaps. Concider the following code: Dim oBM as Bitmap Dim cFileName as String ... some code to get the filename etc...
7
by: Dennis | last post by:
I am trying to implement drawing on a bitmap and using bitblt to transfer it to the control graphics object in the paint event. It seems to draw on the bitmap ok but doesn't get transferred to the...
8
by: Nathan Sokalski | last post by:
I am trying to write code to rotate a graphic that I have. Here is the code I am currently using: Dim frogbitmap As New Bitmap(Drawing.Image.FromFile(Server.MapPath("images/frog.gif"))) Dim...
15
by: Hamed | last post by:
Have I posted the message to wrong newsgroup? Or Does the question is so much strage? Would someone please kindly direct me to a true newsgroup or resource? Best Regards Hamed
0
by: news.microsoft.com | last post by:
Hi guys, This text looks long and complicate but it is not, and I really really need some help here. For the last 24hs I'm trying to resolve this issue (last night I dreamed
12
by: Lee | last post by:
I have the following code using System; using System.Windows.Forms; using System.Drawing; using System.Collections; namespace FINN {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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
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...

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.