本文整理汇总了C#中Gtk.DrawingArea类的典型用法代码示例。如果您正苦于以下问题:C# DrawingArea类的具体用法?C# DrawingArea怎么用?C# DrawingArea使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DrawingArea类属于Gtk命名空间,在下文中一共展示了DrawingArea类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DemoColorSelection
public DemoColorSelection () : base ("Color Selection")
{
BorderWidth = 8;
VBox vbox = new VBox (false,8);
vbox.BorderWidth = 8;
Add (vbox);
// Create the color swatch area
Frame frame = new Frame ();
frame.ShadowType = ShadowType.In;
vbox.PackStart (frame, true, true, 0);
drawingArea = new DrawingArea ();
drawingArea.ExposeEvent += new ExposeEventHandler (ExposeEventCallback);
// set a minimum size
drawingArea.SetSizeRequest (200,200);
// set the color
color = new Gdk.Color (0, 0, 0xff);
drawingArea.ModifyBg (StateType.Normal, color);
frame.Add (drawingArea);
Alignment alignment = new Alignment (1.0f, 0.5f, 0.0f, 0.0f);
Button button = new Button ("_Change the above color");
button.Clicked += new EventHandler (ChangeColorCallback);
alignment.Add (button);
vbox.PackStart (alignment);
ShowAll ();
}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:29,代码来源:DemoColorSelection.cs
示例2: Render
public void Render(DrawingArea area, SettingsModel settings)
{
var width = area.Allocation.Width;
var height = area.Allocation.Height;
var kaleidoscope = _factory.Get (settings.Type);
var rootNode = kaleidoscope.Generate (
settings.GeometyWidth,
settings.ImageUri,
width, height);
ImageSurface surface = new ImageSurface(Format.Argb32, width, height);
using (var context = new Context (surface)) {
context.Translate(width / 2, height / 2);
rootNode.Render (context);
}
rootNode.Geometry.Dispose ();
using (Context context = Gdk.CairoHelper.Create (area.GdkWindow)) {
context.Rectangle(0, 0, width, height);
context.SetSource(surface);
context.Fill();
context.GetTarget ().Dispose ();
}
surface.Dispose ();
}
开发者ID:imagineblueeyes,项目名称:KaleidoscopeGenerator,代码行数:27,代码来源:CairoRenderer.cs
示例3: InteractivePlotSurface2D
private bool coordsActive_ = true; // Shows X,Y in Tooltip
#endregion Fields
#region Constructors
/// <summary>
/// Default Constructor
/// </summary>
public InteractivePlotSurface2D()
: base()
{
canvas = new DrawingArea (); // allocate local DrawingArea
canvas.CanFocus = true; // enable to receive the focus
// Link the event handlers into the DrawingArea events (default is none)
canvas.SizeAllocated += new SizeAllocatedHandler (SizeAllocated);
canvas.ExposeEvent += new ExposeEventHandler (ExposeEvent);
canvas.EnterNotifyEvent += new EnterNotifyEventHandler (EnterNotify);
canvas.LeaveNotifyEvent += new LeaveNotifyEventHandler (LeaveNotify);
canvas.ButtonPressEvent += new ButtonPressEventHandler (ButtonPress);
canvas.MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotify);
canvas.ButtonReleaseEvent += new ButtonReleaseEventHandler (ButtonRelease);
canvas.ScrollEvent += new ScrollEventHandler (ScrollNotify);
canvas.KeyPressEvent += new KeyPressEventHandler (KeyPressed);
canvas.KeyReleaseEvent += new KeyReleaseEventHandler (KeyReleased);
// Subscribe to DrawingArea mouse movement and button press events.
// Enter and Leave notification is necessary to make ToolTips work.
// Specify PointerMotionHint to prevent being deluged with motion events.
canvas.AddEvents ((int)Gdk.EventMask.EnterNotifyMask);
canvas.AddEvents ((int)Gdk.EventMask.LeaveNotifyMask);
canvas.AddEvents ((int)Gdk.EventMask.ButtonPressMask);
canvas.AddEvents ((int)Gdk.EventMask.ButtonReleaseMask);
canvas.AddEvents ((int)Gdk.EventMask.PointerMotionMask);
canvas.AddEvents ((int)Gdk.EventMask.PointerMotionHintMask);
canvas.AddEvents ((int)Gdk.EventMask.ScrollMask);
canvas.SetSizeRequest (400, 300); // Set DrawingArea size
// Set up ToolTips to show coordinates. NB works via Enter/Leave events
// TODO: ToolTips do not work well yet - needs review of approach
this.Canvas.TooltipText = "Coordinates will display here";
}
开发者ID:sanyu1,项目名称:NPlot,代码行数:44,代码来源:Gtk.InteractivePlotSurface2D.cs
示例4: DemoColorSelection
public DemoColorSelection () : base ("Color Selection")
{
BorderWidth = 8;
VBox vbox = new VBox (false,8);
vbox.BorderWidth = 8;
Add (vbox);
// Create the color swatch area
Frame frame = new Frame ();
frame.ShadowType = ShadowType.In;
vbox.PackStart (frame, true, true, 0);
drawingArea = new DrawingArea ();
// set a minimum size
drawingArea.SetSizeRequest (200,200);
// set the color
color.Red = 0;
color.Green = 0;
color.Blue = 1;
color.Alpha = 1;
drawingArea.OverrideBackgroundColor (StateFlags.Normal, color);
frame.Add (drawingArea);
Alignment alignment = new Alignment (1.0f, 0.5f, 0.0f, 0.0f);
Button button = new Button ("_Change the above color");
button.Clicked += new EventHandler (ChangeColorCallback);
alignment.Add (button);
vbox.PackStart (alignment, false, false, 0);
ShowAll ();
}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:31,代码来源:DemoColorSelection.cs
示例5: GetDisplayWidget
public override Gtk.Widget GetDisplayWidget()
{
DrawingArea colorPreview = new DrawingArea ();
colorPreview.ModifyBg(StateType.Normal, GetColor ());
colorPreview.WidthRequest = 15;
Alignment colorPreviewAlign = new Alignment (0, 0, 0, 1);
colorPreviewAlign.SetPadding (2, 2, 2, 2);
colorPreviewAlign.Add (colorPreview);
string labelText;
System.Drawing.Color color = (System.Drawing.Color) parentRow.PropertyValue;
//TODO: dropdown known color selector so this does something
if (color.IsKnownColor)
labelText = color.Name;
else if (color.IsEmpty)
labelText = "[empty]";
else
labelText = String.Format("#{0:x2}{1:x2}{2:x2}", color.R, color.G, color.B);
//we use StringValue as it auto-bolds the text for non-default values
Label theLabel = (Label) base.StringValue (labelText);
theLabel.Xalign = 0;
theLabel.Xpad = 3;
HBox hbox = new HBox ();
hbox.PackStart (colorPreviewAlign, false, false, 0);
hbox.PackStart (theLabel, true, true, 0);
return hbox;
}
开发者ID:mono,项目名称:aspeditor,代码行数:33,代码来源:ColorEditor.cs
示例6: OnMouseDown
protected override void OnMouseDown (DrawingArea canvas, ButtonPressEventArgs args, Cairo.PointD point)
{
// Ignore extra button clicks while drawing
if (is_drawing)
return;
Document doc = PintaCore.Workspace.ActiveDocument;
hist = new SelectionHistoryItem(Icon, Name);
hist.TakeSnapshot();
reset_origin = args.Event.GetPoint();
active_control = HandleResize (point);
if (!active_control.HasValue)
{
combine_mode = PintaCore.Workspace.SelectionHandler.DetermineCombineMode(args);
double x = Utility.Clamp(point.X, 0, doc.ImageSize.Width - 1);
double y = Utility.Clamp(point.Y, 0, doc.ImageSize.Height - 1);
shape_origin = new PointD(x, y);
doc.PreviousSelection.Dispose ();
doc.PreviousSelection = doc.Selection.Clone();
doc.Selection.SelectionPolygons.Clear();
// The bottom right corner should be selected.
active_control = 3;
}
is_drawing = true;
}
开发者ID:msiyer,项目名称:Pinta,代码行数:31,代码来源:SelectTool.cs
示例7: BuildInterface
private void BuildInterface()
{
VBox vbox = this.Child as VBox;
HButtonBox buttonBox = new HButtonBox ();
drawingArea = new DrawingArea ();
drawingArea.SetSizeRequest (640, 480);
captureButton = new Button ("Capture");
previewButton = new Button ("Preview");
previewButton.Sensitive = false;
saveButton = new Button ("Save");
saveButton.Sensitive = false;
cancelButton = new Button ("Cancel");
buttonBox.PackStart (captureButton);
buttonBox.PackStart (previewButton);
buttonBox.PackStart (saveButton);
buttonBox.PackStart (cancelButton);
buttonBox.LayoutStyle = ButtonBoxStyle.Center;
vbox.PackStart (drawingArea);
vbox.PackStart (buttonBox, false, true, 8);
this.ShowAll ();
this.DeleteEvent += new DeleteEventHandler(OnDelete);
captureButton.Clicked += new EventHandler (CaptureButtonClicked);
previewButton.Clicked += new EventHandler(PreviewButtonClicked);
saveButton.Clicked += new EventHandler (SaveButtonClicked);
cancelButton.Clicked += new EventHandler (CancelButtonClicked);
}
开发者ID:tanya-guza,项目名称:facecon,代码行数:31,代码来源:PhotoEditorWindow.cs
示例8: GlToggleButton
public GlToggleButton(GdkGL.Config config)
{
// VBox.
VBox vbox = new VBox (false, 0);
vbox.BorderWidth = 10;
// Drawing area for drawing OpenGL scene.
DrawingArea drawing_area = new DrawingArea ();
drawing_area.SetSizeRequest (200, 200);
// Set OpenGL-capability to the widget.
m_gl = new GlWidget (drawing_area, config);
drawing_area.Realized += new EventHandler (Realize);
drawing_area.ConfigureEvent += new ConfigureEventHandler (Configure);
drawing_area.ExposeEvent += new ExposeEventHandler (Expose);
drawing_area.Unrealized += new EventHandler (Unrealize);
drawing_area.VisibilityNotifyEvent += new VisibilityNotifyEventHandler (VisibilityNotify);
vbox.PackStart (drawing_area, true, true, 0);
drawing_area.Show ();
// Label.
Label label = new Label ("Toggle Animation");
vbox.PackStart (label, false, false, 10);
label.Show ();
Toggled += new EventHandler (ToggleAnimation);
// Add VBox.
vbox.Show ();
Add (vbox);
}
开发者ID:GNOME,项目名称:gtkglext-sharp,代码行数:32,代码来源:button.cs
示例9: EditPlayer
public override void EditPlayer(Text text)
{
playerText = text;
if (playerDialog == null) {
Gtk.Dialog d = new Gtk.Dialog (Catalog.GetString ("Select player"),
this, DialogFlags.Modal | DialogFlags.DestroyWithParent,
Stock.Cancel, ResponseType.Cancel);
d.WidthRequest = 600;
d.HeightRequest = 400;
DrawingArea da = new DrawingArea ();
TeamTagger tagger = new TeamTagger (new WidgetWrapper (da));
tagger.ShowSubstitutionButtons = false;
tagger.LoadTeams ((ViewModel.Project as ProjectLongoMatch).LocalTeamTemplate, (ViewModel.Project as ProjectLongoMatch).VisitorTeamTemplate,
(ViewModel.Project as ProjectLongoMatch).Dashboard.FieldBackground);
tagger.PlayersSelectionChangedEvent += players => {
if (players.Count == 1) {
Player p = players [0];
playerText.Value = p.ToString ();
d.Respond (ResponseType.Ok);
}
tagger.ResetSelection ();
};
d.VBox.PackStart (da, true, true, 0);
d.ShowAll ();
playerDialog = d;
}
if (playerDialog.Run () != (int)ResponseType.Ok) {
text.Value = null;
}
playerDialog.Hide ();
}
开发者ID:LongoMatch,项目名称:longomatch,代码行数:32,代码来源:SportDrawingTool.cs
示例10: PlainSurfaceItem
public PlainSurfaceItem(int maxWidth, int maxHeight, int widthRequest = 0, int heightRequest = 0, string label = null)
{
//Console.WriteLine ("PlainSurfaceItem");
_label = label;
this._evtBox = new EventBox ();
this._draw = new global::Gtk.DrawingArea ();
if(widthRequest > 0) {
_draw.WidthRequest = widthRequest;
}
if(heightRequest > 0) {
_draw.HeightRequest = heightRequest;
}
this._evtBox.Add (this._draw);
maxWidth = Math.Max (maxWidth, widthRequest);
maxHeight = Math.Max (maxHeight, heightRequest);
this._height = Math.Max(_draw.Allocation.Height, heightRequest);
this._width = Math.Max(_draw.Allocation.Width, widthRequest);
this._mode = DisplayMode.Snapshot;
this._surface = new ImageSurface(Format.Argb32, maxWidth, maxHeight);
this._button = MouseButton.None;
this._background = new Color (1.0, 1.0, 1.0);
_draw.ExposeEvent += DrawExpose;
_evtBox.ButtonPressEvent += DrawButtonPressEvent;
_evtBox.ButtonReleaseEvent += DrawButtonReleaseEvent;
_evtBox.MotionNotifyEvent += DrawMotionNotifyEvent;
}
开发者ID:codingcave,项目名称:CoupledOdeViewer,代码行数:29,代码来源:PlainSurfaceItem.cs
示例11: Main15
//private static Gdk.Pixmap pixmap = null;
//private static Gtk.InputDialog inputDialog = null;
public static int Main15 (string[] args) {
Application.Init ();
win = new Gtk.Window ("Scribble XInput Demo");
win.DeleteEvent += new DeleteEventHandler (WindowDelete);
vBox = new VBox (false, 0);
win.Add (vBox);
darea = new Gtk.DrawingArea ();
darea.SetSizeRequest (200, 200);
// darea.ExtensionEvents=ExtensionMode.Cursor;
vBox.PackStart (darea, true, true, 0);
//darea.ExposeEvent += new ExposeEventHandler (ExposeEvent);
darea.ConfigureEvent += new ConfigureEventHandler (ConfigureEvent);
darea.MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotifyEvent);
darea.ButtonPressEvent += new ButtonPressEventHandler (ButtonPressEvent);
darea.Events = EventMask.ExposureMask | EventMask.LeaveNotifyMask |
EventMask.ButtonPressMask | EventMask.PointerMotionMask;
inputButton = new Button("Input Dialog");
vBox.PackStart (inputButton, false, false, 0);
inputButton.Clicked += new EventHandler (InputButtonClicked);
quitButton = new Button("Quit");
vBox.PackStart (quitButton, false, false, 0);
quitButton.Clicked += new EventHandler (QuitButtonClicked);
win.ShowAll ();
Application.Run ();
return 0;
}
开发者ID:akrisiun,项目名称:gtk-sharp,代码行数:37,代码来源:ScribbleXInput.cs
示例12: BoardRenderer
public BoardRenderer(Gtk.DrawingArea area, int width, int height, int fieldSize)
{
area.SetSizeRequest (width * fieldSize, height * fieldSize);
this.area = area;
this.width = width;
this.height = height;
this.fieldSize = fieldSize;
}
开发者ID:Teyras,项目名称:Bounce,代码行数:8,代码来源:BoardRenderer.cs
示例13: WorkspaceService
public WorkspaceService(Gtk.Bin mainWindow, DrawingArea designArea,DrawingArea previewArea, PropertyGrid.PropertyGrid propertyGrid,Gtk.Label statusLabel)
{
this.designArea = designArea;
this.previewArea = previewArea;
this.propertyGrid = propertyGrid;
this.mainControl = mainWindow;
this.StatusLabel = statusLabel;
}
开发者ID:elsupergomez,项目名称:monoreports,代码行数:8,代码来源:WorkspaceService.cs
示例14: OnMouseDown
protected override void OnMouseDown(DrawingArea canvas, ButtonPressEventArgs args, Cairo.PointD point)
{
shape_origin = point;
is_drawing = true;
hist = new SelectionHistoryItem (Icon, Name);
hist.TakeSnapshot ();
}
开发者ID:joehillen,项目名称:Pinta,代码行数:8,代码来源:SelectTool.cs
示例15: MainWindow_Widget2
public MainWindow_Widget2()
: base("Widget2")
{
SetDefaultSize(800, 600);
SetPosition(WindowPosition.Center);
BorderWidth = 7;
DeleteEvent += delegate
{
Application.Quit();
};
_label = new Label("...");
Entry entry = new Entry();
entry.Changed += OnChangedEntry;
// scale and image
HScale scale = new HScale(0, 100, 1);
{
scale.SetSizeRequest(160, 35);
scale.ValueChanged += OnChangeScale;
LoadImage();
_image = new Image(img1);
}
// Color
ToggleButton red = new ToggleButton("red");
{
red.SetSizeRequest(80, 35);
red.Clicked += OnRed;
_area = new DrawingArea();
_area.SetSizeRequest(150, 150);
}
Calendar calendar = new Calendar();
{
calendar.DaySelected += OnDaySelected;
}
Fixed fix = new Fixed();
fix.Put(entry, 60, 100);
fix.Put(_label, 60, 40);
fix.Put(scale, 60, 200);
fix.Put(_image, 10, 240);
fix.Put(red, 300, 250);
fix.Put(_area, 300, 500);
fix.Put(calendar, 500, 300);
Add(fix);
ShowAll();
}
开发者ID:oraora81,项目名称:NOCmono,代码行数:56,代码来源:MainWindow_Widget2.cs
示例16: Circuit
private Cell firstLinkingCell; // premiere cellule à lier à une deuxième
#endregion Fields
#region Constructors
// Constructeur
public Circuit(DrawingArea drawingAera, Label cellCount)
{
cells = new List<Cell>();
ios = new List<InOut>();
color = new Colors();
this.drawingAera = drawingAera;
this.cellCount = cellCount;
showLayer = new bool[] {true, true};
updateStatusBarCellCount();
draw();
}
开发者ID:macbernick,项目名称:celltronix,代码行数:18,代码来源:Circuit.cs
示例17: AdjustWindowSize
public static void AdjustWindowSize(HuffLibrary.Tree HTree, DrawingArea Canvas)
{
int ImageWidth, ImageHeight;
Canvas.SetSizeRequest (0, 0);
//Reduce window size in case our tree is small
GetAreaSize (HTree.GetRootNode (), out ImageWidth, out ImageHeight, cellsize);
int width, height;
Canvas.GdkWindow.GetSize (out width, out height);
Canvas.SetSizeRequest (ImageWidth, ImageHeight);
if (height > ImageHeight)
Canvas.GdkWindow.Resize (width, ImageHeight);
}
开发者ID:astarasikov,项目名称:HuffmanArchiver,代码行数:12,代码来源:TreeGraphics.cs
示例18: OnMouseDown
protected override void OnMouseDown(DrawingArea canvas, ButtonPressEventArgs args, Cairo.PointD point)
{
// Ignore extra button clicks while drawing
if (is_drawing)
return;
shape_origin = point;
is_drawing = true;
hist = new SelectionHistoryItem (Icon, Name);
hist.TakeSnapshot ();
}
开发者ID:RodH257,项目名称:Pinta,代码行数:12,代码来源:SelectTool.cs
示例19: DemoDrawingArea
public DemoDrawingArea () : base ("Drawing Area")
{
BorderWidth = 8;
VBox vbox = new VBox (false, 8);
vbox.BorderWidth = 8;
Add (vbox);
// Create the checkerboard area
Label label = new Label ("<u>Checkerboard pattern</u>");
label.UseMarkup = true;
vbox.PackStart (label, false, false, 0);
Frame frame = new Frame ();
frame.ShadowType = ShadowType.In;
vbox.PackStart (frame, true, true, 0);
DrawingArea da = new DrawingArea ();
// set a minimum size
da.SetSizeRequest (100,100);
frame.Add (da);
da.ExposeEvent += new ExposeEventHandler (CheckerboardExpose);
// Create the scribble area
label = new Label ("<u>Scribble area</u>");
label.UseMarkup = true;
vbox.PackStart (label, false, false, 0);
frame = new Frame ();
frame.ShadowType = ShadowType.In;
vbox.PackStart (frame, true, true, 0);
da = new DrawingArea ();
// set a minimum size
da.SetSizeRequest (100, 100);
frame.Add (da);
// Signals used to handle backing pixmap
da.ExposeEvent += new ExposeEventHandler (ScribbleExpose);
da.ConfigureEvent += new ConfigureEventHandler (ScribbleConfigure);
// Event signals
da.MotionNotifyEvent += new MotionNotifyEventHandler (ScribbleMotionNotify);
da.ButtonPressEvent += new ButtonPressEventHandler (ScribbleButtonPress);
// Ask to receive events the drawing area doesn't normally
// subscribe to
da.Events |= EventMask.LeaveNotifyMask | EventMask.ButtonPressMask |
EventMask.PointerMotionMask | EventMask.PointerMotionHintMask;
ShowAll ();
}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:53,代码来源:DemoDrawingArea.cs
示例20: VideoView
public VideoView()
{
preview_pos = PreviewPos.ButtonRight;
VBox vbox = new VBox(false, 0);
vbox.Show();
Frame frame = new Frame();
//frame.BorderWidth = 5;
frame.Show();
vbox.Add(frame);
mainView = new Gtk.EventBox();
mainView.WidthRequest = 400;
mainView.HeightRequest = 300;
mainView.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255,255,255));
mainView.ModifyBg (Gtk.StateType.Active, new Gdk.Color (255,255,255));
mainView.Show();
//this.WidthRequest = 333; // 500; //250;
//this.HeightRequest = 250; // 375; //187; 250
preview = new Gtk.DrawingArea ();
preview.WidthRequest = 120; // 75; //150;
preview.HeightRequest = 90; // 56; //112;
preview.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0,0,0));
preview.ModifyBg (Gtk.StateType.Active, new Gdk.Color (0,0,0));
preview.Show();
fix = new Gtk.Fixed ();
fix.Put (preview, space, space);
fix.Show();
mainView.Add(fix);
frame.Add(mainView);
// Label label = new Label(Catalog.GetString("Video Chat in progress..."));
// label.Show();
// vbox.PackStart(label, false, true, 0);
Button button = new Button(Catalog.GetString("End Call"));
button.Clicked += OnCloseVideoClicked;
button.Show();
vbox.PackStart(button, false, false, 5);
this.Add(vbox);
mainView.SizeAllocated += OnSizeAllocated;
// this.SizeRequested += OnsizeRequested;
this.QueueResize ();
MovePreview ();
}
开发者ID:GNOME,项目名称:banter,代码行数:52,代码来源:VideoView.cs
注:本文中的Gtk.DrawingArea类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论