Click here to Skip to main content
15,887,332 members
Home / Discussions / C#
   

C#

 
QuestionThoroughly confused now :) Pin
marksmit11-Jun-09 5:49
marksmit11-Jun-09 5:49 
Question[Message Deleted] Pin
hkjghkj110-Jun-09 8:28
hkjghkj110-Jun-09 8:28 
AnswerRe: parallel sounds Pin
Christian Graus10-Jun-09 8:44
protectorChristian Graus10-Jun-09 8:44 
Questionif statement troubles Pin
partialdata10-Jun-09 6:54
partialdata10-Jun-09 6:54 
GeneralRe: if statement troubles Pin
harold aptroot10-Jun-09 7:14
harold aptroot10-Jun-09 7:14 
GeneralRe: if statement troubles Pin
partialdata10-Jun-09 8:04
partialdata10-Jun-09 8:04 
AnswerRe: if statement troubles Pin
Luc Pattyn10-Jun-09 7:25
sitebuilderLuc Pattyn10-Jun-09 7:25 
GeneralRe: if statement troubles Pin
partialdata10-Jun-09 8:17
partialdata10-Jun-09 8:17 
GeneralRe: if statement troubles Pin
Luc Pattyn10-Jun-09 8:28
sitebuilderLuc Pattyn10-Jun-09 8:28 
GeneralRe: if statement troubles Pin
partialdata10-Jun-09 8:48
partialdata10-Jun-09 8:48 
Questiondeserialization of object and then populating form Pin
ThorTheBraveGod10-Jun-09 6:13
ThorTheBraveGod10-Jun-09 6:13 
AnswerRe: deserialization of object and then populating form Pin
Ennis Ray Lynch, Jr.10-Jun-09 6:31
Ennis Ray Lynch, Jr.10-Jun-09 6:31 
AnswerRe: deserialization of object and then populating form Pin
Henry Minute10-Jun-09 6:35
Henry Minute10-Jun-09 6:35 
GeneralRe: deserialization of object and then populating form Pin
ThorTheBraveGod10-Jun-09 8:06
ThorTheBraveGod10-Jun-09 8:06 
GeneralRe: deserialization of object and then populating form Pin
Henry Minute10-Jun-09 8:48
Henry Minute10-Jun-09 8:48 
RantRe: deserialization of object and then populating form Pin
ThorTheBraveGod10-Jun-09 9:10
ThorTheBraveGod10-Jun-09 9:10 
GeneralRe: deserialization of object and then populating form Pin
Henry Minute10-Jun-09 9:12
Henry Minute10-Jun-09 9:12 
Questionurgent help pleasse [image processing , pointers , byte ] Pin
WinSolution10-Jun-09 6:10
WinSolution10-Jun-09 6:10 
Hi Everyone

please look at following two line this is not working when i execute my prject

int div = Convert.ToInt32(textBox1.Text.Trim());
ptr[0] = ptr[1] = ptr[2] = (byte)((ptr[0] + ptr[1] + ptr[2]) / div);

but if i remove the first line and enter an integer value in place of div variable it works such as following line.

ptr[0] = ptr[1] = ptr[2] = (byte)((ptr[0] + ptr[1] + ptr[2]) / 3);

Following is the full listing may it help you to figurout the problem
a method that convert a bitmap from colored to grayscale
//////////////////////////////////////////////////////////////////////////

public Bitmap GrayScale(Bitmap bmpimg)
{
BitmapData bmpData = bmpimg.LockBits(new Rectangle(0, 0, bmpimg.Width, bmpimg.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
int remain = bmpData.Stride - bmpData.Width * 3;

unsafe
{
byte* ptr = (byte*)bmpData.Scan0;

for (int i = 0; i < bmpData.Height; i++)
{
for (int j = 0; j < bmpData.Width; j++)
{
int div = Convert.ToInt32(textBox1.Text.Trim());
ptr[0] = ptr[1] = ptr[2] = (byte)((ptr[0] + ptr[1] + ptr[2]) / div);

ptr += 3;
}
ptr += remain;
}
}

bmpimg.UnlockBits(bmpData);

return bmpimg;
}
AnswerRe: urgent help pleasse [image processing , pointers , byte ] Pin
Luc Pattyn10-Jun-09 6:29
sitebuilderLuc Pattyn10-Jun-09 6:29 
AnswerRe: urgent help pleasse [image processing , pointers , byte ] Pin
Henry Minute10-Jun-09 6:31
Henry Minute10-Jun-09 6:31 
AnswerRe: urgent help pleasse [image processing , pointers , byte ] Pin
WinSolution10-Jun-09 6:38
WinSolution10-Jun-09 6:38 
GeneralRe: urgent help pleasse [image processing , pointers , byte ] Pin
Luc Pattyn10-Jun-09 7:29
sitebuilderLuc Pattyn10-Jun-09 7:29 
GeneralRe: urgent help pleasse [image processing , pointers , byte ] Pin
Christian Graus10-Jun-09 8:46
protectorChristian Graus10-Jun-09 8:46 
AnswerRe: urgent help pleasse [image processing , pointers , byte ] Pin
saurabh sahay10-Jun-09 11:50
saurabh sahay10-Jun-09 11:50 
QuestionHttpResponse Compression... ? Pin
Trapper-Hell10-Jun-09 5:54
Trapper-Hell10-Jun-09 5:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.