不知不觉在新公司一个半月了。
感觉还不错,刚刚接手项目两天,还没有什么压力。
软件都是用D5开发的,没有Object Treeview真是不适应。
公司的老人都挺能忍的。研发部的经理早说可以升级D7,
只有新人(就两个)升级了,其他竟然还真的就在D5下面维护。都是老油条了。
D5升级到D7基本无痛。只是线程要注意点
D5结束线程用的是suspend之后free;
D7 我自己是用Freeonterminate:=true;Terminate;的。
不过同事说这个好像不稳定
推荐使用
Terminate;
Waitfor;
Free;
发现Delphi真是冷清啊。这周没事在研究xe7下面doubulebuffer打开后panel不再透明的问题
最终在TwinControl中找到这个。
procedure TWinControl.WMPaint(var Message: TWMPaint);
还有下面这个
procedure TWinControl.WMEraseBkgnd(var Message: TWMEraseBkgnd);
begin
if StyleServices.Enabled and Assigned(Parent) and (csParentBackground in FControlStyle) then
begin
{ Get the parent to draw its background into the control's background. }
if Parent.DoubleBuffered then
begin
PerformEraseBackground(Self, Message.DC);
end
else
begin
StyleServices.DrawParentBackground(Handle, Message.DC, nil, False);
end;
end
else
begin
{ Only erase background if we're not doublebuffering or painting to memory. }
if not FDoubleBuffered or
{$IF DEFINED(CLR)}
(Message.OriginalMessage.WParam = Message.OriginalMessage.LParam) then
{$ELSE}
(TMessage(Message).wParam = WPARAM(TMessage(Message).lParam)) then
{$ENDIF}
FillRect(Message.DC, ClientRect, FBrush.Handle);
end;
Message.Result := 1;
end;
在wm_paint中启作用的是下面的代码(注释掉的是我自己乱添加的)
想着如果在MemDC中直接把透明的部分给画进去应该也算透明了,尝试失败。有大神看会的指点下。
DC := BeginPaint(Handle, PS);
// if (csParentBackground in ControlStyle) and (self.Parent<>nil) then
// begin
// DC1:= GetDC(self.Parent.Handle);
// PaintBuffer1 := BeginBufferedPaint(DC1,Rect(self.Left,self.Top,self.Left+self.Width,self.Top+self.Height), BPBF_COMPOSITED, nil, MemDC1);
// Perform(WM_PRINTCLIENT, MemDC1, PRF_CLIENT);
// EndBufferedPaint(PaintBuffer1, True);
// end;
Try
//把控件在,内存中绘制
PaintBuffer := BeginBufferedPaint(DC, PS.rcPaint, BPBF_COMPOSITED, nil, MemDC);
if PaintBuffer <> 0 then
try
// Perform(WM_PRINTCLIENT, MemDC1, 0);
// if MemDC1<>0 then
// begin
// Perform(WM_ERASEBKGND, MemDC1, 0)
// end
// else
begin
Perform(WM_ERASEBKGND, MemDC, 0)
end;
Perform(WM_PRINTCLIENT, MemDC, PRF_CLIENT);
if not (csPaintBlackOpaqueOnGlass in FControlStyle) then
BufferedPaintMakeOpaque(PaintBuffer, PS.rcPaint);
finally
EndBufferedPaint(PaintBuffer, True);
end;
finally
EndPaint(Handle, PS);
end;
真是没办法了就只好放弃了。
大不了费点劲用FireMonkey来做显示窗口,反正跟VCL混合编程好像也没什么问题。