示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextBox"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public TextBox(Base parent)
            : base(parent)
        {
            AutoSizeToContents = false;
            SetSize(200, 20);

            MouseInputEnabled = true;
            KeyboardInputEnabled = true;

            Alignment = Pos.Left | Pos.CenterV;
            TextPadding = new Padding(4, 2, 4, 2);

            m_CursorPos = 0;
            m_CursorEnd = 0;
            m_SelectAll = false;

            TextColor = Color.FromArgb(255, 50, 50, 50); // TODO: From Skin

            IsTabable = true;

            AddAccelerator("Ctrl + C", OnCopy);
            AddAccelerator("Ctrl + X", OnCut);
            AddAccelerator("Ctrl + V", OnPaste);
            AddAccelerator("Ctrl + A", OnSelectAll);
        }
示例#2
0
		protected override void Initialize()
		{
			base.Initialize();

			this.Spacing = TableLayout.DefaultSpacing;
			this.Padding = TableLayout.DefaultPadding;
			Widget.SizeChanged += HandleSizeChanged;
		}
示例#3
0
文件: Button.cs 项目: tritao/flood
 /// <summary>
 /// Control constructor.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public Button(Control parent)
     : base(parent)
 {
     SetSize(100, 20);
     MouseInputEnabled = true;
     Alignment = Pos.Center;
     TextPadding = new Padding(3, 3, 3, 3);
 }
        /// <summary>
        /// Creates a new renderer for the specified calendar
        /// </summary>
        /// <param name="calendar"></param>
        public CalendarRenderer(Calendar calendar)
        {
            if (calendar == null)
            {
                throw new ArgumentNullException("calendar");
            }

            _calendar = calendar;
            _allDayItemsPadding = 5;
            _itemsPadding = 5;
            _itemTextMargin = new Padding(3);
            _itemShadowPadding = 4;
            _itemInvalidateMargin = 0;
        }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupBox"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public GroupBox(ControlBase parent)
            : base(parent)
        {
            // Set to true, because it's likely that our  
            // children will want mouse input, and they
            // can't get it without us..
            MouseInputEnabled = true;
            KeyboardInputEnabled = true;

            TextPadding = new Padding(10, 0, 10, 0);
            Alignment = Pos.Top | Pos.Left;
            Invalidate();

            m_InnerPanel = new ControlBase(this);
            m_InnerPanel.Dock = Pos.Fill;
            m_InnerPanel.Margin = new Margin(5, TextHeight+5, 5, 5);
            //Margin = new Margin(5, 5, 5, 5);
        }
示例#6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextBox"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public MultilineTextBox(Base parent)
            : base(parent)
        {
            AutoSizeToContents = false;
            SetSize(200, 20);

            MouseInputEnabled = true;
            KeyboardInputEnabled = true;

            Alignment = Pos.Left | Pos.Top;
            TextPadding = new Padding(4, 2, 4, 2);

            m_CursorPos = new Point(0, 0);
            m_CursorEnd = new Point(0, 0);
            m_SelectAll = false;

            TextColor = Color.FromArgb(255, 50, 50, 50); // TODO: From Skin

            IsTabable = false;
            AcceptTabs = true;

            m_ScrollControl = new ScrollControl(this);
            m_ScrollControl.Dock = Pos.Fill;
            m_ScrollControl.EnableScroll(true, true);
            m_ScrollControl.AutoHideBars = true;
            m_ScrollControl.Margin = Margin.One;
            m_InnerPanel = m_ScrollControl;
            m_Text.Parent = m_InnerPanel;
            m_ScrollControl.InnerPanel.BoundsChanged += ScrollChanged;

            m_TextLines.Add(String.Empty);

            // [halfofastaple] TODO Figure out where these numbers come from. See if we can remove the magic numbers.
            //	This should be as simple as 'm_ScrollControl.AutoSizeToContents = true' or 'm_ScrollControl.NoBounds()'
            m_ScrollControl.SetInnerSize(1000, 1000);

            AddAccelerator("Ctrl + C", OnCopy);
            AddAccelerator("Ctrl + X", OnCut);
            AddAccelerator("Ctrl + V", OnPaste);
            AddAccelerator("Ctrl + A", OnSelectAll);
        }
		public int UxThemeGetThemeMargins (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, MarginProperty prop, out Padding result)
		{
			UXTheme.MARGINS retval = new UXTheme.MARGINS ();
			XplatUIWin32.RECT BoundsRect;

			int hresult = UXTheme.GetThemeMargins (hTheme, dc.GetHdc (), iPartId, iStateId, (int)prop, out BoundsRect, out retval);
			dc.ReleaseHdc ();

			result = retval.ToPadding();
			return hresult;
		}
