Ejemplo n.º 1
0
 public FormPatientAddAll()
 {
     InitializeComponent();
     Lan.F(this);
     listReferral=new ListBox();
     listReferral.Location=new Point(textReferral.Left,textReferral.Bottom);
     listReferral.Size=new Size(400,140);
     listReferral.HorizontalScrollbar=true;
     listReferral.Visible=false;
     listReferral.Click += new System.EventHandler(listReferral_Click);
     listReferral.DoubleClick += new System.EventHandler(listReferral_DoubleClick);
     listReferral.MouseEnter += new System.EventHandler(listReferral_MouseEnter);
     listReferral.MouseLeave += new System.EventHandler(listReferral_MouseLeave);
     Controls.Add(listReferral);
     listReferral.BringToFront();
     listEmps1=new ListBox();
     listEmps1.Location=new Point(groupIns1.Left+textEmployer1.Left,
         groupIns1.Top+textEmployer1.Bottom);
     listEmps1.Size=new Size(254,100);
     listEmps1.Visible=false;
     listEmps1.Click += new System.EventHandler(listEmps1_Click);
     listEmps1.DoubleClick += new System.EventHandler(listEmps1_DoubleClick);
     listEmps1.MouseEnter += new System.EventHandler(listEmps1_MouseEnter);
     listEmps1.MouseLeave += new System.EventHandler(listEmps1_MouseLeave);
     Controls.Add(listEmps1);
     listEmps1.BringToFront();
     listEmps2=new ListBox();
     listEmps2.Location=new Point(groupIns2.Left+textEmployer2.Left,
         groupIns2.Top+textEmployer2.Bottom);
     listEmps2.Size=new Size(254,100);
     listEmps2.Visible=false;
     listEmps2.Click += new System.EventHandler(listEmps2_Click);
     listEmps2.DoubleClick += new System.EventHandler(listEmps2_DoubleClick);
     listEmps2.MouseEnter += new System.EventHandler(listEmps2_MouseEnter);
     listEmps2.MouseLeave += new System.EventHandler(listEmps2_MouseLeave);
     Controls.Add(listEmps2);
     listEmps2.BringToFront();
     listCars1=new ListBox();
     listCars1.Location=new Point(groupIns1.Left+textCarrier1.Left,
         groupIns1.Top+textCarrier1.Bottom);
     listCars1.Size=new Size(700,100);
     listCars1.HorizontalScrollbar=true;
     listCars1.Visible=false;
     listCars1.Click += new System.EventHandler(listCars1_Click);
     listCars1.DoubleClick += new System.EventHandler(listCars1_DoubleClick);
     listCars1.MouseEnter += new System.EventHandler(listCars1_MouseEnter);
     listCars1.MouseLeave += new System.EventHandler(listCars1_MouseLeave);
     Controls.Add(listCars1);
     listCars1.BringToFront();
     listCars2=new ListBox();
     listCars2.Location=new Point(groupIns2.Left+textCarrier2.Left,
         groupIns2.Top+textCarrier2.Bottom);
     listCars2.Size=new Size(700,100);
     listCars2.HorizontalScrollbar=true;
     listCars2.Visible=false;
     listCars2.Click += new System.EventHandler(listCars2_Click);
     listCars2.DoubleClick += new System.EventHandler(listCars2_DoubleClick);
     listCars2.MouseEnter += new System.EventHandler(listCars2_MouseEnter);
     listCars2.MouseLeave += new System.EventHandler(listCars2_MouseLeave);
     Controls.Add(listCars2);
     listCars2.BringToFront();
 }
        private void EnsureControlVisibility(ListBox editor) {
            var preferredHeight = editor.ItemHeight * Math.Min(editor.Items.Count, ListBoxItemsNumber);
            editor.Height = Math.Min(preferredHeight, parentTree.Height);

            if(parentTree.Height - editor.Bounds.Top < editor.Height) {
                editor.Bounds = new Rectangle(editor.Bounds.Left, parentTree.Height - editor.Height, editor.Bounds.Width, editor.Bounds.Height);
            }

            editor.BringToFront();
        }
Ejemplo n.º 3
0
 ///<summary></summary>
 public FormPatientEdit(Patient patCur,Family famCur)
 {
     InitializeComponent();// Required for Windows Form Designer support
     PatCur=patCur;
     FamCur=famCur;
     PatOld=patCur.Copy();
     listEmps=new ListBox();
     listEmps.Location=new Point(textEmployer.Left,textEmployer.Bottom);
     listEmps.Size=new Size(textEmployer.Width,100);
     listEmps.Visible=false;
     listEmps.Click += new System.EventHandler(listEmps_Click);
     listEmps.DoubleClick += new System.EventHandler(listEmps_DoubleClick);
     listEmps.MouseEnter += new System.EventHandler(listEmps_MouseEnter);
     listEmps.MouseLeave += new System.EventHandler(listEmps_MouseLeave);
     Controls.Add(listEmps);
     listEmps.BringToFront();
     listCounties=new ListBox();
     listCounties.Location=new Point(groupPH.Left+textCounty.Left
         ,groupPH.Top+textCounty.Bottom);
     listCounties.Size=new Size(textCounty.Width,100);
     listCounties.Visible=false;
     listCounties.Click += new System.EventHandler(listCounties_Click);
     //listCounties.DoubleClick += new System.EventHandler(listCars_DoubleClick);
     listCounties.MouseEnter += new System.EventHandler(listCounties_MouseEnter);
     listCounties.MouseLeave += new System.EventHandler(listCounties_MouseLeave);
     Controls.Add(listCounties);
     listCounties.BringToFront();
     listSites=new ListBox();
     listSites.Location=new Point(groupPH.Left+textSite.Left,groupPH.Top+textSite.Bottom);
     listSites.Size=new Size(textSite.Width,100);
     listSites.Visible=false;
     listSites.Click += new System.EventHandler(listSites_Click);
     listSites.MouseEnter += new System.EventHandler(listSites_MouseEnter);
     listSites.MouseLeave += new System.EventHandler(listSites_MouseLeave);
     Controls.Add(listSites);
     listSites.BringToFront();
     Lan.F(this);
     if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
         labelSSN.Text="SIN";
         labelZip.Text="Postal Code";
         labelST.Text="Province";
         butEditZip.Text="Edit Postal Code";
         labelCanadianEligibilityCode.Visible=true;
         comboCanadianEligibilityCode.Visible=true;
         radioStudentN.Visible=false;
         radioStudentP.Visible=false;
         radioStudentF.Visible=false;
     }
     if(CultureInfo.CurrentCulture.Name.EndsWith("GB")){//en-GB
         //labelSSN.Text="?";
         labelZip.Text="Postcode";
         labelST.Text="";//no such thing as state in GB
         butEditZip.Text="Edit Postcode";
     }
 }
        public dashboardMarketEdit(DataTable _dataSource, Action<string, string> _UpdateSelectedMarket, LayoutPanelBase _CurrentLayout)
        {
            CurrentLayout = _CurrentLayout;
            if (null == _dataSource)
                throw new Exception ("invalid data source passed in");
            UpdateSelectedMarket = _UpdateSelectedMarket;

            MarketFilters = BuildMarketFilterBox ();

            //	NewMessage.Show ("boo");
            ListOfMarkets = new ListBox ();

            if (_dataSource.PrimaryKey.Length == 0) {
                _dataSource.PrimaryKey = new DataColumn[] { _dataSource.Columns ["Guid"] };
            }

            ViewOfTheData = new DataView (_dataSource);
            ViewOfTheData.Sort = "Caption ASC";
            ViewOfTheData.ListChanged += new System.ComponentModel.ListChangedEventHandler (OnListChanged);

            //ViewOfTheData.RowFilter = BuildRowFilter();

            ListOfMarkets.DataSource = ViewOfTheData;//_dataSource;
            ListOfMarkets.SelectedIndexChanged += HandleMarketListSelectedIndexChanged;
            ListOfMarkets.DisplayMember = "Caption";

            //ListOfMarkets.DoubleClick+= HandleListOfDoubleClick;
            //	ListOfMarkets.MouseDown+= HandleListOfMarketsMouseDown;

            //ListOfMarkets.Sorted = true;
            //ListOfMarkets.Width = 200;
            //
            // TAB CONTROL SIDE
            //

            TabControl Tabs = new TabControl ();
            Tabs.Dock = DockStyle.Fill;

            TabPage MarketEditing = new TabPage ();
            MarketEditing.Text = Loc.Instance.GetString ("Market Details");

            TabPage MarketSubmissions = new TabPage ();
            MarketSubmissions.Text = Loc.Instance.GetString ("Market Submissions");

            TabPage MarketNotes = new TabPage ();
            MarketNotes.Text = Loc.Instance.GetString ("Market Notes");

            Tabs.TabPages.Add (MarketEditing);
            Tabs.TabPages.Add (MarketNotes);
            Tabs.TabPages.Add (MarketSubmissions);

            Tabs.SelectedIndexChanged += HandleMiniTabSelectedIndexChanged;

            SubLabel = new Label ();
            SubLabel.Text = Loc.Instance.GetString ("Submissions");
            SubLabel.Dock = DockStyle.Top;
            DestLabel = new Label ();
            DestLabel.Dock = DockStyle.Bottom;
            DestLabel.Text = Loc.Instance.GetString ("Destinations");

            PreviousSubmissions = new ListBox ();
            PreviousSubmissions.DoubleClick += HandlePreviousSubmissionsDoubleClick;
            PreviousSubmissions.Dock = DockStyle.Fill;
            //PreviousSubmissions.Height = 100;

            Destinations = new ListBox ();
            Destinations.Dock = DockStyle.Bottom;
            Destinations.Height = 100;

            tmpEditor = new PropertyGrid ();
            tmpEditor.Dock = DockStyle.Fill;
            tmpEditor.PropertyValueChanged += HandlePropertyValueChanged;
            tmpEditor.Height = 300;

            MarketEditing.Controls.Add (tmpEditor);
            MarketSubmissions.Controls.Add (DestLabel);
            MarketSubmissions.Controls.Add (PreviousSubmissions);
            PreviousSubmissions.BringToFront ();

            MarketSubmissions.Controls.Add (SubLabel);
            MarketSubmissions.Controls.Add (Destinations);

            //
            // MAIN TABlE
            //

            //	Panel EasyMarketEdit = new Panel();

            //	EasyMarketEdit.BackColor = Color.Green;
            //	EasyMarketEdit.Height = 200;

            //	EasyMarketEdit.Dock = DockStyle.Fill;

            //	EasyMarketEdit.Controls.Add (Tabs);

            //	tmpEditor.Enabled = false;
            tmpEditor.BringToFront ();

            AddMarket = new Button ();
            AddMarket.Dock = DockStyle.Bottom;
            AddMarket.Text = Loc.Instance.GetString ("Add Market");
            AddMarket.Click += HandleAddMarketClick;

            EditMarket = new Button ();
            EditMarket.Text = Loc.Instance.GetString ("Save Edits");
            EditMarket.Dock = DockStyle.Fill;
            EditMarket.Enabled = false;
            EditMarket.Click += HandleEditMarketClick;

            EditMarketCancel = new Button ();
            EditMarketCancel.Dock = DockStyle.Fill;
            EditMarketCancel.Text = Loc.Instance.GetString ("Cancel Edit");
            EditMarketCancel.Enabled = false;
            EditMarketCancel.Click += HandleEditMarketCancelClick;

            TableLayoutPanel MarketListPanel = new TableLayoutPanel ();

            MarketListPanel.RowCount = 2;
            MarketListPanel.ColumnCount = 3;

            MarketListPanel.Controls.Add (EditMarket, 1, 0);
            MarketListPanel.Controls.Add (AddMarket, 0, 0);
            MarketListPanel.Controls.Add (EditMarketCancel, 2, 0);

            //MarketListPanel.Controls.Add (EditMarketCancel, 1, 0);

            //MarketListPanel.Controls.Add (ListOfMarkets, 0, 1);
            MarketListPanel.Controls.Add (Tabs, 1, 1);
            MarketListPanel.SetColumnSpan (Tabs, 2);

            //	MarketListPanel.Controls.Add (PreviousSubmissions, 1, 2);

            //	MarketListPanel.Controls.Add (AddMarket, 0, 3);

            Panel RightSide = new Panel();

            RightSide.Controls.Add (MarketFilters);
            RightSide.Controls.Add (ListOfMarkets);

            ListOfMarkets.Dock = DockStyle.Fill;
            ListOfMarkets.BringToFront();
            RightSide.Dock = DockStyle.Fill;
            RightSide.BringToFront ();

            MarketListPanel.Controls.Add (RightSide, 0, 1);

            MarketListPanel.SetRowSpan(Tabs, 2);
            MarketListPanel.SetRowSpan(RightSide, 2);
            MarketListPanel.Dock = DockStyle.Fill;

            //this.Controls.Add (AddMarket);

            //NewMessage.Show ("boo2");
            this.Controls.Add (MarketListPanel);
            MarketListPanel.BringToFront();
            //	AddMarket.SendToBack();

            //
            // Setup Market Notes Pages
            //

            richBox = new RichTextBox();
            MarketNotes.Controls.Add (richBox);
            richBox.Dock = DockStyle.Fill;
            richBox.KeyDown+= HandleNotesKeyDown;

            MarketListPanel.ColumnStyles.Clear();
            for (int i = 0; i < MarketListPanel.ColumnCount; i++)
            {
                ColumnStyle style = new ColumnStyle(SizeType.Percent, 33.0f);
                MarketListPanel.ColumnStyles.Add(style);
            }

            MarketListPanel.RowStyles.Clear();
            for (int i = 0; i < MarketListPanel.RowCount; i++)
            {
                MarketListPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            }
        }
Ejemplo n.º 5
0
        private void _CreateListBox(string filter)
        {
            if (_listBox != null)
            {
                _listBox = null;
                return;
            }
            if (!_listBoxOpened)
            {
                _listBox = new ListBox();
                //listBox.scrollDirection = 1;
                //listBox.ItemWidth = Width;
                //listBox.ItemHeight = 20;
                _listBox.FixedHeight = true;
                _listBox.Font        = Font;
                _listBox.BringToFront();
                _listBox.Context = true;
                _listBox.Width   = Width;
                _listBox.Height  = _listBox.ItemHeight * (Items.Count > MaxDropDownItems ? MaxDropDownItems : Items.Count);
                if (_listBox.Height < _listBox.ItemHeight)
                {
                    _listBox.Height = _listBox.ItemHeight;
                }
                foreach (var item in Items)
                {
                    if (DropDownStyle == ComboBoxStyle.DropDownList || String.IsNullOrEmpty(filter))
                    {
                        _listBox.Items.Add(item);
                    }
                    else
                    {
                        if (item.ToString().ToLower().Contains(filter.ToLower()))
                        {
                            _listBox.Items.Add(item);
                        }
                    }
                }
                for (int i = 0; i < Items.Count; i++)
                {
                    if (Items.IsDisabled(i))
                    {
                        _listBox.Items.Disable(i);
                        //Application.Log(i);
                    }
                }
                if (SelectedIndex > -1)
                {
                    _listBox.ScrollIndex = SelectedIndex;
                }
                _listBox.SelectedIndex = SelectedIndex;

                var gpoint = PointToScreen(Point.Zero);
                _listBox.Location              = gpoint + new Point(0, Height);
                _listBox.SelectedValueChanged += (object sender, EventArgs args) =>
                {
                    if (_listBox != null)
                    {
                        for (int i = 0; i < Items.Count; i++)
                        {
                            if (Items[i] == _listBox.SelectedItem)
                            {
                                _filter      = _listBox.SelectedItem.ToString();
                                SelectedItem = _listBox.SelectedItem;
                                break;
                            }
                        }
                        //SelectedIndex = _listBox.SelectedIndex;
                        _listBox.Dispose();
                        _listBox = null;
                    }
                };
                _listBox.OnDisposing += (object sender, EventArgs args) =>
                {
                    var clientRect = new System.Drawing.Rectangle(0, 0, Width, Height);
                    var contains   = clientRect.Contains(PointToClient(MousePosition));
                    if (!contains)
                    {
                        _listBoxOpened = false;
                    }
                    else
                    {
                        _listBoxOpened = !_listBoxOpened;
                    }
                    _listBox = null;
                };
            }
            else
            {
                _listBoxOpened = false;
            }
        }
Ejemplo n.º 6
0
        private void _CreateListBox(string filter)
        {
            if (_listBox != null)
            {
                _listBox = null;
                return;
            }
            if (!_listBoxOpened)
            {
                _listBox = new ListBox();
                //listBox.scrollDirection = 1;
                //listBox.ItemWidth = Width;
                //listBox.ItemHeight = 20;
                _listBox.FixedHeight = true;
                _listBox.Font = Font;
                _listBox.BringToFront();
                _listBox.Context = true;
                _listBox.Width = Width;
                _listBox.Height = _listBox.ItemHeight * (Items.Count > MaxDropDownItems ? MaxDropDownItems : Items.Count);
                if (_listBox.Height < _listBox.ItemHeight) _listBox.Height = _listBox.ItemHeight;
                bool selectedIndexChanged = false;
                for (int i = 0; i < Items.Count; i++)
                {
                    var item = Items[i];
                    if (DropDownStyle == ComboBoxStyle.DropDownList || String.IsNullOrEmpty(filter))
                        _listBox.Items.Add(item);
                    else
                    {
                        var itemString = item.ToString();
                        if (itemString.ToLower().Contains(filter.ToLower()))
                        {
                            _listBox.Items.Add(item);
                            if (itemString == filter)
                            {
                                _listBox.SelectedIndex = i;
                                selectedIndexChanged = true;
                            }
                        }
                    }
                }
                for (int i = 0; i < Items.Count; i++)
                    if (Items.IsDisabled(i))
                    {
                        _listBox.Items.Disable(i);
                        //Application.Log(i);
                    }
                if (selectedIndexChanged == false)
                {
                    if (SelectedIndex > -1)
                        _listBox.ScrollIndex = SelectedIndex;
                    _listBox.SelectedIndex = SelectedIndex;
                }

                var gpoint = PointToScreen(Point.Zero);
                _listBox.Location = gpoint + new Point(0, Height);
                _listBox.SelectedValueChanged += (object sender, EventArgs args) =>
                {
                    if (_listBox != null)
                    {
                        for (int i = 0; i < Items.Count; i++)
                            if (Items[i] == _listBox.SelectedItem)
                            {
                                _filter = _listBox.SelectedItem.ToString();
                                SelectedItem = _listBox.SelectedItem;
                                break;
                            }
                        //SelectedIndex = _listBox.SelectedIndex;
                        _listBox.Dispose();
                        _listBox = null;
                    }
                };
                _listBox.OnDisposing += (object sender, EventArgs args) =>
                {
                    var clientRect = new System.Drawing.Rectangle(0, 0, Width, Height);
                    var contains = clientRect.Contains(PointToClient(MousePosition));
                    if (!contains)
                        _listBoxOpened = false;
                    else
                        _listBoxOpened = !_listBoxOpened;
                    _listBox = null;
                };
            }
            else
                _listBoxOpened = false;
        }
