本文整理汇总了C#中BrightIdeasSoftware.OlvListViewHitTestInfo类的典型用法代码示例。如果您正苦于以下问题:C# OlvListViewHitTestInfo类的具体用法?C# OlvListViewHitTestInfo怎么用?C# OlvListViewHitTestInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OlvListViewHitTestInfo类属于BrightIdeasSoftware命名空间,在下文中一共展示了OlvListViewHitTestInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:ToughBill,项目名称:NanCrm,代码行数:16,代码来源:ObjectGrid.cs
示例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;
}
开发者ID:TaleOfTwoWastelands,项目名称:ESPSharp-GUI,代码行数:13,代码来源:Renderers.cs
示例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;
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:37,代码来源:ObjectListView.cs
示例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);
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:14,代码来源:ObjectListView.cs
示例5: HandleHitTest
protected override void HandleHitTest(Graphics g, OlvListViewHitTestInfo hti, int x, int y)
{
if (Bounds.Contains(x, y))
hti.HitTestLocation = HitTestLocation.Text;
}
开发者ID:kaduardo,项目名称:cyberduck,代码行数:5,代码来源:Renderers.cs
示例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);
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:32,代码来源:ObjectListView.cs
示例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);
}
开发者ID:rxantos,项目名称:tesv-snip,代码行数:12,代码来源:Renderers.cs
示例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;
}
开发者ID:heliwave,项目名称:QuranCode,代码行数:53,代码来源:ObjectListView.cs
示例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);
}
}
开发者ID:Warpten,项目名称:ADBC2,代码行数:32,代码来源:TreeRenderer.cs
示例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);
}
}
开发者ID:rxantos,项目名称:tesv-snip,代码行数:27,代码来源:Renderers.cs
示例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);
}
开发者ID:ToughBill,项目名称:NanCrm,代码行数:14,代码来源:ObjectListView.cs
示例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;
}
开发者ID:soywiz,项目名称:cspspemu,代码行数:52,代码来源:Renderers.cs
示例13: OLVContextMenuClickArgs
public OLVContextMenuClickArgs(OlvListViewHitTestInfo hitInfo)
{
HitInfo = hitInfo;
}
开发者ID:ToughBill,项目名称:NanCrm,代码行数:4,代码来源:ObjectGrid.cs
示例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;
}
开发者ID:TaleOfTwoWastelands,项目名称:ESPSharp-GUI,代码行数:14,代码来源:Renderers.cs
示例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;
}
开发者ID:rxantos,项目名称:tesv-snip,代码行数:53,代码来源:Renderers.cs
示例16: 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;
// Match tweaking from renderer
if (this.ColumnIsPrimary && !(this is TreeListView.TreeRenderer)) {
r.X += 3;
r.Width -= 1;
}
r = ApplyCellPadding(r);
int width = 0;
// Did they hit a check box on the primary column?
if (this.ColumnIsPrimary && this.ListView.CheckBoxes) {
Rectangle r2 = this.CalculateCheckBoxBounds(g, r);
Rectangle r3 = r2;
r3.Inflate(2, 2); // slightly larger hit area
//g.DrawRectangle(Pens.DarkGreen, r3);
if (r3.Contains(x, y)) {
hti.HitTestLocation = HitTestLocation.CheckBox;
return;
}
width = r3.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());
Rectangle rTwo = r;
rTwo.Width = width;
//g.DrawRectangle(Pens.Red, rTwo);
if (rTwo.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());
rTwo = r;
rTwo.Width = width;
//g.DrawRectangle(Pens.Blue, rTwo);
if (rTwo.Contains(x, y)) {
hti.HitTestLocation = HitTestLocation.Text;
return;
}
hti.HitTestLocation = HitTestLocation.InCell;
}
开发者ID:vandro,项目名称:MVCVisualDesigner,代码行数:64,代码来源:Renderers.cs
示例17: 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)
{
this.ClearState();
this.ListView = hti.ListView;
this.ListItem = hti.Item;
this.SubItem = hti.SubItem;
this.Column = hti.Column;
this.RowObject = hti.RowObject;
this.IsItemSelected = this.ListItem.Selected && this.ListItem.Enabled;
if (this.SubItem == null)
this.Bounds = this.ListItem.Bounds;
else
this.Bounds = this.ListItem.GetSubItemBounds(this.Column.Index);
using (Graphics g = this.ListView.CreateGraphics()) {
this.HandleHitTest(g, hti, x, y);
}
}
开发者ID:TaleOfTwoWastelands,项目名称:ESPSharp-GUI,代码行数:25,代码来源:Renderers.cs
示例18: OlvHitTest
/// <summary>
/// What is under the given point? This takes the various parts of a cell into accout, including
/// any custom parts that a custom renderer might use
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns>An information block about what is under the point</returns>
public virtual OlvListViewHitTestInfo OlvHitTest(int x, int y)
{
ListViewHitTestInfo hitTestInfo = this.HitTest(x, y);
OlvListViewHitTestInfo hti = new OlvListViewHitTestInfo(hitTestInfo);
// There is a bug/"feature" of the ListView concerning hit testing.
// If FullRowSelect is false and the point is over cell 0 but not on
// the text or icon, HitTest will not register a hit. We could turn
// FullRowSelect on, do the HitTest, and then turn it off again, but
// toggling FullRowSelect in that way messes up the tooltip in the
// underlying control. So we have to find another way.
//
// It's too hard to try to write the hit test from scratch. Grouping (for
// example) makes it just too complicated. So, we have to use HitTest
// but try to get around its limits.
//
// First step is to determine if the point was within column 0.
// If it was, then we only have to determine if there is an actual row
// under the point. If there is, then we know that the point is over cell 0.
// So we try a Battleship-style approach: is there a subcell to the right
// of cell 0? This will return a false negative if column 0 is the rightmost column,
// so we also check for a subcell to the left. But if only column 0 is visible,
// then that will fail too, so we check for something at the very left of the
// control.
//
// This will still fail under pathological conditions. If column 0 fills
// the whole listview and no part of the text column 0 is visible
// (because it is horizontally scrolled offscreen), then the hit test will fail.
// Are we in the buggy context? Details view, not full row select, and
// failing to find anything
if (hitTestInfo.Item == null && !this.FullRowSelect && this.View == View.Details) {
// Is the point within the column 0? If it is, maybe it should have been a hit.
// Let's test slightly to the right and then to left of column 0. Hopefully one
// of those will hit a subitem
Point sides = NativeMethods.GetScrolledColumnSides(this, 0);
if (x >= sides.X && x <= sides.Y) {
// We look for:
// - any subitem to the right of cell 0?
// - any subitem to the left of cell 0?
// - cell 0 at the left edge of the screen
hitTestInfo = this.HitTest(sides.Y + 4, y);
if (hitTestInfo.Item == null)
hitTestInfo = this.HitTest(sides.X - 4, y);
if (hitTestInfo.Item == null)
hitTestInfo = this.HitTest(4, y);
if (hitTestInfo.Item != null) {
// We hit something! So, the original point must have been in cell 0
hti.Item = (OLVListItem)hitTestInfo.Item;
hti.SubItem = hti.Item.GetSubItem(0);
hti.Location = ListViewHitTestLocations.None;
hti.HitTestLocation = HitTestLocation.InCell;
}
}
}
if (this.OwnerDraw)
this.CalculateOwnerDrawnHitTest(hti, x, y);
else
this.CalculateStandardHitTest(hti, x, y);
return hti;
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:71,代码来源:ObjectListView.cs
示例19: CalculateStandardHitTest
/// <summary>
/// Perform a hit test when the control is not owner drawn
/// </summary>
/// <param name="hti"></param>
/// <param name="x"></param>
/// <param name="y"></param>
protected virtual void CalculateStandardHitTest(OlvListViewHitTestInfo hti, int x, int y)
{
// Standard hit test works fine for the primary column
if (this.View != View.Details || hti.ColumnIndex == 0 ||
hti.SubItem == null || hti.Column == null)
return;
Rectangle cellBounds = hti.SubItem.Bounds;
bool hasImage = (this.GetActualImageIndex(hti.SubItem.ImageSelector) != -1);
// Unless we say otherwise, it was an general incell hit
hti.HitTestLocation = HitTestLocation.InCell;
// Check if the point is over where an image should be.
// If there is a checkbox or image there, tag it and exit.
Rectangle r = cellBounds;
r.Width = this.SmallImageSize.Width;
if (r.Contains(x, y)) {
if (hti.Column.CheckBoxes) {
hti.HitTestLocation = HitTestLocation.CheckBox;
return;
}
if (hasImage) {
hti.HitTestLocation = HitTestLocation.Image;
return;
}
}
// Figure out where the text actually is and if the point is in it
// The standard HitTest assumes that any point inside a subitem is
// a hit on Text -- which is clearly not true.
Rectangle textBounds = cellBounds;
textBounds.X += 4;
if (hasImage)
textBounds.X += this.SmallImageSize.Width;
Size proposedSize = new Size(textBounds.Width, textBounds.Height);
Size textSize = TextRenderer.MeasureText(hti.SubItem.Text, this.Font, proposedSize, TextFormatFlags.EndEllipsis | TextFormatFlags.SingleLine | TextFormatFlags.NoPrefix);
textBounds.Width = textSize.Width;
switch (hti.Column.TextAlign) {
case HorizontalAlignment.Center:
textBounds.X += (cellBounds.Right - cellBounds.Left - textSize.Width) / 2;
break;
case HorizontalAlignment.Right:
textBounds.X = cellBounds.Right - textSize.Width;
break;
}
if (textBounds.Contains(x, y)) {
hti.HitTestLocation = HitTestLocation.Text;
}
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:58,代码来源:ObjectListView.cs
示例20: ProcessRButtonDoubleClick
/// <summary>
/// Handle a right mouse double click 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 ProcessRButtonDoubleClick(OlvListViewHitTestInfo hti)
{
// If the user double clicked on a checkbox, ignore it
return (hti.HitTestLocation == HitTestLocation.CheckBox);
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:11,代码来源:ObjectListView.cs
注:本文中的BrightIdeasSoftware.OlvListViewHitTestInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论