Beispiel #1
0
 private void addControlInManager(string name, DockStyle style, int x, int y)
 {
     if (toolStrip1.Text == name)
     {
         _toolbarManager.AddControl(toolStrip1, style, new Point(x, y));
     }
     else if (toolStrip2.Text == name)
     {
         _toolbarManager.AddControl(toolStrip2, style, new Point(x, y));
     }
     else
     {
         _toolbarManager.AddControl(toolBar1, style, new Point(x, y));
     }
 }
Beispiel #2
0
        protected MainForm(AutoOpenMode autoOpenMode, string autoOpenParam)
        {
            this.autoOpenMode  = autoOpenMode;
            this.autoOpenParam = autoOpenParam;

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();


            Directory.CreateDirectory(Path.GetDirectoryName(configFile));
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            toolBarManager = new ToolBarManager(this, this);

            // add toolbars
            ToolBarDockHolder holder;

            // main tool bar
            mainToolBar.Text      = "Main Tool Bar";
            holder                = toolBarManager.AddControl(mainToolBar);
            holder.AllowedBorders = AllowedBorders.Top | AllowedBorders.Left | AllowedBorders.Right;

            // image toolbar
            imageToolBar.Text     = "Image Tool Bar";
            holder                = toolBarManager.AddControl(imageToolBar);
            holder.AllowedBorders = AllowedBorders.Top | AllowedBorders.Left | AllowedBorders.Right;

            histogramWin.DockStateChanged  += new EventHandler(histogram_DockStateChanged);
            statisticsWin.DockStateChanged += new EventHandler(statistics_DockStateChanged);

            histogramWin.VisibleChanged  += new EventHandler(histogram_VisibleChanged);
            statisticsWin.VisibleChanged += new EventHandler(statistics_VisibleChanged);

            // set up drag-n-drop support
            this.dockManager.DragDrop  += new System.Windows.Forms.DragEventHandler(this.dockManager_DragDrop);
            this.dockManager.DragEnter += new System.Windows.Forms.DragEventHandler(this.dockManager_DragEnter);
            this.dockManager.AllowDrop  = true;
        }
Beispiel #3
0
 private void Form1_Load(object sender, EventArgs e)
 {
     controls        = new ArrayList();
     _toolbarManager = new ToolBarManager(this, this);
     controls.Add(toolBar1);
     controls.Add(toolStrip1);
     controls.Add(toolStrip2);
     if (File.Exists(configFile))
     {
         if (!LoadFromXml())
         {
             MessageBox.Show("读取配置文件出错!");
         }
     }
     else
     {
         _toolbarManager.AddControl(toolBar1, DockStyle.Top, new Point(0, 22));
         _toolbarManager.AddControl(toolStrip1, DockStyle.None, new Point(185, 43));
         _toolbarManager.AddControl(toolStrip2, DockStyle.Top, new Point(0, 0));
     }
 }
Beispiel #4
0
        private void initToolBarManager()
        {
            BoDinhGio          = new Timer();
            BoDinhGio.Interval = 60000;
            BoDinhGio.Enabled  = true;
            BoDinhGio.Tick    += new EventHandler(BoDinhGio_Tick);

            _toolBarManager   = new ToolBarManager(this, this);
            panelTop.AutoSize = true;
            panelTop.Size     = new Size(this.Width, 44);
            _toolBarManager.AddControl(panelTop, DockStyle.Top);
            statusBar            = new StatusBar();
            statusBar.ShowPanels = true;
            statusBar.Panels.AddRange((StatusBarPanel[])new StatusBarPanel[] { sbPnlVungTrong, sbPnlHoTen, sbPnlTenDangNhap, sbPnlNgay, sbPnlGio });

            sbPnlVungTrong.BorderStyle = StatusBarPanelBorderStyle.Raised;
            sbPnlVungTrong.AutoSize    = StatusBarPanelAutoSize.Spring;
            //sbPnlHoTen.Alignment = System.Windows.Forms.HorizontalAlignment.Right;

            sbPnlHoTen.BorderStyle = StatusBarPanelBorderStyle.Raised;
            //sbPnlHoTen.AutoSize = StatusBarPanelAutoSize.Spring;
            //sbPnlHoTen.Alignment = System.Windows.Forms.HorizontalAlignment.Right;

            sbPnlTenDangNhap.BorderStyle = StatusBarPanelBorderStyle.Raised;
            //sbPnlTenDangNhap.AutoSize = StatusBarPanelAutoSize.Spring;
            // sbPnlHoTen.Alignment = System.Windows.Forms.HorizontalAlignment.Right;

            sbPnlNgay.BorderStyle = StatusBarPanelBorderStyle.Raised;
            //sbPnlNgay.AutoSize = StatusBarPanelAutoSize.Spring;
            // sbPnlNgay.Alignment = System.Windows.Forms.HorizontalAlignment.Right;

            sbPnlGio.BorderStyle = StatusBarPanelBorderStyle.Raised;
            //sbPnlGio.AutoSize = StatusBarPanelAutoSize.Spring;
            // sbPnlGio.Alignment = System.Windows.Forms.HorizontalAlignment.Right;

            this.Controls.Add(statusBar);
        }
