fork(16) download
  1. using System;
  2. using System.Drawing;
  3. using System.Runtime.InteropServices;
  4. using System.Windows.Forms;
  5.  
  6. namespace WindowsFormsApplication1
  7. {
  8. public partial class Form1 : Form
  9. {
  10. [DllImport( "gdi32.dll" )]
  11. static extern int Rectangle( IntPtr hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect );
  12.  
  13. public Form1()
  14. {
  15. InitializeComponent();
  16. }
  17.  
  18. protected override void OnPaint( PaintEventArgs e )
  19. {
  20. // GDI+
  21. e.Graphics.FillRectangle( Brushes.Blue, new Rectangle( 0, 0, 50, 50 ) );
  22. e.Graphics.DrawRectangle( Pens.Red, new Rectangle( 0, 100, 50, 50 ) );
  23.  
  24. // GDI
  25. var hdc = e.Graphics.GetHdc();
  26. Rectangle( hdc, 0, 200, 50, 250 );
  27. e.Graphics.ReleaseHdc( hdc );
  28.  
  29. base.OnPaint( e );
  30. }
  31.  
  32. private void button1_Click( object sender, EventArgs e )
  33. {
  34. if( this.RightToLeft == System.Windows.Forms.RightToLeft.Yes )
  35. {
  36. this.RightToLeft = System.Windows.Forms.RightToLeft.No;
  37. this.RightToLeftLayout = false;
  38. }
  39. else
  40. {
  41. this.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
  42. this.RightToLeftLayout = true;
  43. }
  44. }
  45. }
  46. }
  47.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty