MFC:如何在调整大小时使用easysize更新视图UGC [英] MFC: how to update the view UGC with the use of easysize while resizing

查看:116
本文介绍了MFC:如何在调整大小时使用easysize更新视图UGC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi社区

现在我正在尝试使用embeddd网格控件创建一个相当大的对话框。



调整对话框大小后,其所有组件,如网格控件框架控件,

网格控件本身的COL不会调整大小。这看起来很糟糕。

只有最后一个Col在每次移动时都会增加他的宽度我跟对话框的边界一样



i试图添加调整大小函数中控件的FitToWindow(),但它只是一个不寻常的行为。(请参阅你尝试了什么?)



有一点小技巧我忘记使用了吗?



谢谢



我尝试了什么: < br $>


// GridCtrl是MyClass Dlg中我的网格容器的名称



void MyClass :: OnSize(UINT nType,int cx,int cy)

{

CDialog :: OnSize(nType,cx,cy);

UPDATE_EASYSIZE;



GridCtrl.FitToWindow(0,m_ConfigGridCtrl.GetNumberCols() - 1); // - >经过几次调整后,最后一列将变得超大,其他变小,向左移动(向0方向)

//GridCtrl.RedrawAll( ); - >崩溃

//GridCtrl.AdjustComponentSizes();->crash

}

解决方案

< blockquote>据我所知,你的网格容器只能正确调整最后一列,而其他列不正确:那就是bug。它可以通过将分数抛到板上而从一些舍入分区浮动到int。您需要更好地计算大小值或一些逻辑来总结和平衡分数。



提示:从col宽度的自定义浮点数开始理解并跟踪它。


我创建了一个解决方法。



我为UltimateGridControl创建了一个调整大小的函数,

使用我的(例如)COL_1_WIDTH = 20COL_2_WIDTH = 30定义

并调整网格的所有cols而不操纵数据。

它起作用,因为UGC定义是相对于整个网格控件。



它不是最好的解决方案,因为我只是压抑和过度绘画,

但是目前最好的工作。



谢谢你的帮助



___i可以解雇它在

 :: OnSize(UINT nType, int  cx, int  cy)

CDialog :: OnSize(nType,cx,cy);
UPDATE_EASYSIZE;
if (GridCtrl)
GridCtrl.ResizeColsWidth();





这里我使用for循环设置所有WIDTH_DEFINES以再次设置宽度,而不更新数据。


Hi Community
right now im trying to create a sizable dialog with an embeddd grid control.

After the Resize of the dialog, with all its components, like the grid control "frame"-control,
the COLs of the Grid Control per se will not resize. this looks pretty bad.
Only the last Col increases his width during every move i do with the boarder of the dialog

i tried to add an FitToWindow()of the control in the resize function, but it just gets an unusal behaviour.(see What have you tried?)

Is there a little trick i forgot to use?

Thanks

What I have tried:

//GridCtrl is the name of my Grid Container inside of the MyClass Dlg

void MyClass::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
UPDATE_EASYSIZE;

GridCtrl.FitToWindow(0,m_ConfigGridCtrl.GetNumberCols()-1); //->after a few resizes, the "last" column will be super big, the other ones getting smaller and moved to the left(in the 0 direction)
//GridCtrl.RedrawAll();->crash
//GridCtrl.AdjustComponentSizes();->crash
}

解决方案

As I understand you your grid container only resizes the last column correctly and the others not correct: that is bug. It can come from some rounding division float to int by throwing the fraction over board. You need some better computation of the sizing values or some logic to sum up and balance the fractions.

Tip: start by an own array of floats for the col width to understand and track it.


Id created a workaround.

I created a resize function for the UltimateGridControl,
which uses my (for example)"COL_1_WIDTH = 20""COL_2_WIDTH = 30" defines
and resizes all cols of the Grid without manipulating the data.
It works cause the UGC-defines are relative to the whole grid control.

Its not the best solution,cause im just supressing and overpainting,
but for the moment the best working.

Thank you for your help

___i can fire it in the

::OnSize(UINT nType, int cx, int cy)
	
CDialog::OnSize(nType, cx, cy);
	UPDATE_EASYSIZE;
	if(GridCtrl)
		GridCtrl.ResizeColsWidth();



here i use a for loop to set all the WIDTH_DEFINES for setting the width again, without updating the data.


这篇关于MFC:如何在调整大小时使用easysize更新视图UGC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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