2019년 8월 30일 금요일

[C#/Mono] Button.cs


wButton.cs


using System;
using System.Drawing;
using System.Windows.Forms;

public class WButton : WCtrl
{
 Button button;
 
 public void create(string text, EventHandler handler, int? x, int? y, int? w, int? h ) {
  ctrl = button = new Button();
  button.Text = text;
  button.Click += handler; //new System.EventHandler(this.OnLoadClick)
  if( x != null ) button.Left = x ?? 0;
  if( y != null ) button.Top = y ?? 0;
  if( w != null ) button.Width = w ?? -1;
  if( h != null ) button.Height = h ?? -1;
  
  button.MinimumSize = new Size(80, 22);
 }
 
 public WButton(string text ) {
  ctrl = button = new Button();
  button.Text = text;
 }
  
 public WButton(string text, EventHandler handler ) {
  create( text, handler, null, null, null, null );
 }

 public WButton(string text, int x, int y, EventHandler handler ) {
  create( text, handler, x, y, null, null );
 }

 public WButton(string text, int x, int y, int w, int h, EventHandler handler ) {
  create( text, handler, x, y, w, h );
 }


}



댓글 없음:

댓글 쓰기