473,800 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(thi s.Handle, bm.GetHbitmap( ), bm.Width, bm.Height);
Apr 1 '08 #1
2 1733
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...@nn owslpianmk.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
2647
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 with a Bitmap the results are Black. Can you somehow Clip the Grafic and Paste it into the Bitmap ? Mark Johnson, Berlin Germany mj10777@mj10777.de
2
3707
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 Bitmap(Width,Height,PixelFormat.Format24bppRgb); i have a bitmapdata class and then lock the bits like this. bitmapData = bitmap.LockBits(bounds, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
5
7379
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 after a while). Can somebody please tell me what I'm doing wrong? Here is a sample: Public Shared Function CreateBitmapFromArray( _ ByVal width As Integer, _ ByVal height As Integer, _ ByVal pixelFormat As Drawing.Imaging.PixelFormat, _
4
10606
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 As Bitmap Dim bitmapbytestream() As Byte Dim b2() As Byte Dim ms As New MemoryStream()
3
8641
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
2027
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 control graphics object in the paint event. Any help would be appreciated. Here is my code: public class as mycontrol Private Declare Auto Function BitBlt Lib "GDI32.DLL" (ByVal hdcDest As IntPtr, ByVal nxDest As Integer, ByVal nyDest As...
8
3331
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 froggraphic As Graphics = Graphics.FromImage(frogbitmap) froggraphic.RotateTransform(90) frogbitmap.Save(Server.MapPath("images/frog2.gif"), Imaging.ImageFormat.Gif)
15
1854
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
2617
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
4049
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
9690
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
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
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
10275
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9085
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
7576
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
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2945
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.