Hi,
I cannot figure out how to display an image on the ToolWindow tab. This does not display the image on the tool window :
Thanks.
I cannot figure out how to display an image on the ToolWindow tab. This does not display the image on the tool window :
| using System; |
| using System.Collections.Generic; |
| using System.Linq; |
| using System.Windows.Forms; |
| using Telerik.WinControls.UI; |
| using Telerik.WinControls.UI.Docking; |
| using System.Drawing; |
| namespace toolWindowTest |
| { |
| static class Program |
| { |
| /// <summary> |
| /// Point d'entrée principal de l'application. |
| /// </summary> |
| [STAThread] |
| static void Main() |
| { |
| Application.EnableVisualStyles(); |
| Application.SetCompatibleTextRenderingDefault(false); |
| Application.Run(new MainForm()); |
| } |
| } |
| public partial class MainForm : RadForm { |
| public MainForm() { |
| InitializeComponent(); |
| IsMdiContainer = true; |
| radDock.AutoDetectMdiChildren = true; |
| } |
| Bitmap bitmap; |
| protected override void OnCreateControl() { |
| base.OnCreateControl(); |
| bitmap = new Bitmap(16, 16); |
| DrawToBitmap(bitmap, new Rectangle(0, 0, 16, 16)); |
| Clipboard.SetImage(bitmap); |
| } |
| private void radButton_Click(object sender, EventArgs e) { |
| ToolWindow toolWindow = new ToolWindow(); |
| toolWindow.Image = bitmap; |
| radDock.DockControl(new ToolWindow(), DockPosition.Right, DockType.ToolWindow); |
| } |
| } |
| partial class MainForm { |
| /// <summary> |
| /// Required designer variable. |
| /// </summary> |
| private System.ComponentModel.IContainer components = null; |
| /// <summary> |
| /// Clean up any resources being used. |
| /// </summary> |
| /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
| protected override void Dispose(bool disposing) { |
| if (disposing && (components != null)) { |
| components.Dispose(); |
| } |
| base.Dispose(disposing); |
| } |
| private void InitializeComponent() { |
| this.radDock = new Telerik.WinControls.UI.Docking.RadDock(); |
| this.documentContainer1 = new Telerik.WinControls.UI.Docking.DocumentContainer(); |
| this.radPanel = new Telerik.WinControls.UI.RadPanel(); |
| this.radButton = new Telerik.WinControls.UI.RadButton(); |
| ((System.ComponentModel.ISupportInitialize)(this.radDock)).BeginInit(); |
| this.radDock.SuspendLayout(); |
| ((System.ComponentModel.ISupportInitialize)(this.documentContainer1)).BeginInit(); |
| ((System.ComponentModel.ISupportInitialize)(this.radPanel)).BeginInit(); |
| this.radPanel.SuspendLayout(); |
| ((System.ComponentModel.ISupportInitialize)(this.radButton)).BeginInit(); |
| ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); |
| this.SuspendLayout(); |
| // |
| // radDock |
| // |
| this.radDock.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(254))))); |
| this.radDock.Controls.Add(this.documentContainer1); |
| this.radDock.Dock = System.Windows.Forms.DockStyle.Fill; |
| this.radDock.DocumentManager.DocumentInsertOrder = Telerik.WinControls.UI.Docking.DockWindowInsertOrder.InFront; |
| this.radDock.Location = new System.Drawing.Point(0, 0); |
| this.radDock.MainDocumentContainer = this.documentContainer1; |
| this.radDock.Name = "radDock"; |
| this.radDock.Size = new System.Drawing.Size(284, 201); |
| this.radDock.TabIndex = 0; |
| this.radDock.TabStop = false; |
| this.radDock.Text = "radDock"; |
| // |
| // documentContainer1 |
| // |
| this.documentContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(254))))); |
| this.documentContainer1.Location = new System.Drawing.Point(0, 0); |
| this.documentContainer1.Name = "documentContainer1"; |
| this.documentContainer1.Size = new System.Drawing.Size(284, 201); |
| this.documentContainer1.SizeInfo.SizeMode = Telerik.WinControls.UI.Docking.SplitPanelSizeMode.Fill; |
| this.documentContainer1.TabIndex = 0; |
| this.documentContainer1.TabStop = false; |
| // |
| // radPanel |
| // |
| this.radPanel.Controls.Add(this.radButton); |
| this.radPanel.Dock = System.Windows.Forms.DockStyle.Bottom; |
| this.radPanel.Location = new System.Drawing.Point(0, 201); |
| this.radPanel.Name = "radPanel"; |
| this.radPanel.Size = new System.Drawing.Size(284, 30); |
| this.radPanel.TabIndex = 1; |
| // |
| // radButton |
| // |
| this.radButton.AllowShowFocusCues = true; |
| this.radButton.Location = new System.Drawing.Point(3, 3); |
| this.radButton.Name = "radButton"; |
| this.radButton.Size = new System.Drawing.Size(75, 23); |
| this.radButton.TabIndex = 0; |
| this.radButton.Text = "ToolWindow"; |
| this.radButton.Click += new System.EventHandler(this.radButton_Click); |
| // |
| // MainForm |
| // |
| this.ClientSize = new System.Drawing.Size(284, 231); |
| this.Controls.Add(this.radDock); |
| this.Controls.Add(this.radPanel); |
| this.Name = "MainForm"; |
| // |
| // |
| // |
| this.RootElement.ApplyShapeToControl = true; |
| ((System.ComponentModel.ISupportInitialize)(this.radDock)).EndInit(); |
| this.radDock.ResumeLayout(false); |
| ((System.ComponentModel.ISupportInitialize)(this.documentContainer1)).EndInit(); |
| ((System.ComponentModel.ISupportInitialize)(this.radPanel)).EndInit(); |
| this.radPanel.ResumeLayout(false); |
| ((System.ComponentModel.ISupportInitialize)(this.radButton)).EndInit(); |
| ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); |
| this.ResumeLayout(false); |
| } |
| private Telerik.WinControls.UI.Docking.RadDock radDock; |
| private Telerik.WinControls.UI.Docking.DocumentContainer documentContainer1; |
| private Telerik.WinControls.UI.RadPanel radPanel; |
| private Telerik.WinControls.UI.RadButton radButton; |
| } |
| class ToolWindow : Telerik.WinControls.UI.Docking.ToolWindow { |
| public ToolWindow() { |
| Text = "No image..."; |
| } |
| } |
| } |
Thanks.