Beispiel #5
0
        private void InitializeUserControls()
        {
            transportToolStrip.Size = transportToolStrip.Size;
            //_toolBarManager.AddControl(transportToolStrip);
            ToolBarDockHolder holder = _toolBarManager.AddControl(transportToolStrip, DockStyle.Bottom);

            //
            // _imageList
            //
            this._imageList = new System.Windows.Forms.ImageList();//this.components);
            //this._imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("_imageList.ImageStream")));
            this._imageList.TransparentColor = System.Drawing.Color.Transparent;
            this._imageList.ImageSize        = new Size(64, 64);
            this._imageList.Images.Add(Bitmap.FromFile(@"..\..\images\icons\go-down.png"));
            this._imageList.Images.Add(Bitmap.FromFile(@"..\..\images\icons\go-first.png"));
            this._imageList.Images.Add(Bitmap.FromFile(@"..\..\images\icons\go-previous.png"));
            //this._imageList.Images.SetKeyName(1, "");
            //this._imageList.Images.SetKeyName(2, "");
            //this._imageList.Images.SetKeyName(3, "");
            //this._imageList.Images.SetKeyName(4, "");
            //this._imageList.Images.SetKeyName(5, "");
            //this._imageList.Images.SetKeyName(6, "");
            //this._imageList.Images.SetKeyName(7, "");
            //this._imageList.Images.SetKeyName(8, "");
            //this._imageList.Images.SetKeyName(9, "");
            //this._imageList.Images.SetKeyName(10, "");
            //this._imageList.Images.SetKeyName(11, "");
            //this._imageList.Images.SetKeyName(12, "");

            this._toolBar4    = new System.Windows.Forms.ToolBar();
            this._richTextBox = new System.Windows.Forms.RichTextBox();
            this._button1     = new ToolBarButton();
            //this._button1.Text = "A";
            this._button1.ImageIndex = 0;
            this._button2            = new ToolBarButton();
            this._button2.ImageIndex = 1;
            //this._button2.Text = "B";
            this._button3            = new ToolBarButton();
            this._button3.ImageIndex = 2;
            //this._button3.Text = "C";
            this._toolBar4.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
            this._toolBar4.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
                this._button1, this._button2, this._button3
            });
            this._toolBar4.Divider        = false;
            this._toolBar4.Dock           = System.Windows.Forms.DockStyle.None;
            this._toolBar4.DropDownArrows = true;
            this._toolBar4.ImageList      = this._imageList;
            this._toolBar4.Location       = new System.Drawing.Point(0, 0);
            this._toolBar4.Name           = "_toolBar4";
            this._toolBar4.ShowToolTips   = true;
            this._toolBar4.Size           = new System.Drawing.Size(100, 26);
            this._toolBar4.TabIndex       = 3;
//            this.Controls.Add(this._toolBar4);
            _toolBar4.Text = "Built in code using ToolBar and ToolBarButton";



            _toolBarManager.AddControl(_toolBar4, DockStyle.Left);

            transportToolBar.Text = "Built in designer using ToolBar and ToolBarButton";
            _toolBarManager.AddControl(transportToolBar, DockStyle.Right);
        }