Click here to Skip to main content
16,006,515 members
Home / Discussions / C#
   

C#

 
GeneralRe: Throwing exception when a property must not be null? Pin
Erik Westermann10-Sep-02 15:48
professionalErik Westermann10-Sep-02 15:48 
GeneralRe: Throwing exception when a property must not be null? Pin
jparsons10-Sep-02 5:07
jparsons10-Sep-02 5:07 
GeneralRe: Throwing exception when a property must not be null? Pin
stephen woolhead13-Sep-02 10:48
stephen woolhead13-Sep-02 10:48 
GeneralAdjusting colors Pin
Nnamdi Onyeyiri7-Sep-02 23:49
Nnamdi Onyeyiri7-Sep-02 23:49 
GeneralRe: Adjusting colors Pin
Stephane Rodriguez.8-Sep-02 0:25
Stephane Rodriguez.8-Sep-02 0:25 
GeneralRe: Adjusting colors Pin
Nnamdi Onyeyiri8-Sep-02 1:07
Nnamdi Onyeyiri8-Sep-02 1:07 
GeneralRe: Adjusting colors Pin
Nnamdi Onyeyiri8-Sep-02 1:44
Nnamdi Onyeyiri8-Sep-02 1:44 
GeneralRe: Adjusting colors Pin
Stephane Rodriguez.8-Sep-02 2:07
Stephane Rodriguez.8-Sep-02 2:07 
Isn't that one clearer ?
void RGBtoHSL(COLORREF rgb, double *H, double *S, double *L)
{
   double delta;
   double r = (double)GetRValue(rgb)/255;
   double g = (double)GetGValue(rgb)/255;
   double b = (double)GetBValue(rgb)/255;
   double cmax = max(r,max(g,b));
   double cmin = min(r,min(g,b));
   *L=(cmax+cmin)/2.0;
   if(cmax==cmin) {
      *S = 0;
      *H = 0; // it's really undefined
   } else {
      if(*L < 0.5) 
         *S = (cmax-cmin)/(cmax+cmin);
      else
         *S = (cmax-cmin)/(2.0-cmax-cmin);
      delta = cmax - cmin;
      if(r==cmax)
          *H = (g-b)/delta;
      else if(g==cmax)
          *H = 2.0 +(b-r)/delta;
      else
          *H=4.0+(r-g)/delta;
      *H /= 6.0;
      if(*H < 0.0)
          *H += 1;
   }
}

int HuetoRGB(double m1, double m2, double h)
{
   if( h < 0 ) h += 1.0;
   if( h > 1 ) h -= 1.0;
   if( 6.0*h < 1 )
      return ((int) (255 * (m1+(m2-m1)*h*6.0)));
   if( 2.0*h < 1 )
      return ((int) (255 * m2));
   if( 3.0*h < 2.0 )
      return ((int) (255 * (m1+(m2-m1)*((2.0/3.0)-h)*6.0)));
   return ((int) (255 * m1));
}

void HLStoRGB(double H, double L, double S, int *r, int *g, int *b)
{
  double m1, m2;

  if(S==0) {
     *r = *g = *b = (int) (255 * L);
  } else {
     if(L <=0.5)
        m2 = L*(1.0+S);
     else
        m2 = L+S-L*S;
     m1 = 2.0*L-m2;
     *r = HuetoRGB(m1,m2,H+1.0/3.0);
     *g = HuetoRGB(m1,m2,H);
     *b = HuetoRGB(m1,m2,H-1.0/3.0);
  }
}




MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release.
GeneralRe: Adjusting colors Pin
Nnamdi Onyeyiri8-Sep-02 2:13
Nnamdi Onyeyiri8-Sep-02 2:13 
GeneralRe: Adjusting colors Pin
James T. Johnson8-Sep-02 11:52
James T. Johnson8-Sep-02 11:52 
Generalusing Systen.Windows.Forms namespace Pin
kab7-Sep-02 19:17
kab7-Sep-02 19:17 
GeneralRe: using Systen.Windows.Forms namespace Pin
Paul Riley8-Sep-02 0:05
Paul Riley8-Sep-02 0:05 
QuestionIs RegExp The Best Way to Go? Pin
MStanbrook7-Sep-02 10:57
MStanbrook7-Sep-02 10:57 
AnswerRe: Is RegExp The Best Way to Go? Pin
Martin Haesemeyer7-Sep-02 23:59
Martin Haesemeyer7-Sep-02 23:59 
AnswerRe: Is RegExp The Best Way to Go? Pin
Eric Gunnerson (msft)9-Sep-02 5:34
Eric Gunnerson (msft)9-Sep-02 5:34 
QuestionAnyone want to help design this? Pin
Alex Korchemniy7-Sep-02 10:38
Alex Korchemniy7-Sep-02 10:38 
AnswerRe: Anyone want to help design this? Pin
Nnamdi Onyeyiri7-Sep-02 11:49
Nnamdi Onyeyiri7-Sep-02 11:49 
AnswerRe: Anyone want to help design this? Pin
Paul Riley7-Sep-02 13:16
Paul Riley7-Sep-02 13:16 
GeneralRe: Anyone want to help design this? Pin
Paul Ingles8-Sep-02 0:56
Paul Ingles8-Sep-02 0:56 
AnswerRe: Anyone want to help design this? Pin
ez28-Sep-02 6:42
ez28-Sep-02 6:42 
QuestionPaging in DataGrid? Pin
leppie7-Sep-02 7:04
leppie7-Sep-02 7:04 
AnswerRe: Paging in DataGrid? Pin
Paul Riley7-Sep-02 8:15
Paul Riley7-Sep-02 8:15 
GeneralRe: Paging in DataGrid? Pin
leppie8-Sep-02 1:30
leppie8-Sep-02 1:30 
GeneralRe: Paging in DataGrid? Pin
Paul Riley8-Sep-02 1:39
Paul Riley8-Sep-02 1:39 
GeneralAny good <free> C# Documentation Generators Pin
Rodney S. Foley6-Sep-02 19:02
Rodney S. Foley6-Sep-02 19:02 

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.