简体   繁体   English

如何在C#winforms中获得ComboBox的“下拉按钮”大小

[英]How to get “drop down button” size of ComboBox in C# winforms

How can I get the size of the DropDown Button on a ComboBox ? 如何在ComboBox上获取DropDown Button的大小?

For anyone unsure of what I mean, it is the Button usually found on the right hand side of a ComboBox containing a downward facing arrow. 对于任何不确定我的意思的人来说,通常位于ComboBox右侧的Button上有一个向下箭头。 When clicked this expands the DropDown section. 单击此按钮可展开DropDown部分。

For further clarification, it is the button in the red circle in the below image. 为了进一步说明,它是下图中红色圆圈中的按钮。

在此输入图像描述

For such constants you can use GetSystemMetrics API function; 对于这样的常量,您可以使用GetSystemMetrics API函数; C# quick analogue is SystemInformation class: C#quick analogue是SystemInformation类:

  using System.Windows.Forms;

  ...

  int arrowWidth = SystemInformation.VerticalScrollBarWidth;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM