Tuesday, May 5, 2009

Infragistics netadvantage UltraGrid (UltraWinGrid) 编程手记

Infragistics netadvantage UltraGrid (UltraWinGrid) 编程手记




UltraGrid打印预览

NetAdvantage中提供了PrintPreview控件,用于打印的预览实现。UltraGrid也提供了直接打印的支持,且效果也是很不错的!
       本文将介绍如何实现UltraGrid的打印效果。
1.     拖放UltraGrid到Form中,增加一些Column,这里另外增加了几个图片按钮列,要在打印的时候不打印出来
2.     拖放一个GridPrintDocument和一个PrintPreviewDialog,它们是组件,出现在Form下方的组件区域
3.     Print按钮事件中写下如下代码
第一段代码是设置Grid中的指定Column是否可见;
第二段代码是将PrintDocument与Grid关联,并且指定PrintPreviewDialog的Document为PrintDocument,然后Show出PrintPreviewDialog,供用户打印预览;
第三段代码是将Grid的属性还原为初始状态;
4.     运行效果
能够将Grid的Style完全打印出来
5.     注意点:
由于PrintPreviewDialog是在ShowDialog的时候才会读取Grid的Layout,所以必须在ShowDialog之前调整Grid的Columns等样式,并且要应用(EndUpdate)
如果需要调整页面的布局,可以对PrintPreviewDialog属性进行设置以符合具体的需求

制作复杂表头的Grid

实现Grid的复杂表头是不可避免的一个应用,我们的VB程序中也有很多使用SSDBGrid做类似的实现的例子,那么在UltraGrid中如何实现复杂表头呢?
       严格的说实现UltraGrid的复杂表头可以有两种方式,第一根据UltraGrid提供的接口属性进行设置第二是重写其Paint方法,但较复杂,不推荐
根据UltraGrid提供的属性进行组合可以在设计时实现所见即所得的效果,也可以通过编程实现,较繁琐。
本文将介绍如何在设计时根据UltraGrid的接口属性进行组合以展现复杂表头的效果。
要展示的效果如下,Personal Information为一个固定的Title,相当于Group,不对应详细的Cell,其下包括Name、Age、Sex三个子Title
1.     拖一个UltraGrid到Form中,设置其常规属性,不再介绍
2.     设定其DataSource,并添加一些Column到Grid
然后在Band属性设置部分设置如下属性Band的UseRowLayout = True,启用Row布局,这点很重要!
3.     然后在Columns中添加一个UnboundColumn到Band中,作为Personal Information一栏
注意:设置其CellActivation = Disabled,表示该栏位不被激活;设置其SortIndicator = Disabled,表示该栏位不允许排序;
4.     接下来设置每个Column的RowLayoutColumnInfo属性
注意:
这个地方很重要,直接关系到Title的布局呈现;
四个属性需要了解OriginX(X到原点(Grid的左上角为0 / 0)位置)、OriginY(Y到原点位置)、SpanX(X轴上跨越个数)、SpanY(Y轴跨越个数),这里的最小计数单位为2.
以Name栏位为例,从效果图中可以看出,其X据(0,0)为0,Y据(0,0)为2,X轴上跨越一个数=2,Y轴上跨越2个数=4,故设定如下:
其余栏位类似,如Age四个属性分别为(2,2,2,2),Sex的四个属性分别为(2,4,2,2),Team的四个属性为(4,0,2,6),Personal Information的四个属性(0,0,4,2)
5.     Personal Information栏位需要注意做如下设定
由于Personal Information栏位是仅为了呈现的Title,所以需要设定其PreferredCellSize大小为1×1,且AllowCellSizing=None,LabelPosition=LabelOnly
6.     数据绑定还是同常规做法,没什么特别的,运行效果如下
7.     导出到Excel中效果如下

Monday, May 4, 2009

如何判断UltraGrid中是否选中数据

