博客
关于我
判断是否出现垂直滚动条
阅读量:475 次
发布时间:2019-03-06

本文共 1351 字,大约阅读时间需要 4 分钟。

ShowScrollBar Function

using System.Runtime.InteropServices;
[DllImport("user32.dll")]private static extern int GetWindowLong(IntPtr hwnd, int nIndex);
/// 判断是否出现垂直滚动条        /// 待测控件        /// 
出现垂直滚动条返回true,否则为false
public static bool IsVerticalScrollBarVisible(Control ctrl)
{
if (!ctrl.IsHandleCreated) return false;
return (GetWindowLong(ctrl.Handle, GWL_STYLE) & WS_VSCROLL) != 0;
}
/// 判断是否出现水平滚动条        /// 待测控件        /// 
出现水平滚动条返回true,否则为false
public static bool IsHorizontalScrollBarVisible(Control ctrl)
{
if (!ctrl.IsHandleCreated) return false;
return (GetWindowLong(ctrl.Handle, GWL_STYLE) & WS_HSCROLL) != 0;
}
/** Scroll Bar Constants*/
public const int SB_HORZ = 0;
public const int SB_VERT = 1;
public const int SB_CTL = 2;
public const int SB_BOTH = 3;
/* ShowWindow() Commands*/
public const int SW_HIDE = 0;
public const int SW_SHOW = 5;
private void button1_Click(object sender, EventArgs e)
{
ShowScrollBar(listView1.Handle, SB_VERT, false);
}
你可能感兴趣的文章
mongodb定时备份数据库
查看>>
mppt算法详解-ChatGPT4o作答
查看>>
mpvue的使用(一)必要的开发环境
查看>>
MQ 重复消费如何解决?
查看>>
mqtt broker服务端
查看>>
MQTT 保留消息
查看>>
MQTT 持久会话与 Clean Session 详解
查看>>
MQTT介绍及与其他协议的比较
查看>>
MQTT工作笔记0007---剩余长度
查看>>
MQTT工作笔记0008---服务质量
查看>>
MQTT工作笔记0009---订阅主题和订阅确认
查看>>
Mqtt搭建代理服务器进行通信-浅析
查看>>
MS COCO数据集介绍
查看>>
MS Edge浏览器“STATUS_INVALID_IMAGE_HASH“兼容性问题
查看>>
ms sql server 2008 sp2更新异常
查看>>
MS SQL查询库、表、列数据结构信息汇总
查看>>
MS UC 2013-0-Prepare Tool
查看>>
MSBuild 教程(2)
查看>>
msbuild发布web应用程序
查看>>
MSB与LSB
查看>>