but I want to display in a Panel. not making new form.
Programing.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using SFML;
using SFML.Audio;
using SFML.Window;
using SFML.Graphics;
namespace _01_AddingRibbonSupport
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Form1.cs
using System;
using System.Windows.Forms;
using RibbonLib;
using RibbonLib.Interop;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFML;
using SFML.Audio;
using SFML.Window;
using SFML.Graphics;
namespace _01_AddingRibbonSupport
{
public partial class Form1 : Form, IRibbonForm
{
public class DrawingSurface : System.Windows.Forms.Control
{
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
// don't call base.OnPaint(e) to prevent forground painting
// base.OnPaint(e);
}
protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)
{
// don't call base.OnPaintBackground(e) to prevent background painting
//base.OnPaintBackground(pevent);
}
}
private Ribbon _ribbon = new Ribbon();
public Form1()
{
InitializeComponent();
DrawingSurface rendersurface = new DrawingSurface(); // our control for SFML to draw on
rendersurface.Size = new System.Drawing.Size(400, 400); // set our SFML surface control size to be 500 width & 500 height
lblPlaceHolderDescription.Controls.Add(rendersurface); // add the SFML surface control to our form
rendersurface.Location = new System.Drawing.Point(100, 100); // center our control on the form
// initialize sfml
SFML.Graphics.RenderWindow renderwindow = new SFML.Graphics.RenderWindow(rendersurface.Handle); // creates our SFML RenderWindow on our surface control
// drawing loop
while (lblPlaceHolderDescription.Visible) // loop while the window is open
{
System.Windows.Forms.Application.DoEvents(); // handle form events
renderwindow.DispatchEvents(); // handle SFML events - NOTE this is still required when SFML is hosted in another window
renderwindow.Clear(SFML.Graphics.Color.Yellow); // clear our SFML RenderWindow
renderwindow.Display(); // display what SFML has drawn to the screen
}
}
#region IRibbonForm Members
public IntPtr WindowHandle
{
get
{
return this.Handle;
}
}
public void RibbonHeightUpdated(int newHeight)
{
this.splitContainer1.SplitterDistance = newHeight;
}
#endregion
private void Form1_Load(object sender, EventArgs e)
{
_ribbon.InitFramework(this);
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
_ribbon.DestroyFramework();
}
}
}
Thanks