示例#8
0
 public void DrawImage(IconType type, Image image, Padding padding, bool stripBorderFromSource = true)
 {
     if (type == IconType.Circle)
     {
         var path = new GraphicsPath();
         path.AddEllipse(padding.Left, padding.Top, Icon.Width - padding.Right, Icon.Width - padding.Bottom);
         Graphics.SetClip(path);
     }
     Graphics.DrawImage(image,
         new RectangleF(padding.Left, padding.Top, Icon.Width - padding.Right, Icon.Height - padding.Bottom),
         stripBorderFromSource
             ? new RectangleF(5, 5, image.Width - 10, image.Height - 10)
             : new RectangleF(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
     Graphics.SetClip(new Rectangle(0, 0, Icon.Width, Icon.Height)); // Resets clipping region
     Graphics.Save();
 }
示例#9
0
		public TableLayoutHandler()
		{
#if OSX
			Control = new MacEventView { Handler = this };
#elif IOS
			Control = new NSView();
#endif

			#pragma warning disable 612,618
			spacing = TableLayout.DefaultSpacing;
			padding = TableLayout.DefaultPadding;
			#pragma warning restore 612,618
		}
示例#10
0
文件: Button.cs 项目: tritao/flood
        /// <summary>
        /// Sets the button's image.
        /// </summary>
        /// <param name="image">Image bitmap.</param>
        /// <param name="center">Determines whether the image should be centered.</param>
        public virtual void SetImage(Bitmap image, bool center = false)
        {
            if (m_Image == null)
            {
                m_Image = new ImagePanel(this);
            }

            m_Image.Texture.LoadBitmap(image);

            m_Image.SizeToContents( );
            m_Image.SetPosition(Math.Max(Padding.Left, 2), 2);
            m_CenterImage = center;

            TextPadding = new Padding(m_Image.Right + 2, TextPadding.Top, TextPadding.Right, TextPadding.Bottom);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PaddingTransformation"/>
 /// class, specifying all sides of the padding.
 /// </summary>
 /// <param name="top">The amount of pixels to add to the left.</param>
 /// <param name="right">The amount of pixels to add to the right.</param>
 /// <param name="bottom">The amount of pixels to add to the bottom.</param>
 /// <param name="left">The amount of pixels to add to the left.</param>
 public PaddingTransformation(int top, int right, int bottom, int left)
 {
     Padding = new Padding(top, right, bottom, left);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PaddingTransformation"/>
 /// class using the padding information specified in the <see 
 /// cref="Padding"/> structure.
 /// </summary>
 /// <param name="padding">A <see cref="Padding"/> structure specifying
 /// the padding to add on each side.</param>
 public PaddingTransformation(Padding padding)
 {
     Padding = padding;
 }
示例#13
0
文件: MonthView.cs 项目: Hujairi/CMS
        public MonthView()
        {
            SetStyle(ControlStyles.Opaque, true);
            DoubleBuffered = true;

            _dayNamesFormat = "ddd";
            _monthTitleFormat = "MMMM yyyy";
            _selectionMode = MonthViewSelection.Manual;
            _workWeekStart = DayOfWeek.Monday;
            _workWeekEnd = DayOfWeek.Friday;
            _weekStart = DayOfWeek.Sunday;
            _dayNamesVisible = true;
            _dayNamesLength = 2;
            _viewStart = DateTime.Now;
            _itemPadding = new Padding(2);
            _monthTitleColor = SystemColors.ActiveCaption;
            _monthTitleColorInactive = SystemColors.InactiveCaption;
            _monthTitleTextColor = SystemColors.ActiveCaptionText;
            _monthTitleTextColorInactive = SystemColors.InactiveCaptionText;
            _dayBackgroundColor = Color.Empty;
            _daySelectedBackgroundColor = SystemColors.Highlight;
            _dayTextColor = SystemColors.WindowText;
            _daySelectedTextColor = SystemColors.HighlightText;
            _arrowsColor = SystemColors.Window;
            _arrowsSelectedColor = Color.Gold;
            _dayGrayedText = SystemColors.GrayText;
            _todayBorderColor = Color.Maroon;

            UpdateMonthSize();
            UpdateMonths();
        }
		public int UxThemeGetThemeMargins (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, MarginProperty prop, out Padding result)
		{
			result = Padding.Empty;
			return (int)S.S_FALSE;
		}
示例#15
0
 public override void ReadAttributes(XmlTextReader reader)
 {
     for (int i = 0; i < reader.AttributeCount; i++)
     {
         reader.MoveToAttribute(i);
         if (reader.Name.ToLower() == "align")
         {
             string s = reader.Value.ToLower();
             if (s == "left")
                 m_Align = eParagraphAlignment.Left;
             else if (s == "right")
                 m_Align = eParagraphAlignment.Right;
             else if (s == "center")
                 m_Align = eParagraphAlignment.Center;
         }
         else if (reader.Name.ToLower() == "valign")
         {
             string s = reader.Value.ToLower();
             if (s == "top")
                 m_VAlign = eParagraphVerticalAlignment.Top;
             else if (s == "middle")
                 m_VAlign = eParagraphVerticalAlignment.Middle;
             else if (s == "bottom")
                 m_VAlign = eParagraphVerticalAlignment.Bottom;
         }
         else if (reader.Name.ToLower() == "width")
         {
             try
             {
                 m_Width = Int32.Parse(reader.Value);
             }
             catch
             {
                 m_Width = 0;
             }
         }
         else if (reader.Name.ToLower() == "height")
         {
             try
             {
                 m_Height = Int32.Parse(reader.Value);
             }
             catch
             {
                 m_Height = 0;
             }
         }
         else if (reader.Name.ToLower() == "padding")
         {
             try
             {
                 string[] values = reader.Value.Split(',');
                 if (values.Length > 0)
                     m_Padding.Left = Int32.Parse(values[0]);
                 if (values.Length > 1)
                     m_Padding.Right = Int32.Parse(values[1]);
                 if (values.Length > 2)
                     m_Padding.Top = Int32.Parse(values[2]);
                 if (values.Length > 3)
                     m_Padding.Bottom = Int32.Parse(values[3]);
             }
             catch
             {
                 m_Padding = new Padding(0,0,0,0);
             }
         }
         else if (reader.Name.ToLower() == "bgcolor")
         {
             try
             {
                 string s = reader.Value;
                 if (s.StartsWith("#"))
                 {
                     if (s.Length == 7)
                         m_BackColor = ColorScheme.GetColor(s.Substring(1));
                 }
                 else
                 {
                     m_BackColor = Color.FromName(s);
                 }
             }
             catch
             {
                 m_BackColor = Color.Empty;
             }
         }
     }
 }
示例#16
0
 public override void DisableResizing()
 {
     base.DisableResizing();
     Padding = new Padding(6, 0, 6, 0);
 }
示例#17
0
文件: Button.cs 项目: tritao/flood
        /// <summary>
        /// Sets the button's image.
        /// </summary>
        /// <param name="textureName">Texture name. Null to remove.</param>
        /// <param name="center">Determines whether the image should be centered.</param>
        public virtual void SetImage(String textureName, bool center = false)
        {
            if (String.IsNullOrEmpty(textureName))
            {
                if (m_Image != null)
                    m_Image.Dispose();
                m_Image = null;
                return;
            }

            if (m_Image == null)
            {
                m_Image = new ImagePanel(this);
            }

            m_Image.ImageName = textureName;
            m_Image.SizeToContents( );
            m_Image.SetPosition(Math.Max(Padding.Left, 2), 2);
            m_CenterImage = center;

            TextPadding = new Padding(m_Image.Right + 2, TextPadding.Top, TextPadding.Right, TextPadding.Bottom);
        }
 /// <summary>
 /// Disables resizing.
 /// </summary>
 public virtual void DisableResizing()
 {
     for (int i = 0; i < 10; i++)
     {
         if (m_Resizer[i] == null)
             continue;
         m_Resizer[i].MouseInputEnabled = false;
         m_Resizer[i].IsHidden = true;
         Padding = new Padding(m_Resizer[i].Width, m_Resizer[i].Width, m_Resizer[i].Width, m_Resizer[i].Width);
     }
 }
 /// <summary>
 /// Enables resizing.
 /// </summary>
 public void EnableResizing()
 {
     for (int i = 0; i < 10; i++)
     {
         if (m_Resizer[i] == null)
             continue;
         m_Resizer[i].MouseInputEnabled = true;
         m_Resizer[i].IsHidden = false;
         Padding = new Padding(0, 0, 0, 0); // todo: check if ok
     }
 }
示例#20
0
		public PropertyGridView (PropertyGrid propertyGrid) {
			property_grid = propertyGrid;

			string_format = new StringFormat ();
			string_format.FormatFlags = StringFormatFlags.NoWrap;
			string_format.Trimming = StringTrimming.None;

			grid_textbox = new PropertyGridTextBox ();
			grid_textbox.DropDownButtonClicked +=new EventHandler (DropDownButtonClicked);
			grid_textbox.DialogButtonClicked +=new EventHandler (DialogButtonClicked);

			dropdown_form = new PropertyGridDropDown ();
			dropdown_form.FormBorderStyle = FormBorderStyle.None;
			dropdown_form.StartPosition = FormStartPosition.Manual;
			dropdown_form.ShowInTaskbar = false;

			dialog_form = new Form ();
			dialog_form.StartPosition = FormStartPosition.Manual;
			dialog_form.FormBorderStyle = FormBorderStyle.None;
			dialog_form.ShowInTaskbar = false;

			dropdown_form_padding = new Padding (0, 0, 2, 2);

			row_height = Font.Height + font_height_padding;

			grid_textbox.Visible = false;
			grid_textbox.Font = this.Font;
			grid_textbox.BackColor = SystemColors.Window;
			grid_textbox.Validate += new CancelEventHandler (grid_textbox_Validate);
			grid_textbox.ToggleValue+=new EventHandler (grid_textbox_ToggleValue);
			grid_textbox.KeyDown+=new KeyEventHandler (grid_textbox_KeyDown);
			this.Controls.Add (grid_textbox);

			vbar = new ImplicitVScrollBar ();
			vbar.Visible = false;
			vbar.Value = 0;
			vbar.ValueChanged+=new EventHandler (VScrollBar_HandleValueChanged);
			vbar.Dock = DockStyle.Right;
			this.Controls.AddImplicit (vbar);

			resizing_grid = false;

			bold_font = new Font (this.Font, FontStyle.Bold);
			inactive_text_brush = new SolidBrush (ThemeEngine.Current.ColorGrayText);

			ForeColorChanged+=new EventHandler (RedrawEvent);
			BackColorChanged+=new System.EventHandler (RedrawEvent);
			FontChanged+=new EventHandler (RedrawEvent);
			
			SetStyle (ControlStyles.Selectable, true);
			SetStyle (ControlStyles.DoubleBuffer, true);
			SetStyle (ControlStyles.UserPaint, true);
			SetStyle (ControlStyles.AllPaintingInWmPaint, true);
			SetStyle (ControlStyles.ResizeRedraw, true);
		}