The FlexGrid Control allows you to specify columns to be displayed on the left. To meet project requirements, you must be able to specify columns to the rightmost.
Implementation Method:
Obtain the customer area width of the table, and then calculate the horizontal scroll bar position based on the width of each column.
But there is a problem, that is, the vertical scroll bar.
First, you must be able to determine whether a vertical scroll bar exists,
When there is a vertical scroll bar, you need to subtract the width of the vertical scroll bar,
However, the control does not provide this interface.
The following two conditions may apply to the widget's scroll bar:
1. FlexGrid is a composite control that contains a scroll bar object.
In this case, you can use reflector to view the Object Name and access the internal scroll bar object through reflection.
2. Is a traditional Win32 scrolling form.
In this way, you can use the Win32 API function to determine.
Use reflector to check the controlCodeIs the second case.
So we use Win32 API.
Use API functions
Lstyle = getwindowlong (hwnd, gwl_style );
Obtain the style and then determine
Whether ws_vscroll exists in the style.
If yes, a vertical scroll bar exists.
Then obtain the maximum and minimum values of the scroll bar. If they are equal, the scroll bar is invisible. If they are not equal, they are visible.