Click here to Skip to main content
15,890,512 members
Home / Discussions / C#
   

C#

 
GeneralRe: Centrally managed memory allocation/deallocation Pin
leppie23-Oct-04 1:45
leppie23-Oct-04 1:45 
GeneralTreeview node images Pin
sachinkalse22-Oct-04 16:26
sachinkalse22-Oct-04 16:26 
GeneralFile IO Pin
StephenMcAllister22-Oct-04 14:06
StephenMcAllister22-Oct-04 14:06 
GeneralRe: File IO Pin
Nick Parker22-Oct-04 15:37
protectorNick Parker22-Oct-04 15:37 
GeneralRe: File IO Pin
StephenMcAllister23-Oct-04 7:47
StephenMcAllister23-Oct-04 7:47 
QuestionHOW TO : BUild Dynamic Templatecolumn. Help Pin
harish h subramanian22-Oct-04 13:53
harish h subramanian22-Oct-04 13:53 
AnswerRe: HOW TO : BUild Dynamic Templatecolumn. Help Pin
Heath Stewart22-Oct-04 21:08
protectorHeath Stewart22-Oct-04 21:08 
Generalplease convert this method :) Pin
SeaMonkey00722-Oct-04 13:42
SeaMonkey00722-Oct-04 13:42 
I am having some trouble with this method that I want converted into c#, and being a c# novice it is taking me far longer than I would like.

At the moment it is written in c++ and its function is to set the DeviceGammaRamp given a certain int value (igamma).

Here it is...

void AdjustGamma( int iGamma )
{

HDC hDC = GetDC(GetDesktopWindow());

bool bMinus = iGamma < 0;

if( bMinus )
iGamma = -iGamma;

iGamma = min(max(iGamma, 0), 255);

if( hDC ) {
const int iNum = 256;
struct sRamp {
WORD wRed[iNum];
WORD wGreen[iNum];
WORD wBlue[iNum];
} wRamp;
if( GetDeviceGammaRamp(hDC, (LPVOID)&wRamp) ) {
for( int i = 0; i < iNum; i++ ) {
if( bMinus ) {
wRamp.wRed[i] = (255 - iGamma)*(i);
wRamp.wGreen[i] = (255 - iGamma)*(i);
wRamp.wBlue[i] = (255 - iGamma)*(i);
} else {
wRamp.wRed[i] = 65535 - (255 - iGamma)*(255 - i);
wRamp.wGreen[i] = 65535 - (255 - iGamma)*(255 - i);
wRamp.wBlue[i] = 65535 - (255 - iGamma)*(255 - i);
}
}
BOOL bRet = SetDeviceGammaRamp(hDC, (LPVOID)&wRamp);
}
ReleaseDC(GetDesktopWindow(), hDC);
}
}

There is some additional information as well, I have imported gdi32.dll sucessfully, and it looks like this...

[DllImport("gdi32.dll")]
private static extern bool SetDeviceGammaRamp(IntPtr hDC, IntPtr lpRamp);

If somebody could help me with this method then I could most certainly finish of another two that I have incompleted.

Thanks for your time Smile | :)
GeneralRe: please convert this method :) Pin
Paul Lyons22-Oct-04 17:01
Paul Lyons22-Oct-04 17:01 
GeneralRe: please convert this method :) Pin
SeaMonkey00722-Oct-04 20:40
SeaMonkey00722-Oct-04 20:40 
GeneralRe: please convert this method :) Pin
Paul Lyons23-Oct-04 3:48
Paul Lyons23-Oct-04 3:48 
GeneralRe: please convert this method :) Pin
SeaMonkey00723-Oct-04 15:10
SeaMonkey00723-Oct-04 15:10 
GeneralGroup box text will not display an Ampersand Pin
Tony D. Abel22-Oct-04 13:36
Tony D. Abel22-Oct-04 13:36 
GeneralRe: Group box text will not display an Ampersand Pin
Colin Angus Mackay22-Oct-04 13:57
Colin Angus Mackay22-Oct-04 13:57 
GeneralRe: Group box text will not display an Ampersand Pin
Tony D. Abel22-Oct-04 14:03
Tony D. Abel22-Oct-04 14:03 
GeneralTabPage OnClick Pin
quilkin22-Oct-04 12:14
quilkin22-Oct-04 12:14 
GeneralRe: TabPage onclick Pin
Heath Stewart22-Oct-04 12:43
protectorHeath Stewart22-Oct-04 12:43 
GeneralActive FTP and C# Pin
mrfricke200222-Oct-04 10:28
mrfricke200222-Oct-04 10:28 
Generaldrawing on the main menu background Pin
jcl55522-Oct-04 9:44
jcl55522-Oct-04 9:44 
GeneralRe: how to open url and login Pin
Heath Stewart22-Oct-04 12:45
protectorHeath Stewart22-Oct-04 12:45 
GeneralSerializing an object with two events; need to store the hooked-up event handlers somehow Pin
PilsnerDk22-Oct-04 8:32
PilsnerDk22-Oct-04 8:32 
QuestionRegOpenKey and similar .... marshal/P-Invoke?? Pin
Paolo Ponzano22-Oct-04 7:56
Paolo Ponzano22-Oct-04 7:56 
AnswerRe: RegOpenKey and similar .... marshal/P-Invoke?? Pin
Nick Parker22-Oct-04 10:57
protectorNick Parker22-Oct-04 10:57 
AnswerRe: RegOpenKey and similar .... marshal/P-Invoke?? Pin
Ami Bar22-Oct-04 13:56
Ami Bar22-Oct-04 13:56 
GeneralRe: RegOpenKey and similar .... marshal/P-Invoke?? Pin
Paolo Ponzano23-Oct-04 1:35
Paolo Ponzano23-Oct-04 1:35 

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.