怎样给richedit和treeview画背景(100分)

  • 主题发起人 主题发起人 qiubole
  • 开始时间 开始时间
Q

qiubole

Unregistered / Unconfirmed
GUEST, unregistred user!
在给treeview画背景的时候,有文字的地方好难看,有没有办法设透明

如何给richedit画上背景呀,呜

 
对,用canvas画的文字都是一块一块的,恶心
 
拦截重画消息,在这之中画吧
 
draw之前先用这个API设置透明

The SetBkMode function sets the background mix mode
of the specified device context. The background mix
mode is used with text, hatched brushes, and pen
styles that are not solid lines.

int SetBkMode(

HDC hdc, // handle of device context
int iBkMode // flag specifying background mode
);


Parameters

hdc

Identifies the device context.

iBkMode

Specifies the background mode. This parameter can be
either of the following values:

Value Description
OPAQUE Background is filled with the current background
color before the text, hatched brush, or pen is drawn.
TRANSPARENT Background remains untouched.


Return Values

If the function succeeds, the return value specifies the
previous background mode.
If the function fails, the return value is zero.

Remarks

The SetBkMode function affects the line styles for lines
drawn using a pen created by the CreatePen function.
SetBkMode does not affect lines drawn using a pen created
by the ExtCreatePen function.
The iBkMode parameter can also be set to driver-specific
values. GDI passes such values to the device driver and
otherwise ignores them.
 
to 苦虫
一个treeview何苦复杂,全部要自己重画?

to 左轻候
单纯设透明试过,几乎不起作用
 
on customdrawitem(...)
begin
TreeView.Canvas.Brush.Style := bsClear
...
end;
 
这里有篇文章,可惜是VC的

http://www.csdn.net/Dev/Visual%20C++/source%20code/
TreeView_Control/background_image.shtml.htm
 
接受答案了.
 
to qiubole:你这个问题搞定了没有?能否给我一个示例程序?
 

Similar threads

D
回复
0
查看
911
DelphiTeacher的专栏
D
D
回复
0
查看
868
DelphiTeacher的专栏
D
D
回复
0
查看
840
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部