Ejemplo n.º 7
0
		//<summary>This is a field that is accessed only by clicking on the button because there's not room for it otherwise.  This variable should be treated just as if it was a visible textBox.</summary>
		//private string BenefitNotes;

		///<summary>Called from ContrFamily and FormInsPlans. Must pass in the plan, patPlan, and sub, although patPlan and sub can be null.</summary>
		public FormInsPlan(InsPlan planCur,PatPlan patPlanCur,InsSub subCur){
			Cursor=Cursors.WaitCursor;
			InitializeComponent();
			PlanCur=planCur;
			PatPlanCur=patPlanCur;
			SubCur=subCur;
			listEmps=new ListBox();
			listEmps.Location=new Point(panelPlan.Left+groupPlan.Left+textEmployer.Left,
				panelPlan.Top+groupPlan.Top+textEmployer.Bottom);
			listEmps.Size=new Size(231,100);
			listEmps.Visible=false;
			listEmps.Click += new System.EventHandler(listEmps_Click);
			listEmps.DoubleClick += new System.EventHandler(listEmps_DoubleClick);
			listEmps.MouseEnter += new System.EventHandler(listEmps_MouseEnter);
			listEmps.MouseLeave += new System.EventHandler(listEmps_MouseLeave);
			Controls.Add(listEmps);
			listEmps.BringToFront();
			listCars=new ListBox();
			listCars.Location=new Point(panelPlan.Left+groupPlan.Left+groupCarrier.Left+textCarrier.Left,
				panelPlan.Top+groupPlan.Top+groupCarrier.Top+textCarrier.Bottom);
			listCars.Size=new Size(700,100);
			listCars.HorizontalScrollbar=true;
			listCars.Visible=false;
			listCars.Click += new System.EventHandler(listCars_Click);
			listCars.DoubleClick += new System.EventHandler(listCars_DoubleClick);
			listCars.MouseEnter += new System.EventHandler(listCars_MouseEnter);
			listCars.MouseLeave += new System.EventHandler(listCars_MouseLeave);
			Controls.Add(listCars);
			listCars.BringToFront();
			//tbPercentPlan.CellClicked += new OpenDental.ContrTable.CellEventHandler(tbPercentPlan_CellClicked);
			//tbPercentPat.CellClicked += new OpenDental.ContrTable.CellEventHandler(tbPercentPat_CellClicked);
			Lan.F(this);
			if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
				labelPatID.Text=Lan.g(this,"Dependant Code");
				labelCitySTZip.Text=Lan.g(this,"City,Prov,Post");   //Postal Code";
				butSearch.Visible=false;
				labelElectronicID.Text="EDI Code";
				comboElectIDdescript.Visible=false;
				labelGroupNum.Text=Lan.g(this,"Plan Number");
				checkIsPMP.Checked=(planCur.CanadianPlanFlag!=null && planCur.CanadianPlanFlag!="");
			}
			else{
				labelDivisionDash.Visible=false;
				textDivisionNo.Visible=false;
				groupCanadian.Visible=false;
			}
			if(CultureInfo.CurrentCulture.Name.Length>=4 && CultureInfo.CurrentCulture.Name.Substring(3)=="GB"){//en-GB
				labelCitySTZip.Text=Lan.g(this,"City,Postcode");
			}
			panelPat.BackColor=DefC.Long[(int)DefCat.MiscColors][0].ItemColor;
			//labelViewRequestDocument.Text="         ";
			//if(!PrefC.GetBool(PrefName.CustomizedForPracticeWeb")) {
			//	butEligibility.Visible=false;
			//	labelViewRequestDocument.Visible=false;
			//}
			Cursor=Cursors.Default;
		}
