public static void Main(string[] args) { Application.Init(); var win = new Window(WindowType.Toplevel) { Title = "SkiaSharp on .NET Core with GTK#", WindowPosition = WindowPosition.CenterOnParent, DefaultWidth = 640, DefaultHeight = 480, }; win.DeleteEvent += OnDeleteEvent; var skiaView = new SKWidget(); skiaView.PaintSurface += OnPaintSurface; win.Add(skiaView); win.Child.ShowAll(); win.Show(); Application.Run(); }
void Init() { _mainBox = new VBox(); _headerBox = new HBox(); _widthLabel = new Label("Width:"); _widthLabel.SetPadding(6, 0); _widthEntry = new Entry { WidthRequest = 60 }; _heightLabel = new Label("Height:"); _heightLabel.SetPadding(6, 0); _heightEntry = new Entry { WidthRequest = 60 }; _contentBox = new HPaned(); _codeFrame = new Frame { BorderWidth = 1 }; _codeBox = new VBox(); _codeLabel = new Label("Code"); _textEditor = TextEditorFactory.CreateNewEditor(); _textEditor.MimeType = "text/x-csharp"; _outputFrame = new Frame { BorderWidth = 1, WidthRequest = 512 }; _outputBox = new VBox(); _outputLabel = new Label("Output"); _skWidget = new SKWidget(); _messagesFrame = new Frame { BorderWidth = 1 }; _messagesBox = new VBox(); _messagesLabel = new Label("Messages"); _messagesView = new TreeView { HeadersVisible = true, HeightRequest = 60, WidthRequest = 400 }; _messagesView.RulesHint = true; _messagesView.Selection.Mode = Gtk.SelectionMode.Single; _messagesView.AppendColumn("Line", new CellRendererText(), "text", 0); _messagesView.AppendColumn("Message", new CellRendererText(), "text", 1); _messagesStore = new ListStore(typeof(string), typeof(string)); _messagesView.Model = _messagesStore; var xwtMainBox = Xwt.Toolkit.CurrentEngine.WrapWidget(_mainBox); _control = new XwtControl(xwtMainBox); }