1. 判断Grid中是否有数据或者是否有选中的数据,通过Rows属性和Selected.Rows的属性Count判断
// 判断是否有数据,采用如下方式
UltraGrid.Rows.Count == 0
// 判断是否有选中数据,采用如下方式
UltraGrid.Selected.Rows.Count == 0
2. 另,设置Grid的Row选择方式如下:
对于整个Grid,设置其选择方式(只能选一行还是可以选择多行),如下图二,各个属性的含义我就不描述了。也可以在属性里设置(在对应的DisplsyLayout—>OverrideàSelectTypeRow)。当然,单元格和列的选择设置类似。
3. 可以在Feature Picker中设置Grid是否显示每行之前的Selector
4. 如下这种情况是没有选中行的(Selected.Rows.Count为0),三角符号指向的行为Active Row,但不一定为选中(图中因为选中第一个单元格,所以不是选中行)
如下情况选中了一行(Selected.Rows.Count为1)
如下情况选中了多行(Selected.Rows.Count为6)

Apparent DIp

Iain,

 

A quick look method: If the sinusoids are relatively well centered, you can have a very close estimate of the apparent dip, just centering it in the track of WellEye.

 

We used this method as a quick check for long time in Brazil, and never found significant errors.

 

You can use the RTGS App Dip conversion or DXI to check validity of this.

 

Regards,

 

Guillermo

 

 


Subject: Re: Apparent DIp

 

Iain,

This is the equation you're looking for :

Apparent dip relative to curtain section = Bed True Dip x Sin((90.0 - Bed Azimuth + Traj Azimuth) 

Note that trajectory's inclination plays no role here. 

Regards

Farid

At 09:41 AM 01/10/2007, Iain Donald wrote:

Hi there Geosteerers,
                          I am looking for the formula that allows me to calculate the apparent dip along the section of the azimuth of the wellbore.

I can input true dip and azimuth and wellbore dip and azimuth.

Note that the apparent dip generated in Welleye is relative to wellbore.

Thanks

Iain

地质年代表


Sunday, May 3, 2009

apparent dip calculation

Hi Peter,
 
The apparent dip (geologist's use) of a bed in any desired crossection direction can be calculated by:
 
tan a = tan b * sin c   where a is the apparent dip, b is the true dip and c is the angle between the strike of the bed and the direction of the apparent dip.
 
 
.......or use the Schmidt net !
 
Ted
 


bornemann@anchorage.oilfield.slb.com



Folks

Our client wants to use OBMI dips for his seismic velocity modeling. We have a surface seismic line in a certain direction. We also have a dip set representing the bedding - true dip angle and azimuth. 
Does anybody have a little program to calculate the apparent dip for a different (given) azimuth? 

We can do it graphically in StrucView by changing the cross section direction, but we also need the dip values in an ascii file.

Thanks,
Peter

Sunday, January 18, 2009

How ot use UltraToolTipManager for control's ToolTip

UltraToolTipManager提供了为UltraWin Controls提供ToolTip的功能,使得可以自定义UltraWin Controls的ToolTip,且形式统一,支持Style。
本文将以UltraTextEditor为例介绍如何定制ToolTip。
1. 拖放一个UltraToolTipManger到Form,由于其为组件而非控件,所以会出现在Form下方的组件区域
2. 设置其相关属性如下
其中主要的属性如DisplayStyle(呈现样式,了解即可)、AutoPopDelay(弹出后多长时间消失)、InitialDelay(初始化时间,即触发到出现ToolTip需要多久)需要设置。其余的属性不需要做设置。
3. 拖放一个UltraTextEditor到Form上
4. 设置它的ToolTip属性如下
在属性中发现多了一个分类为UltraToolTip on ultraToolTipManager1,点开之后设置其ToolTipTextFormatted为你要的Show出的ToolTip即可(之所以设置此属性,是想要以格式化的效果Show出ToolTip)。
5. 执行效果如下
当鼠标移到UltraTextEditor1上之后,ToolTip就会自动呈现出来
6. 注意:如果考虑多语言的情况,需要在更换语言的时候,更换其ToolTip,可以采用如下方式
其中需要注意的“Your tool tip here with Multi-language.”的内容是通过多语言机制获取的经过多语言处理的具体内容。