Ejemplo n.º 8
0
        public static ListBox registerAutoComplete(TextBox txt)
        {
            ListBox lb = new ListBox();
            lb.Width = txt.Width;
            lb.Height = txt.Height * 10;
            txt.KeyUp += dynaTxtKeys;
            txt.Leave += dynaListLeave;
            //bindData(lb, dataProvider);
            lb.KeyUp += dynaListSelected;
            lb.DoubleClick += dynaListClickSelected;
            lb.Click += dynaListClickSelected;

            lb.Name = txt.Name + AUTO_COMPLETE_NAME_PAD;
            lb.Location = new System.Drawing.Point(txt.Location.X, (txt.Location.Y+txt.Height));
            txt.Parent.Controls.Add(lb);
            lb.BringToFront();
            autoCompleteListMap.Add(txt.Name, lb);
            return lb;
        }
        public ViewProjectSubmissions(Func<string> _GetProjectGUID, getmarketbyguiddelegate _GetMarketByGUID, LayoutPanelBase _Layout)
        {
            //LastQuery = _LastQuery;

            myLayout = _Layout;
            GetProjectGUID = _GetProjectGUID;
            GetMarketByGUID = _GetMarketByGUID;

            Label Title = new Label();
            Title.Text= "List of Submissions";
            Title.Dock = DockStyle.Top;

             Overall = new Label();

            Overall.MouseEnter+= HandleMouseEnter;
            Overall.MouseLeave+= HandleMouseLeave;
            Overall.Dock = DockStyle.Top;
            Overall.Text = Loc.Instance.GetString ("OVERALL DETAILS TBD");

            ToolStrip Buttons = new ToolStrip();

            Count = new ToolStripLabel();
            Count.Text = "0";

             DeleteSelected = new ToolStripButton();
            DeleteSelected.Text = Loc.Instance.GetString ("Delete Submission");
            DeleteSelected.Click+= HandleDeleteSubmissionClick;

             GenerateCoverLetter = new ToolStripButton();
            GenerateCoverLetter.Text = Loc.Instance.GetString ("Cover Letter");
            GenerateCoverLetter.Click+= HandleGenerateCoverLetterClick;

             MakeDestination = new ToolStripButton();
            MakeDestination.Text = Loc.Instance.GetString ("Change Submission to Destination");
            MakeDestination.Click+= HandleMakeDestinationsClick;
            MakeDestination.Enabled = false;

             MakeSubmission = new ToolStripButton();
            MakeSubmission.Text = Loc.Instance.GetString ("Change Destination to Submission");
            MakeSubmission.Click+= HandleChangeDestinationToSubmissionClick;;
            MakeSubmission.Enabled = false;

            Buttons.Items.Add (Count);
            Buttons.Items.Add (DeleteSelected);
            Buttons.Items.Add (GenerateCoverLetter);
            Buttons.Items.Add (MakeDestination);
            Buttons.Items.Add (MakeSubmission);

             ListOfSubs = new ListBox();
            ListOfSubs.DoubleClick+= HandleListOfSubsDoubleClick;
            ListOfSubs.Click+= HandleListOfSubmissionsClick;
            ListOfSubs.Dock = DockStyle.Fill;
            ListOfSubs.Height = 300;

            Label DestinationsTitle = new Label();
            DestinationsTitle.Text = Loc.Instance.GetString ("Destinations");
            DestinationsTitle.Dock = DockStyle.Bottom;

            Destinations = new ListBox();
            Destinations.Dock = DockStyle.Bottom;
            Destinations.Click+= HandleDestinationsClick;

            this.Controls.Add (DestinationsTitle);
            this.Controls.Add (Destinations);

            this.Controls.Add (ListOfSubs);
            ListOfSubs.BringToFront();
            this.Controls.Add (Buttons);

            this.Controls.Add (Title);
            this.Controls.Add (Overall);
            //just add the transaction objects like workflow
            //BuildList ();
        }
Ejemplo n.º 10
0
        public static void AutoCompleteTextBox(TextBox txtControl, ListBox lstControl, 
            List<string> lstAutoCompleteList, KeyEventArgs txtControlKEA)
        {
            Point cp;
            GetCaretPos(out cp);
            List<string> lstTemp = new List<string>();
            //Positioning the Listbox on TextBox by Type Insertion Cursor position
            lstControl.SetBounds(cp.X + txtControl.Location.X, cp.Y + txtControl.Location.Y + 20, 150, 50);

            var TempFilteredList = lstAutoCompleteList.Where
                (n => n.StartsWith(GetLastString(txtControl.Text))).Select(r => r);

            lstTemp = TempFilteredList.ToList<string>();
            if (lstTemp.Count != 0 && GetLastString(txtControl.Text) != "")
            {
                lstControl.DataSource = lstTemp;
                lstControl.Show();
                lstControl.BringToFront();
            }
            else
            {
                lstControl.Hide();
            }

            //Code for focusing ListBox Items While Pressing Down and UP Key.
            if (txtControlKEA.KeyCode == Keys.Down)
            {
                lstControl.SelectedIndex = 0;
                lstControl.Focus();
                txtControlKEA.Handled = true;
            }
            else if (txtControlKEA.KeyCode == Keys.Up)
            {
                lstControl.SelectedIndex = lstControl.Items.Count - 1;
                lstControl.Focus();
                txtControlKEA.Handled = true;
            }

            //text box key press event
            txtControl.KeyPress += (s, kpeArgs) =>
            {

                if (kpeArgs.KeyChar == (char)Keys.Enter)
                {
                    if (lstControl.Visible)
                    {
                        lstControl.Focus();
                    }
                    kpeArgs.Handled = true;
                }
                else if (kpeArgs.KeyChar == (char)Keys.Escape)
                {
                    lstControl.Visible = false;
                    kpeArgs.Handled = true;
                }
                else if (kpeArgs.KeyChar == (char)Keys.Tab)
                {
                    txtControl.Text = ((ListBox)s).SelectedItem.ToString();
                    txtControl.Select(txtControl.Text.Length, 0);
                    txtControl.Focus();
                    lstControl.Hide();
                }
            };

            txtControl.LostFocus += (s, eventArgs) =>
                {
                    if (!lstControl.Focused)
                        lstControl.Hide();
                };

            //listbox keyup event
            lstControl.KeyUp += (s, kueArgs) =>
            {
                if (kueArgs.KeyCode == Keys.Tab)
                {
                    //string StrLS = GetLastString(txtControl.Text);
                    //int LIOLS = txtControl.Text.LastIndexOf(StrLS);
                    //string TempStr = txtControl.Text.Remove(LIOLS);
                    //txtControl.Text = TempStr + ((ListBox)s).SelectedItem.ToString();
                    txtControl.Text = ((ListBox)s).SelectedItem.ToString();
                    txtControl.Select(txtControl.Text.Length, 0);
                    txtControl.Focus();
                    lstControl.Hide();
                }
                else if (kueArgs.KeyCode == Keys.Escape)
                {
                    lstControl.Hide();
                    txtControl.Focus();
                }
            };
        }
Ejemplo n.º 11
0
        /// <summary>
        /// ComboBox 的 OnTextChanged 事件.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnTextChanged(EventArgs e)
        {
            if (!DesignMode)
            {
                ReadTopParent();

                // 首先是 非设计 模式下才做处理.
                if (Text == "")
                {
                    // 如果什么信息都没有输入
                    // 那么不开启 模糊处理的操作.
                    // 将下拉列表设置为不可见
                    // 然后结束 并 返回.
                    lbMain.Visible = false;
                    return;
                }

                if (topParent == null)
                {
                    lbMain.Visible = false;
                    return;
                }

                if (!topParent.Controls.Contains(lbMain))
                {
                    // 如果 当前 ComboBox 控件的 父控件下,不包含 lbMain 这个控件
                    // 那么 将 lbMain 加入到当前 ComboBox 控件的 父控件下
                    // 并设置相应的坐标,在当前 ComboBox 控件的下面
                    lbMain.Width = this.Width;

                    lbMain.Height = MAIN_HEIGHT;

                    //lbMain.Parent = this.Parent;
                    lbMain.Parent = topParent;

                    //lbMain.Top = this.Top + this.Height + 1;
                    lbMain.Top = topTop;

                    //lbMain.Left = this.Left;
                    lbMain.Left = topLeft;

                    //this.Parent.Controls.Add(lbMain);
                    topParent.Controls.Add(lbMain);

                    lbMain.BringToFront();
                }

                // 得到匹配给定字符串的列表
                List <string> alFill = GetFillList(Text);
                // 清空下拉列表的数据.
                lbMain.Items.Clear();
                // 将匹配后的结果,添加到 下拉列表 中.
                lbMain.Items.AddRange(alFill.ToArray());

                if (lbMain.Items.Count > 0)
                {
                    // 如果 下拉列表中有数据
                    // 首先默认选中第一个.
                    lbMain.SelectedIndex = 0;
                }

                if (!lbMain.Visible && this.Focused)
                {
                    // 如果 当前光标在 ComboBox 控件上面
                    // 但是 下拉列表控件 又不可见的话,使该控件可见.
                    lbMain.Visible = true;
                }
            }
            base.OnTextChanged(e);
        }
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren (Layout);
            CaptionLabel.Dock = DockStyle.Top;

            mode = new ComboBox ();
            mode.Parent = ParentNotePanel;
            mode.DropDownStyle = ComboBoxStyle.DropDownList;
            mode.Dock = DockStyle.Top;
            mode.BringToFront ();

            mode.Items.Add (Loc.Instance.GetString ("Notes on This Layout"));
            mode.Items.Add (Loc.Instance.GetString ("All Layouts"));
            mode.Items.Add (Loc.Instance.GetString ("Notes on Current Layout"));

            mode.SelectedIndexChanged += HandleDropDownSelectedIndexChanged;

            SearchDetails = new Panel ();

            AdjustDockingOfSearchPanel();

            CurrentFilterDropDown = new ComboBox ();
            CurrentFilterDropDown.Dock = DockStyle.Bottom;

            // because we need the tables to be loaded we CANNOT load this data now
            LayoutDetails.Instance.UpdateAfterLoadList.Add (this);

            TextEditor = new ComboBox ();
            TextEditor.Dock = DockStyle.Bottom;
            TextEditor.KeyPress += HandleTextEditKeyPress;
            TextEditor.KeyUp += HandleKeyUp;

            // Do some cleanup on history item to keep the list reasonable.
            // This happens only on load to keep things simple
            if (History.Count > 10) {
                History.RemoveRange(9, (History.Count)-9);
            }

            foreach (string s in History) {
                TextEditor.Items.Add (s);
            }

            TextEditor.SelectedIndexChanged+= (object sender, EventArgs e) => 	Refresh ();;

            FullTextSearch = new CheckBox();
            FullTextSearch.Checked = false;
            FullTextSearch.Text = Loc.Instance.GetString ("Search All Text Fields");
            FullTextSearch.Dock = DockStyle.Bottom;

            SearchDetails.Controls.Add (TextEditor);
            SearchDetails.Controls.Add (CurrentFilterDropDown);
            SearchDetails.Controls.Add (FullTextSearch);

            list = new ListBox();
            //list.SelectedIndexChanged += HandleDropDownSelectedIndexChanged;
            list.Parent = ParentNotePanel;
            list.Width = 125;
            list.Dock = DockStyle.Fill;
            list.BringToFront();
            list.BindingContextChanged+= HandleBindingContextChanged;
            list.DoubleClick += HandleListBoxDoubleClick;
            list.Click+= HandleNoteListClick;

            ParentNotePanel.Controls.Add (SearchDetails);

            count = new Label();
            count.Parent = ParentNotePanel;
            count.Dock = DockStyle.Bottom;

            blurb = new Label();
            blurb.Parent = ParentNotePanel;
            blurb.Dock = DockStyle.Bottom;

            refresh = new Button();
            refresh.Text = Loc.Instance.GetString("Refresh");
            refresh.Dock = DockStyle.Bottom;
            refresh.Parent = ParentNotePanel;
            refresh.Click += HandleRefreshClick;

            //Menu Stuff

             TokenItem = new ToolStripMenuItem(Loc.Instance.GetString("Dock on Bottom?"));
            TokenItem.CheckOnClick = true;
            TokenItem.Click += (object sender, EventArgs e) => {
                searchDetailsDock = (sender as ToolStripMenuItem).Checked;
                AdjustDockingOfSearchPanel();
                this.SetSaveRequired(true);
            };
            if (searchDetailsDock) TokenItem.Checked = true; else TokenItem.Checked= false;

            properties.DropDownItems.Add (new ToolStripSeparator());
            properties.DropDownItems.Add (TokenItem);

            //	AdjustHeightOfLayoutSearchPanel (); This already gets called when the note type is chosen
        }