Created
          February 28, 2013 06:39 
        
      - 
      
- 
        Save cwensley/5054735 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class MyImageLabel : Drawable { | |
| Font font = Fonts.Sans (10); | |
| public Image Image { get; set; } | |
| public string Text { get; set; } | |
| public override void OnPaint (PaintEventArgs e) | |
| { | |
| if (Image != null) | |
| e.Graphics.DrawImage (Image, 0, 0); | |
| if (Text != null) | |
| e.Graphics.DrawText (font, Colors.Black, 0, 0, Text); | |
| } | |
| } | |
| public class MyForm : Form | |
| { | |
| public MyForm () | |
| { | |
| this.ClientSize = new Size (200, 200); | |
| this.AddDockedControl (new MyImageLabel { | |
| Text = "Hello there", | |
| Image = Bitmap.FromResource("Eto.Test.TestImage.png") | |
| }); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment