views:

89

answers:

0
using Fluid.Classes;
using Fluid.Controls;
using Fluid.Drawing;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SmartDeviceProject8
{
    class ConversionPage : FluidPanel, ICommandContainer
    {
     private NumericPad  numPad;
     private FluidLabel  inputLabel;
     private FluidLabel  outputLabel;
     private FluidTextBox inputValue;
     private FluidTextBox outputValue;

     /// <summary>
     /// Class contructor
     /// </summary>
     /// <param name="x">x value</param>
     /// <param name="y">y value</param>
     /// <param name="w">width</param>
     /// <param name="h">height</param>
     public ConversionPage(int x, int y, int w, int h) : base(x, y, w, h) { }

     /// <summary>
     /// 
     /// </summary>
     protected override void InitControl()
     {
      base.InitControl();

      BackColor = Color.White;
      Bounds  = new Rectangle(0, 0, Width, Height);
      Anchor  = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;

      inputValue = AddTextLabel("Input value", 10, ref inputLabel, true, true);
      outputValue = AddTextLabel("Converted value", 50, ref outputLabel, true, false);

      numPad = new NumericPad();

      MakeButtonsGlowing();

      numPad.Bounds = new Rectangle(0, 150, Width, 200);

      numPad.EnableDoubleBuffer = false;
      numPad.Buttons[15].Enabled = false;

      numPad.Corners = RoundedCorners.None;
      numPad.Anchor = AnchorStyles.None;

      Controls.Add(numPad);
     }

     /// <summary>
     /// 
     /// </summary>
     /// <param name="title"></param>
     /// <param name="top"></param>
     /// <param name="label"></param>
     /// <param name="visible"></param>
     /// <param name="enable"></param>
     /// <returns></returns>
     FluidTextBox AddTextLabel(string title, int top, ref FluidLabel label, bool visible, bool enable)
     {
      label = new FluidLabel(title, 10, top + 5, Width - 20, 16);
      label.Anchor = AnchorStyles.Left | AnchorStyles.Top;
      label.Font = new Font(FontFamily.GenericSansSerif, 8f, FontStyle.Regular);
      label.ForeColor = Color.Black;
      label.Visible = visible;
      Controls.Add(label);

      FluidTextBox textbox = new FluidTextBox("", 10, top + 19, Width - 20, 24);
      textbox.Anchor = AnchorStyles.Left | AnchorStyles.Top;
      textbox.Visible = visible;
      textbox.Enabled = enable;
      textbox.CanShowInputPanel = false;
      Controls.Add(textbox);
      return textbox;
     }

     private void MakeButtonsGlowing()
     {
      FluidButton[] buttons = numPad.Buttons;
      foreach (FluidButton btn in buttons) btn.PressedBackColor = Color.DarkBlue;
      buttons[11].PressedBackColor = Color.Red;
      buttons[15].PressedBackColor = Color.Green;
     }
    }
}

and the usage:

using Fluid.Controls;
using Fluid.Classes;

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SmartDeviceProject8
{
    public partial class Form1 : Form
    {
     ConversionPage browse;

     public Form1()
     {
      InitializeComponent();

      browse = new ConversionPage(0, 0, host.Width, host.Height);
      browse.ShowMaximized(ShowTransition.None);
     }
    }
}

Now the issue is that the NumericPad is being shown in parts ... the first line ( 1 / 2 / 3 / clr ) and the last line ( * / 0+ / #_ ) Its pretty damn bad because I'm having issues with Lists and item binding. The Fluid project can be verry usefull for mobile development.