本文整理汇总了C#中System.Windows.Forms.DrawListViewColumnHeaderEventArgs.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DrawListViewColumnHeaderEventArgs.ToString方法的具体用法?C# DrawListViewColumnHeaderEventArgs.ToString怎么用?C# DrawListViewColumnHeaderEventArgs.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DrawListViewColumnHeaderEventArgs
的用法示例。
在下文中一共展示了DrawListViewColumnHeaderEventArgs.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WmNotify
private unsafe bool WmNotify(ref Message m) {
NativeMethods.NMHDR* nmhdr = (NativeMethods.NMHDR*)m.LParam;
// column header custom draw message handling
if (nmhdr->code == NativeMethods.NM_CUSTOMDRAW && OwnerDraw)
{
try
{
NativeMethods.NMCUSTOMDRAW* nmcd = (NativeMethods.NMCUSTOMDRAW*)m.LParam;
// Find out which stage we're drawing
switch (nmcd->dwDrawStage)
{
case NativeMethods.CDDS_PREPAINT:
{
m.Result = (IntPtr)(NativeMethods.CDRF_NOTIFYITEMDRAW);
return true; // we are done - don't do default handling
}
case NativeMethods.CDDS_ITEMPREPAINT:
{
Graphics g = Graphics.FromHdcInternal(nmcd->hdc);
Rectangle r = Rectangle.FromLTRB(nmcd->rc.left, nmcd->rc.top, nmcd->rc.right, nmcd->rc.bottom);
DrawListViewColumnHeaderEventArgs e = null;
try
{
Color foreColor = ColorTranslator.FromWin32(SafeNativeMethods.GetTextColor(new HandleRef(this, nmcd->hdc)));
Color backColor = ColorTranslator.FromWin32(SafeNativeMethods.GetBkColor(new HandleRef(this, nmcd->hdc)));
Font font = GetListHeaderFont();
e = new DrawListViewColumnHeaderEventArgs(g, r, (int)(nmcd->dwItemSpec),
columnHeaders[(int)nmcd->dwItemSpec],
(ListViewItemStates)(nmcd->uItemState),
foreColor, backColor, font);
OnDrawColumnHeader(e);
}
finally
{
g.Dispose();
}
if (e.DrawDefault)
{
m.Result = (IntPtr)(NativeMethods.CDRF_DODEFAULT);
return false;
}
else
{
m.Result = (IntPtr)(NativeMethods.CDRF_SKIPDEFAULT);
return true; // we are done - don't do default handling
}
}
default:
return false; //default handling
}
}
catch (Exception e)
{
Debug.Fail("Exception occurred attempting to setup header custom draw. Disabling custom draw for the column header", e.ToString());
m.Result = (IntPtr)NativeMethods.CDRF_DODEFAULT;
}
}
if (nmhdr->code == NativeMethods.NM_RELEASEDCAPTURE && listViewState[LISTVIEWSTATE_columnClicked]) {
listViewState[LISTVIEWSTATE_columnClicked] = false;
OnColumnClick(new ColumnClickEventArgs(columnIndex));
}
if (nmhdr->code == NativeMethods.HDN_BEGINTRACKA ||
nmhdr->code == NativeMethods.HDN_BEGINTRACKW) {
this.listViewState[LISTVIEWSTATE_headerControlTracking] = true;
// Reset our tracking information for the new BEGINTRACK cycle.
this.listViewState1[LISTVIEWSTATE1_cancelledColumnWidthChanging] = false;
this.newWidthForColumnWidthChangingCancelled = -1;
this.listViewState1[LISTVIEWSTATE1_cancelledColumnWidthChanging] = false;
NativeMethods.NMHEADER nmheader = (NativeMethods.NMHEADER) m.GetLParam(typeof(NativeMethods.NMHEADER));
if (this.columnHeaders != null && this.columnHeaders.Length > nmheader.iItem) {
this.columnHeaderClicked = this.columnHeaders[nmheader.iItem];
this.columnHeaderClickedWidth = this.columnHeaderClicked.Width;
} else {
this.columnHeaderClickedWidth = -1;
this.columnHeaderClicked = null;
}
}
if (nmhdr->code == NativeMethods.HDN_ITEMCHANGINGA ||
nmhdr->code == NativeMethods.HDN_ITEMCHANGINGW) {
NativeMethods.NMHEADER nmheader = (NativeMethods.NMHEADER) m.GetLParam(typeof(NativeMethods.NMHEADER));
if (columnHeaders != null && nmheader.iItem < columnHeaders.Length &&
(this.listViewState[LISTVIEWSTATE_headerControlTracking] || this.listViewState[LISTVIEWSTATE_headerDividerDblClick])) {
// SECREVIEW:
// UnsafeNativeMethods.PtrToStructure asserts ReflectionPermission.
// We are fine asserting this permission because the HDITEM2 type is our type and we have control over it
// and over what it does in its constructor.
//.........这里部分代码省略.........