的WinForms:ListView的定位的BackgroundImage [英] WinForms: ListView's BackgroundImage positioning

查看:300
本文介绍了的WinForms:ListView的定位的BackgroundImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我把一个的BackgroundImage在我的ListView在我的窗户形式之一。

I've put a BackgroundImage on my ListView in one of my windows forms.

一切正常。但现在我只希望这一形象定位的ListView里面。

Everything works as expected. But now I'd only like to position this image inside the ListView.

像CSS:背景位置:右上; 将在元素的右上角贴图片

Like in CSS: background-position: top right; Would stick the image at the top right corner of the element.

是否与Windows窗体这样的方法吗?

Is there any way of doing so with a windows form?

非常感谢:)

推荐答案

简短的回答是:你不能

此博客文件为什么 LVM_SETBKIMAGE 和拦截 WM_ERASEBKGROUND 不与.NET列表视图工作。

This blog documents why LVM_SETBKIMAGE and intercepting WM_ERASEBKGROUND do not work with .NET ListViews.

我找到了这个问题的解决方案 - 以及在使用ObjectListView 项目 - 就是使用原生ListView控件的低水平自定义绘制的设施。这是复杂的实现,但(现在)使用方便。

The solution I found for this problem -- and which is used in the ObjectListView project -- is to use the low-level custom draw facilities of the native ListView control. It was complicated to implement, but is (now) easy to use.

这篇关于的WinForms:ListView的定位的BackgroundImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