本文整理汇总了C#中ExposeEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ExposeEventArgs类的具体用法?C# ExposeEventArgs怎么用?C# ExposeEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExposeEventArgs类属于命名空间,在下文中一共展示了ExposeEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDrawingarea1ExposeEvent
protected void OnDrawingarea1ExposeEvent(object o, ExposeEventArgs args)
{
foreach (var rect in rects) {
args.Event.Window.DrawRectangle (Style.BlackGC, true, rect);
args.Event.Window.DrawRectangle (Style.WhiteGC, false, rect);
}
}
示例2: OnDrawingAreaExposed
void OnDrawingAreaExposed(object o, ExposeEventArgs args)
{
if (prevSize != Allocation.Size)
{
if (model != null)
treeMapModel = new TreeMapModel(model, Allocation.Width, Allocation.Height);
}
DrawingArea area = (DrawingArea)o;
Cairo.Context g = Gdk.CairoHelper.Create(area.GdkWindow);
if (treeMapModel != null)
{
foreach (var item in treeMapModel.Items)
{
double width = item.Rectangle.Width;
double height = item.Rectangle.Height;
double x1 = item.Rectangle.X;
double x2 = item.Rectangle.X + item.Rectangle.Width;
double y1 = item.Rectangle.Y;
double y2 = item.Rectangle.Y + item.Rectangle.Height;
PointD p1, p2, p3, p4;
p1 = new PointD(x1, y1);
p2 = new PointD(x2, y1);
p3 = new PointD(x2, y2);
p4 = new PointD(x1, y2);
g.MoveTo(p1);
g.LineTo(p2);
g.LineTo(p3);
g.LineTo(p4);
g.LineTo(p1);
g.ClosePath();
g.Save();
//using (Gradient pat = new LinearGradient(x1, y1, x2, y2))
using (Gradient pat = new RadialGradient(x1 + (x2 - x1) / 4.0, y1 + (y2 - y1) / 4.0, 3, x1 + (x2 - x1) / 4.0, y1 + (y2 - y1) / 4.0, Math.Sqrt(width*width + height*height)))
{
pat.AddColorStop(0, new Cairo.Color(1, 1, 1, 1));
pat.AddColorStop(1, new Cairo.Color(0, 0, 1, 1));
g.Pattern = pat;
// Fill the path with pattern
g.FillPreserve();
}
// We "undo" the pattern setting here
g.Restore();
g.Color = new Color(0, 0, 0, 0);
g.Stroke();
}
}
((IDisposable)g.Target).Dispose();
((IDisposable)g).Dispose();
}
示例3: HandleExposeEvent
public void HandleExposeEvent (object sender, ExposeEventArgs args)
{
if (fade_delay == null) {
fade_delay = new Delay (50, new GLib.IdleHandler (Update));
start = DateTime.Now;
fade_delay.Start ();
}
}
示例4: OnChildExposeEvent
private void OnChildExposeEvent(object o, ExposeEventArgs args)
{
if(interactive) {
InteractiveExpose((Widget)o, args.Event);
} else {
StaticExpose((Widget)o, args.Event);
}
}
示例5: RotatedTextExposeEvent
void RotatedTextExposeEvent (object sender, ExposeEventArgs a)
{
DrawingArea drawingArea = sender as DrawingArea;
int width = drawingArea.Allocation.Width;
int height = drawingArea.Allocation.Height;
double deviceRadius;
// Get the default renderer for the screen, and set it up for drawing
Gdk.PangoRenderer renderer = Gdk.PangoRenderer.GetDefault (drawingArea.Screen);
renderer.Drawable = drawingArea.GdkWindow;
renderer.Gc = drawingArea.Style.BlackGC;
// Set up a transformation matrix so that the user space coordinates for
// the centered square where we draw are [-RADIUS, RADIUS], [-RADIUS, RADIUS]
// We first center, then change the scale
deviceRadius = Math.Min (width, height) / 2;
Matrix matrix = Pango.Matrix.Identity;
matrix.Translate (deviceRadius + (width - 2 * deviceRadius) / 2, deviceRadius + (height - 2 * deviceRadius) / 2);
matrix.Scale (deviceRadius / RADIUS, deviceRadius / RADIUS);
// Create a PangoLayout, set the font and text
Context context = drawingArea.CreatePangoContext ();
Pango.Layout layout = new Pango.Layout (context);
layout.SetText ("Text");
FontDescription desc = FontDescription.FromString ("Sans Bold 27");
layout.FontDescription = desc;
// Draw the layout N_WORDS times in a circle
for (int i = 0; i < N_WORDS; i++)
{
Gdk.Color color = new Gdk.Color ();
Matrix rotatedMatrix = matrix;
int w, h;
double angle = (360 * i) / N_WORDS;
// Gradient from red at angle == 60 to blue at angle == 300
color.Red = (ushort) (65535 * (1 + Math.Cos ((angle - 60) * Math.PI / 180)) / 2);
color.Green = 0;
color.Blue = (ushort) (65535 - color.Red);
renderer.SetOverrideColor (RenderPart.Foreground, color);
rotatedMatrix.Rotate (angle);
context.Matrix = rotatedMatrix;
// Inform Pango to re-layout the text with the new transformation matrix
layout.ContextChanged ();
layout.GetSize (out w, out h);
renderer.DrawLayout (layout, - w / 2, (int) (- RADIUS * Pango.Scale.PangoScale));
}
// Clean up default renderer, since it is shared
renderer.SetOverrideColor (RenderPart.Foreground, Gdk.Color.Zero);
renderer.Drawable = null;
renderer.Gc = null;
}
示例6: da_ExposeEvent
/// <summary>
/// Handles ExposeEvents by obtaining a GC from the Gdk.Window
/// and copying the PlotSurface from the cache to the screen
/// </summary>
private void da_ExposeEvent(object o, ExposeEventArgs args)
{
Gdk.Rectangle area = args.Event.Area;
using (Graphics g = Gtk.DotNet.Graphics.FromDrawable (args.Event.Window)){
Rectangle bounds = new Rectangle (area.X, area.Y, area.Width, area.Height);
g.DrawImage (bitmap_cache, bounds, bounds, GraphicsUnit.Pixel);
}
args.RetVal = true;
}
示例7: ExposeEvent
static void ExposeEvent (object obj, ExposeEventArgs args) {
Gdk.Rectangle area = args.Event.Area;
args.Event.Window.DrawDrawable (darea.Style.ForegroundGC(darea.State),
pixmap,
area.X, area.Y,
area.X, area.Y,
area.Width, area.Height);
args.RetVal = false;
}
示例8: OnExposed
static void OnExposed (object o, ExposeEventArgs args)
{
if (current_frame == null)
return;
current_frame.RenderToDrawable (drawing_area.GdkWindow, drawing_area.Style.ForegroundGC (StateType.Normal),
0, 0,
0, 0,
-1, -1,
RgbDither.None, 0, 0);
}
示例9: HandleMyWinExposeEvent
void HandleMyWinExposeEvent(object o, ExposeEventArgs args)
{
GLib.Idle.Add (new GLib.IdleHandler (delegate() {
if (cr == null) {
Gtk.Widget widget = ((Gtk.Widget)o);
cr = Gdk.CairoHelper.Create (widget.GdkWindow);
}
WindowController.DrawPixbuf (cr, pixbuf);
return false;
}));
}
示例10: OnGraphEventBoxExposeEvent
protected void OnGraphEventBoxExposeEvent(object o, ExposeEventArgs args)
{
if (((DrawingArea)o).GdkWindow != null)
{
using(ImageSurface tmpSurface = new ImageSurface(Format.Rgb24, ((DrawingArea)o).Allocation.Width, ((DrawingArea)o).Allocation.Height))
using(GtkGraphDrawer drawer = new GtkGraphDrawer(Gdk.CairoHelper.Create(((DrawingArea)o).GdkWindow), new Context(tmpSurface), tmpSurface))
{
BaseGraph.DrawFullGraph (drawer);
}
}
}
示例11: OnExpose
void OnExpose(object sender, ExposeEventArgs args)
{
DrawingArea area = (DrawingArea)sender;
Cairo.Context cr = Gdk.CairoHelper.Create(area.GdkWindow);
int width = Allocation.Width;
int height = Allocation.Height;
cr.Translate(width / 2, height / 2);
//
{
cr.LineWidth = 3;
cr.LineCap = LineCap.Round;
const int MAX_ROT = 8;
for (int i = 0; i < MAX_ROT; i++)
{
cr.SetSourceRGBA(0, 0, 0, trs[count%MAX_ROT, i]);
cr.MoveTo(0.0, -10.0);
cr.LineTo(0.0, -40.0);
cr.Rotate(Math.PI / 4);
cr.Stroke();
}
}
// draw donut
{
//cr.SetSourceRGBA(0, 0, 0, 1);
cr.LineWidth = 0.5;
cr.Arc(0, 0, 120, 0, 2 * Math.PI);
cr.Stroke();
cr.Save();
const int MAX_ROT = 36;
for (int i = 0; i < MAX_ROT; i++)
{
//cr.SetSourceRGBA(0, 0, 0, 1);
cr.Rotate(i * Math.PI / MAX_ROT);
cr.Scale(0.3, 1);
cr.Arc(0, 0, 120, 0, 2 * Math.PI);
cr.Restore();
cr.Stroke();
cr.Save();
}
}
((IDisposable) cr.GetTarget()).Dispose();
((IDisposable) cr).Dispose();
}
示例12: ExposeEventCallback
// Expose callback for the drawing area
private void ExposeEventCallback (object o, ExposeEventArgs args)
{
EventExpose eventExpose = args.Event;
Gdk.Window window = eventExpose.Window;
Rectangle area = eventExpose.Area;
window.DrawRectangle (drawingArea.Style.BackgroundGC (StateType.Normal),
true,
area.X, area.Y,
area.Width, area.Height);
args.RetVal = true;
}
示例13: ExposeHandler
static void ExposeHandler (object obj, ExposeEventArgs args)
{
Gdk.EventExpose ev = args.Event;
Gdk.Window window = ev.Window;
using (Graphics g = Gtk.DotNet.Graphics.FromDrawable (window)){
g.TranslateTransform (ev.Area.X, ev.Area.Y);
using (Pen p = new Pen (Color.Red)){
g.DrawPie (p, 0, 0, rect.Width, rect.Height, 50, 90);
}
}
}
示例14: HandleExposeEvent
static void HandleExposeEvent (object sender, ExposeEventArgs expose_args)
{
Widget w = (Widget)sender;
using (Cairo.Context ctx = CompositeHelper.Create (w.GdkWindow)){
double opacity = 0;
ctx.Operator = Cairo.Operator.Source;
if (moon_host.Content is Moon.Windows.Desktop.Window)
opacity = ((Moon.Windows.Desktop.Window)moon_host.Content).WindowOpacity;
ctx.Color = new Cairo.Color (1.0, 1.0, 1.0, opacity);
CompositeHelper.Region (ctx, expose_args.Event.Region);
ctx.Fill ();
}
}
示例15: ExposeHandler
static void ExposeHandler (object o, ExposeEventArgs args)
{
Console.WriteLine ("exposed");
Widget widget = o as Widget;
//using (Cairo.Context cr = new Cairo.Context (surface)) {
cr.Save ();
cr.Rectangle (0, 0, widget.Allocation.Width, widget.Allocation.Height);
//cr.Color = new Color ( 1, 1, 1, 1);
Gdk.CairoHelper.SetSourceColor (cr, widget.Style.Background (widget.State));
cr.Fill ();
cr.Restore ();
cr.Save ();
cr.LineWidth = 1;
cr.MoveTo (10, 10);
cr.LineTo (20, 10);
cr.LineTo (20, 20);
cr.LineTo (10, 20);
cr.ClosePath ();
cr.Color = new Cairo.Color ( 0, 0, 0, 1);
cr.Fill ();
cr.Restore ();
//NDesk.Glitz.Context ctx = new NDesk.Glitz.Context (ggd, ggd.Format);
//Console.WriteLine (ggs.ValidTarget);
//Console.WriteLine ("proc ptr: " + ctx.GetProcAddress ("glBindProgramARB"));
//ctx.MakeCurrent (ggd);
//GlHelper.Draw ();
//GlHelper.DrawT ();
ggs.Flush ();
if (doublebuffer)
ggd.SwapBuffers ();
else
ggd.Flush ();
args.RetVal = true;
//args.RetVal = false;
//}
}