管理者软件
专业源于专注
www. myOIT. cn   
软件交流 管理软件 软件手册 »

    

 1  1/1   1  
作者
内容
qf2016  [个人空间]
QQ名  meng 113779009


注册  2016-01-17
发贴数  2382
精华数  0
原创贴  0
来自  
状态  正常

级别  版主
#1»发布于2021-07-31 23:01

void __fastcall MTreeView::MTreeView_DrawItem( 
      TCustomTreeView *Sender, TTreeNode *Node, TCustomDrawState State, 
      bool &DefaultDraw) 

  TTreeView * tv = (TTreeView * )Sender; 
 
  TRect r; 
  TTreeNode * node = (TTreeNode *) Node; 
 
  r = node->DisplayRect(false); 
 
  tv->Canvas->Brush->Style = bsSolid; 
  tv->Canvas->Brush->Color = 0xf3f3f2; 
  tv->Canvas->CopyMode=cmMergeCopy  ; 
  tv->Canvas->FillRect(r); 
 
 
 
 
  //这里的背景色怎么也修改不了,估计是cb的漏洞 
  if(tv->HideSelection==true) 
    tv->HideSelection=false; 
 
  ////////////////////////////////////////////////////////////////////////////// 
  //2021-01-26 修改,把画布的字体设小,用来使得间隔增大 
  int f; 
 
  /* 
  f = tv->Font->Height; 
  if(f<0) f++; 
  else f--; 
  tv->Canvas->Font->Height=f; 
  */ 
 
  f = tv->Font->Size - 1; 
  if(f>=8) 
    tv->Canvas->Font->Size=f; 
 
  //  tv->Canvas->Brush->Color  = 0xf2f2f3; 
  ////////////////////////////////////////////////////////////////////////////// 
 
  //if(State.Contains(cdsSelected)) 
  if (State.Contains(cdsSelected) ) 
  { 
    //TreeView1->Canvas->Font->Assign(SelectedFontDialog->Font); 
    tv->Canvas->Brush->Color = clRed; 
    tv->Canvas->Font->Color = clBlue; 
    tv->Canvas->Brush->Style = bsSolid; 
    DefaultDraw=true; 
 
  } 
 
  if(Node==this->Selected  ) 
  { 
    //DefaultDraw=false; 
    tv->Canvas->Brush->Color  = clWhite; 
    tv->Canvas->Font->Color   = clBlue; 
    tv->Canvas->Brush->Style = bsSolid; 
    DefaultDraw=true; 
    /* 
    if(tv->Focused()) 
      tv->Canvas->Font->Color  = clBlue; 
    else 
      tv->Canvas->Font->Color  = clBlue; //0xa0a0ff; 
    */ 
  }; 
  /* 
  TTreeView * tv = (TTreeView * )Sender; 
 
  if(tv->HideSelection==true) 
    tv->HideSelection=false; 
  if(!State.Contains(cdsHot  )) 
  if(State.Contains(cdsSelected)) 
  { 
    if(tv->Focused()) 
      tv->Canvas->Font->Color  = clWhite; 
    else 
      tv->Canvas->Font->Color  = 0xf1f1f1; 
  }; 
  */ 
}


        





 1  1/1   1  


登录后方可发贴


[ 电话: 0571-85462761 王先生 QQ: 124520435 加入软件QQ群 - 中国杭州 - 备案号码 浙ICP备19051128号]