本文整理汇总了C#中Gdk.Rectangle.Offset方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.Rectangle.Offset方法的具体用法?C# Gdk.Rectangle.Offset怎么用?C# Gdk.Rectangle.Offset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk.Rectangle
的用法示例。
在下文中一共展示了Gdk.Rectangle.Offset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDrawingareaExposeEvent
protected void OnDrawingareaExposeEvent(object o, Gtk.ExposeEventArgs args)
{
Gdk.EventExpose expose = args.Args[0] as Gdk.EventExpose;
Gdk.Window win = expose.Window;
int width, height;
win.GetSize(out width, out height);
Gdk.Rectangle exposeRect = expose.Area;
bool fulldraw = width == exposeRect.Width && height == exposeRect.Height;
win.DrawRectangle(Style.LightGC(StateType.Normal), true, exposeRect);
if (GetContentDelegate == null)
return; // todo: an error message could be displayed
int offset = (int)vscrollbar1.Value;
if (fulldraw)
{
TopVisibleRow = offset;
BottomVisibleRow = offset;
}
if (ConstantHeight == 0)
{
DetermineLayout();
if (ConstantHeight == 0)
return; // should never happen
}
int maxHScrollRange = 0;
int dy = exposeRect.Top;
offset += dy / ConstantHeight;
dy -= dy % ConstantHeight;
Gdk.GC background = new Gdk.GC((Gdk.Drawable)base.GdkWindow);
Gdk.GC text = new Gdk.GC((Gdk.Drawable)base.GdkWindow);
ColumnControl.Column[] columns = mColumnControl.GetVisibleColumnsInDrawOrder();
for (int row = offset; row < RowCount; row++)
{
int dx = -(int)hscrollbar1.Value;
Gdk.Rectangle rect = new Gdk.Rectangle(dx, dy, 0, ConstantHeight);
System.Drawing.Color backColor = System.Drawing.Color.WhiteSmoke;
System.Drawing.Color textColor = System.Drawing.Color.Black;
if (row == CurrentRow)
backColor = System.Drawing.Color.DarkGray;
else if (m_Selection.Contains(row))
backColor = System.Drawing.Color.LightGray;
else if (GetColorDelegate != null)
GetColorDelegate(row, ref backColor, ref textColor);
background.RgbFgColor = new Gdk.Color(backColor.R, backColor.G, backColor.B);
text.RgbFgColor = new Gdk.Color(textColor.R, textColor.G, textColor.B);
int totalwidth = 0;
for (int c = 0; c < columns.Length; c++)
{
ColumnControl.Column column = columns[c];
int columnIndex = column.SortOrder;
int xwidth = column.Width;
rect = new Gdk.Rectangle(rect.Left, rect.Top, xwidth + mColumnControl.GripperWidth, ConstantHeight);
if (c == columns.Length - 1)
rect.Width = Math.Max(rect.Width, exposeRect.Right - rect.Left + 1);
object content = GetContentDelegate(row, columnIndex);
if (content is Gdk.Pixbuf)
{
Gdk.Pixbuf image = (Gdk.Pixbuf)content;
win.DrawRectangle(background, true, rect);
dx += 2;
image.RenderToDrawable(win, text, 0, 0, dx, dy, image.Width, image.Height, Gdk.RgbDither.Normal, 0, 0);
dx += xwidth + mColumnControl.GripperWidth - 2;
rect.Offset(xwidth + mColumnControl.GripperWidth, 0);
totalwidth += 2 + rect.Width;
}
else
{
column.LineLayout.SetText(content.ToString());
win.DrawRectangle(background, true, rect);
dx += 2;
win.DrawLayout(text, dx, dy, column.LineLayout);
dx += xwidth + mColumnControl.GripperWidth - 2;
rect.Offset(xwidth + mColumnControl.GripperWidth, 0);
int dwidth, dheight;
column.LineLayout.GetPixelSize(out dwidth, out dheight);
totalwidth += 2 + mColumnControl.GripperWidth + dwidth;
}
}
maxHScrollRange = Math.Max(maxHScrollRange, totalwidth);
dy += ConstantHeight;
if (dy > exposeRect.Bottom)
break;
if (fulldraw && exposeRect.Height - dy >= ConstantHeight)
BottomVisibleRow++;
}
if (fulldraw)
{
//.........这里部分代码省略.........