----- Original Message ----- From: neomavez > > .. > > > I want a descendant of TTreeView that have a button within itself (in > > > its display area). > > ..
----- Original Message ----- From: Fahri Reza > > TTreeView usually subclassed to add something to its TreeNode. > > If you put a button in the client area, wouldn't that overwrite > > TTreeView's drawings? > > Is it possible to make the TTreeView think that its client area is a few > > pixels lower, so that your button will not be disturbed? ----- Original Message ----- From: Fahri Reza > I tried overriding GetClientRect and GetClientOrigin from TWinControl, > and change the Result property, buuuut it didn't work. > hehe.. codes below made the TTreeView's client area lower, unfortunately, it also moves everything drawn upon it ;) don't have a clue how to draw the buttons from this. const SPACEATTOP = 25; procedure TMyTree.TreeWndProc(var Message: TMessage); var r,r1 :TRect; pt :TPoint; cl :^NCCALCSIZE_PARAMS; dc :HDC; begin case Message.Msg of WM_ERASEBKGND: begin // get window DC not client DC dc := GetWindowDC( Handle ); // get real width Windows.GetWindowRect( Handle,r ); // get distance from top to client area pt.Y := 0; Windows.ClientToScreen( Handle,pt ); // get frame SetRect( r1,0,0,0,0 ); AdjustWindowRectEx( r1,GetWindowLong(Handle,GWL_STYLE),FALSE,GetWindowLong(Handle,GWL_EXSTYLE) ); // I have no idea what is r1.Bottom doing here r.Bottom := pt.Y - r.Top + r1.Top + r1.Bottom; r.Right := r.Right - r.Left + r1.Left - r1.Right; r.Left := 0 - r1.Left; r.Top := 0 - r1.Top; // finally some cleanup FillRect( dc,r,GetStockObject( WHITE_BRUSH ) ); ReleaseDC( Handle,dc ); end; WM_NCCALCSIZE: begin if( Message.WParam<>0 )then begin cl := Pointer( Message.LParam ); // change client area's rect cl.rgrc[0].Top := cl.rgrc[0].Top + SPACEATTOP; end; end; end; OldWndProc(Message); end; -------------------------------------------------------------------------------- FIreHAzaR:-D West Java, Indonesia