本文整理汇总了C#中BrightIdeasSoftware.OlvListViewHitTestInfo类的典型用法代码示例。如果您正苦于以下问题:C# OlvListViewHitTestInfo类的具体用法?C# OlvListViewHitTestInfo怎么用?C# OlvListViewHitTestInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OlvListViewHitTestInfo类属于BrightIdeasSoftware命名空间,在下文中一共展示了OlvListViewHitTestInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessLButtonDoubleClick
protected override bool ProcessLButtonDoubleClick(OlvListViewHitTestInfo hti)
{
if (hti.HitTestLocation == HitTestLocation.CheckBox)
{
return true;
}
if (hti.Column == null || !hti.Column.IsRowNumberColumn || hti.Item == null || hti.Item.Index < 0)
{
return true;
}
if (RowNumberDblClick != null)
{
RowNumberDblClick(hti);
}
return true;
}
示例2: HandleHitTest
/// <summary>
/// Handle the HitTest request
/// </summary>
/// <param name="g"></param>
/// <param name="hti"></param>
/// <param name="x"></param>
/// <param name="y"></param>
protected override void HandleHitTest(Graphics g, OlvListViewHitTestInfo hti, int x, int y)
{
Rectangle r = this.CalculateCheckBoxBounds(g, this.Bounds);
if (r.Contains(x, y))
hti.HitTestLocation = HitTestLocation.CheckBox;
}
示例3: ProcessLButtonDown
/// <summary>
/// Handle a left mouse down at the given hit test location
/// </summary>
/// <remarks>Subclasses can override this to do something unique</remarks>
/// <param name="hti"></param>
/// <returns>True if the message has been handled</returns>
protected virtual bool ProcessLButtonDown(OlvListViewHitTestInfo hti)
{
if (hti.Item == null)
return false;
// If they didn't click checkbox, we can just return
if (this.View != View.Details || hti.HitTestLocation != HitTestLocation.CheckBox)
return false;
// Did they click a sub item checkbox?
if (hti.Column.Index > 0) {
if (hti.Column.IsEditable)
this.ToggleSubItemCheckBox(hti.RowObject, hti.Column);
return true;
}
// They must have clicked the primary checkbox
this.ToggleCheckObject(hti.RowObject);
// If they change the checkbox of a selecte row, all the rows in the selection
// should be given the same state
if (hti.Item.Selected) {
CheckState? state = this.GetCheckState(hti.RowObject);
if (state.HasValue) {
foreach (Object x in this.SelectedObjects)
this.SetObjectCheckedness(x, state.Value);
}
}
return true;
}
示例4: ProcessRButtonDown
/// <summary>
/// Handle a left mouse down at the given hit test location
/// </summary>
/// <remarks>Subclasses can override this to do something unique</remarks>
/// <param name="hti"></param>
/// <returns>True if the message has been handled</returns>
protected virtual bool ProcessRButtonDown(OlvListViewHitTestInfo hti)
{
if (hti.Item == null)
return false;
// Ignore clicks on checkboxes
return (this.View == View.Details && hti.HitTestLocation == HitTestLocation.CheckBox);
}
示例5: HandleHitTest
protected override void HandleHitTest(Graphics g, OlvListViewHitTestInfo hti, int x, int y)
{
if (Bounds.Contains(x, y))
hti.HitTestLocation = HitTestLocation.Text;
}
示例6: CalculateOwnerDrawnHitTest
/// <summary>
/// Perform a hit test when the control is owner drawn. This hands off responsibility
/// to the renderer.
/// </summary>
/// <param name="hti"></param>
/// <param name="x"></param>
/// <param name="y"></param>
protected virtual void CalculateOwnerDrawnHitTest(OlvListViewHitTestInfo hti, int x, int y)
{
// If the click wasn't on an item, give up
if (hti.Item == null)
return;
// If the list is showing column, but they clicked outside the columns, also give up
if (this.View == View.Details && hti.Column == null)
return;
// Which renderer was responsible for drawing that point
IRenderer renderer = null;
if (this.View == View.Details) {
renderer = hti.Column.Renderer ?? this.DefaultRenderer;
} else {
renderer = this.ItemRenderer;
}
// We can't decide who was responsible. Give up
if (renderer == null)
return;
// Ask the responsible renderer what is at that point
renderer.HitTest(hti, x, y);
}
示例7: HandleHitTest
/// <summary>
/// Do the actual work of hit testing. Subclasses should override this rather than HitTest()
/// </summary>
/// <param name="g"></param>
/// <param name="hti"></param>
/// <param name="x"></param>
/// <param name="y"></param>
protected virtual void HandleHitTest(Graphics g, OlvListViewHitTestInfo hti, int x, int y)
{
Rectangle r = CalculateAlignedRectangle(g, Bounds);
StandardHitTest(g, hti, r, x, y);
}
示例8: LowLevelHitTest
/// <summary>
/// Perform a hit test using the Windows control's SUBITEMHITTEST message.
/// This provides information about group hits that the standard ListView.HitTest() does not.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
protected OlvListViewHitTestInfo LowLevelHitTest(int x, int y) {
// If it's not even in the control, don't bother with anything else
if (!this.ClientRectangle.Contains(x, y))
return new OlvListViewHitTestInfo(null, null, 0, null);
//if (Control.ModifierKeys == Keys.Control)
// System.Diagnostics.Debugger.Break();
// Call the native hit test method, which is a little confusing.
NativeMethods.LVHITTESTINFO lParam = new NativeMethods.LVHITTESTINFO();
lParam.pt_x = x;
lParam.pt_y = y;
int index = NativeMethods.HitTest(this, ref lParam);
// Setup the various values we need to make our hit test structure
bool isGroupHit = (lParam.flags & (int)HitTestLocationEx.LVHT_EX_GROUP) != 0;
OLVListItem hitItem = isGroupHit || index == -1 ? null : this.GetItem(index);
OLVListSubItem subItem = (this.View == View.Details && hitItem != null) ? hitItem.GetSubItem(lParam.iSubItem) : null;
// Figure out which group is involved in the hit test. This is a little complicated:
// If the list is virtual:
// - the returned value is list view item index
// - iGroup is the *index* of the hit group.
// If the list is not virtual:
// - iGroup is always -1.
// - if the point is over a group, the returned value is the *id* of the hit group.
// - if the point is not over a group, the returned value is list view item index.
OLVGroup group = null;
if (this.ShowGroups && this.OLVGroups != null) {
if (this.VirtualMode) {
group = lParam.iGroup >= 0 && lParam.iGroup < this.OLVGroups.Count ? this.OLVGroups[lParam.iGroup] : null;
} else {
if (isGroupHit) {
foreach (OLVGroup olvGroup in this.OLVGroups) {
if (olvGroup.GroupId == index) {
group = olvGroup;
break;
}
}
}
}
}
OlvListViewHitTestInfo olvListViewHitTest = new OlvListViewHitTestInfo(hitItem, subItem, lParam.flags, group);
// System.Diagnostics.Debug.WriteLine(String.Format("HitTest({0}, {1})=>{2}", x, y, olvListViewHitTest));
return olvListViewHitTest;
}
示例9: HandleHitTest
/// <summary>
/// Do the hit test
/// </summary>
/// <param name="g"></param>
/// <param name="hti"></param>
/// <param name="x"></param>
/// <param name="y"></param>
protected override void HandleHitTest(Graphics g, OlvListViewHitTestInfo hti, int x, int y) {
Branch br = this.Branch;
Rectangle r = this.Bounds;
if (br.CanExpand) {
r.Offset((br.Level - 1) * PIXELS_PER_LEVEL, 0);
r.Width = PIXELS_PER_LEVEL;
if (r.Contains(x, y)) {
hti.HitTestLocation = HitTestLocation.ExpandButton;
return;
}
}
r = this.Bounds;
int indent = br.Level * PIXELS_PER_LEVEL;
r.X += indent;
r.Width -= indent;
// Ignore events in the indent zone
if (x < r.Left) {
hti.HitTestLocation = HitTestLocation.Nothing;
} else {
this.StandardHitTest(g, hti, r, x, y);
}
}
示例10: HitTest
/// <summary>
/// Calculate which part of this cell was hit
/// </summary>
/// <param name="hti"></param>
/// <param name="x"></param>
/// <param name="y"></param>
public override void HitTest(OlvListViewHitTestInfo hti, int x, int y)
{
ClearState();
ListView = hti.ListView;
ListItem = hti.Item;
SubItem = hti.SubItem;
Column = hti.Column;
RowObject = hti.RowObject;
IsItemSelected = ListItem.Selected;
if (SubItem == null)
Bounds = ListItem.Bounds;
else
Bounds = ListItem.GetSubItemBounds(Column.Index);
//this.Bounds = this.ListView.CalculateCellBounds(this.ListItem, this.Column.Index);
using (Graphics g = ListView.CreateGraphics())
{
HandleHitTest(g, hti, x, y);
}
}
示例11: ProcessRButtonDown
/// <summary>
/// Handle a left mouse down at the given hit test location
/// </summary>
/// <remarks>Subclasses can override this to do something unique</remarks>
/// <param name="hti"></param>
/// <returns>True if the message has been handled</returns>
protected virtual bool ProcessRButtonDown(OlvListViewHitTestInfo hti) {
m_lastHitInfo = hti;
if (hti.Item == null)
return false;
// Ignore clicks on checkboxes
return (hti.HitTestLocation == HitTestLocation.CheckBox);
}
示例12: StandardHitTest
/// <summary>
/// Perform normal hit testing relative to the given bounds
/// </summary>
/// <param name="g"></param>
/// <param name="hti"></param>
/// <param name="bounds"></param>
/// <param name="x"></param>
/// <param name="y"></param>
protected void StandardHitTest(Graphics g, OlvListViewHitTestInfo hti, Rectangle bounds, int x, int y)
{
Rectangle r = bounds;
r = ApplyCellPadding(r);
// Did they hit a check box?
Rectangle r2 = this.CalculateCheckBoxBounds(g, r);
Rectangle r3 = r2;
r3.Inflate(2, 2); // slightly larger hit area
if (r3.Contains(x, y)) {
hti.HitTestLocation = HitTestLocation.CheckBox;
return;
}
int width = r2.Width;
// Did they hit the image? If they hit the image of a
// non-primary column that has a checkbox, it counts as a
// checkbox hit
r.X += width;
r.Width -= width;
width = this.CalculateImageWidth(g, this.GetImageSelector());
r2 = r;
r2.Width = width;
if (r2.Contains(x, y)) {
if (this.Column != null && (this.Column.Index > 0 && this.Column.CheckBoxes))
hti.HitTestLocation = HitTestLocation.CheckBox;
else
hti.HitTestLocation = HitTestLocation.Image;
return;
}
// Did they hit the text?
r.X += width;
r.Width -= width;
width = this.CalculateTextWidth(g, this.GetText());
r2 = r;
r2.Width = width;
if (r2.Contains(x, y)) {
hti.HitTestLocation = HitTestLocation.Text;
return;
}
hti.HitTestLocation = HitTestLocation.InCell;
}
示例13: OLVContextMenuClickArgs
public OLVContextMenuClickArgs(OlvListViewHitTestInfo hitInfo)
{
HitInfo = hitInfo;
}
示例14: StandardHitTest
/// <summary>
/// What part of the control is under the given point?
/// </summary>
/// <param name="g"></param>
/// <param name="hti"></param>
/// <param name="bounds"></param>
/// <param name="x"></param>
/// <param name="y"></param>
protected override void StandardHitTest(Graphics g, OlvListViewHitTestInfo hti, Rectangle bounds, int x, int y)
{
Rectangle r = ApplyCellPadding(bounds);
if (r.Contains(x, y))
hti.HitTestLocation = HitTestLocation.Button;
}
示例15: StandardHitTest
/// <summary>
/// Perform normal hit testing relative to the given bounds
/// </summary>
/// <param name="g"></param>
/// <param name="hti"></param>
/// <param name="bounds"></param>
/// <param name="x"></param>
/// <param name="y"></param>
protected void StandardHitTest(Graphics g, OlvListViewHitTestInfo hti, Rectangle bounds, int x, int y)
{
Rectangle r = bounds;
// Did they hit a check box?
int width = CalculateCheckBoxWidth(g);
Rectangle r2 = r;
r2.Width = width;
if (r2.Contains(x, y))
{
hti.HitTestLocation = HitTestLocation.CheckBox;
return;
}
// Did they hit the image? If they hit the image of a
// non-primary column that has a checkbox, it counts as a
// checkbox hit
r.X += width;
r.Width -= width;
width = CalculateImageWidth(g, GetImageSelector());
r2 = r;
r2.Width = width;
if (r2.Contains(x, y))
{
if (Column.Index > 0 && Column.CheckBoxes)
hti.HitTestLocation = HitTestLocation.CheckBox;
else
hti.HitTestLocation = HitTestLocation.Image;
return;
}
// Did they hit the text?
r.X += width;
r.Width -= width;
width = CalculateTextWidth(g, GetText());
r2 = r;
r2.Width = width;
if (r2.Contains(x, y))
{
hti.HitTestLocation = HitTestLocation.Text;
return;
}
hti.HitTestLocation = HitTestLocation.InCell;
}