Esempio n. 1
0
		private int InitToolbarUnderline(int x, int y)
		{
			ctlUnderline = new SimpleToggle();
			ctlUnderline.UpColor = this.BackColor;
			ctlUnderline.Click +=new EventHandler(ctlUnderline_Click);
			ctlUnderline.Font = new Font("Courier New", 10, FontStyle.Underline | FontStyle.Bold);
			ctlUnderline.Text = "U";
			using ( Graphics g = ctlUnderline.CreateGraphics() )
			{
				SizeF fs = g.MeasureString( ctlUnderline.Text, ctlUnderline.Font );
				ctlUnderline.Height = (int) fs.Height + 6;	// 6 is for margins
				ctlUnderline.Width = ctlUnderline.Height;		
			}

			ctlUnderline.Tag = "italic";
			ctlUnderline.Left = x;
			ctlUnderline.Top = y;
			ctlUnderline.FlatStyle = FlatStyle.Flat;
			ToolTip tipb = new ToolTip();
			tipb.AutomaticDelay = 500;
			tipb.ShowAlways = true;
			tipb.SetToolTip(ctlUnderline, "Underline");
			mainTB.Controls.Add(ctlUnderline);

			return ctlUnderline.Width;
		}
Esempio n. 2
0
        private SimpleToggle InitToolbarInsertToggle(ref int x, int y, string t,
            Image bImg, EventHandler eh)
        {
            SimpleToggle ctl = new SimpleToggle();
            ctl.UpColor = this.BackColor;
            ctl.Click += eh;	// click handler for all inserts

            if (bImg == null)
            {
                ctl.Text = t;
                using (Graphics g = ctl.CreateGraphics())
                {
                    SizeF fs = g.MeasureString(ctl.Text, ctl.Font);
                    ctl.Height = (int)fs.Height + 8;	// 8 is for margins
                    ctl.Width = (int)fs.Width + 12;
                }
            }
            else
            {
                ctl.Image = bImg;
                ctl.ImageAlign = ContentAlignment.MiddleCenter;
                ctl.Height = bImg.Height + 5;
                ctl.Width = bImg.Width + 8;
                ctl.Text = "";
            }

            ctl.Tag = t;
            ctl.Left = x;
            ctl.Top = y;
            ctl.FlatStyle = FlatStyle.Flat;
            ToolTip tipb = new ToolTip();
            tipb.AutomaticDelay = 500;
            tipb.ShowAlways = true;
            tipb.SetToolTip(ctl, t);
            mainTB.Controls.Add(ctl);

            x = x + ctl.Width;

            return ctl;
        }
Esempio n. 3
0
		private int InitToolbarBold(int x, int y)
		{
			ctlBold = new SimpleToggle();
			ctlBold.UpColor = this.BackColor;

			ctlBold.Click +=new EventHandler(ctlBold_Click);
			
			ctlBold.Font = new Font("Courier New", 10, FontStyle.Bold);
			ctlBold.Text = "B";
			using ( Graphics g = ctlBold.CreateGraphics() )
			{
				SizeF fs = g.MeasureString( ctlBold.Text, ctlBold.Font );
				ctlBold.Height = (int) fs.Height + 6;	// 6 is for margins
				ctlBold.Width = ctlBold.Height;		
			}

			ctlBold.Tag = "bold";
			ctlBold.Left = x;
			ctlBold.Top = y;
			ctlBold.FlatStyle = FlatStyle.Flat;
			ctlBold.TextAlign = ContentAlignment.MiddleCenter;

			ToolTip tipb = new ToolTip();
			tipb.AutomaticDelay = 500;
			tipb.ShowAlways = true;
			tipb.SetToolTip(ctlBold, "Bold");
			mainTB.Controls.Add(ctlBold);

			return ctlBold.Width;
		}
Esempio n. 4
0
		private void InitToolbar()
		{
			bool bResumeLayout=false;
			// Clear out anything from before
			if (mainTB != null)
			{
				this.SuspendLayout();
				mainTB.SuspendLayout();
				bResumeLayout=true;
				mainTB.Controls.Clear();
				if (ctlBold!=null) {ctlBold=null;}
				if (ctlItalic!=null) {ctlItalic=null;}
				if (ctlUnderline!=null) {ctlUnderline=null;}
				if (ctlFont!=null) {ctlFont=null;}
				if (ctlFontSize!=null) {ctlFontSize=null;}
				if (ctlForeColor!=null) {ctlForeColor=null;}
				if (ctlBackColor!=null) {ctlBackColor=null;}
				if (ctlNew!=null) {ctlNew=null;}
				if (ctlOpen!=null) {ctlOpen=null;}
				if (ctlSave!=null) {ctlSave=null;}
				if (ctlCut!=null) {ctlCut=null;}
				if (ctlCopy!=null) {ctlCopy=null;}
				if (ctlUndo!=null) {ctlUndo=null;}
				if (ctlPaste!=null) {ctlPaste=null;}
				if (ctlPrint!=null) {ctlPrint=null;}
				if (ctlPdf!=null) {ctlPdf=null;}
				if (ctlXml!=null) {ctlXml=null;}
				if (ctlHtml!=null) {ctlHtml=null;}
				if (ctlMht!=null) {ctlMht=null;}
				if (ctlZoom!=null) {ctlZoom=null;}
				if (ctlInsertCurrent!=null) {ctlInsertCurrent=null;}
				if (ctlInsertTextbox!=null) {ctlInsertTextbox=null;}
				if (ctlInsertChart!=null) {ctlInsertChart=null;}
				if (ctlInsertRectangle!=null) {ctlInsertRectangle=null;}
				if (ctlInsertTable!=null) {ctlInsertTable=null;}
				if (ctlInsertMatrix!=null) {ctlInsertMatrix=null;}
				if (ctlInsertList!=null) {ctlInsertList=null;}
				if (ctlInsertLine!=null) {ctlInsertLine=null;}
				if (ctlInsertImage!=null) {ctlInsertImage=null;}
				if (ctlInsertSubreport!=null) {ctlInsertSubreport=null;}
				if (ctlEditTextbox!=null){ctlEditTextbox=null;}
				if (ctlEditLabel!=null){ctlEditLabel=null;}
			}
			else
			{
				mainTB = new ToolBar();
                mainTB.SizeChanged += new EventHandler(mainTB_SizeChanged);
				mainTB.SuspendLayout();
			}
			const int LINEHEIGHT = 22;
			const int LEFTMARGIN = 5;
			int y = 2;
			int x = LEFTMARGIN;

			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(RdlDesigner));

			// Build the controls the user wants
			foreach (string tbi in _Toolbar)
			{
				switch (tbi)
				{
					case "\n":
					case "Newline":
						y += LINEHEIGHT;
						x = LEFTMARGIN;
						break;
					case "Bold":
						x += InitToolbarBold(x,y);
						break;
					case "Italic":
						x += InitToolbarItalic(x,y);
						break;
					case "Underline":
						x += InitToolbarUnderline(x,y);
						break;
					case "Space":
						x += 5;
						break;
					case "Font":
						x += InitToolbarFont(x,y);
						break;
					case "FontSize":
						x += InitToolbarFontSize(x,y);
						break;
					case "ForeColor":
						ctlForeColor = InitToolbarColor(ref x, y, "Fore Color");
						ctlForeColor.SelectedValueChanged +=new EventHandler(ctlForeColor_Change);
						ctlForeColor.Validated +=new EventHandler(ctlForeColor_Change);
						break;
					case "BackColor":
						ctlBackColor = InitToolbarColor(ref x, y, "Back Color");
						ctlBackColor.SelectedValueChanged +=new EventHandler(ctlBackColor_Change);
						ctlBackColor.Validated +=new EventHandler(ctlBackColor_Change);
						break;
					case "New":
						ctlNew = InitToolbarMenu(ref x, y, "New", bNew.Image, new EventHandler(this.menuFileNewReport_Click));
						break;
					case "Open":
						ctlOpen = InitToolbarMenu(ref x, y, "Open", bOpen.Image, new EventHandler(this.menuFileOpen_Click));
						break;
					case "Save":
						ctlSave = InitToolbarMenu(ref x, y, "Save", bSave.Image, new EventHandler(this.menuFileSave_Click));
						break;
					case "Cut":
						ctlCut = InitToolbarMenu(ref x, y, "Cut", bCut.Image, new EventHandler(this.menuEditCut_Click));
						break;
					case "Copy":
						ctlCopy = InitToolbarMenu(ref x, y, "Copy", bCopy.Image, new EventHandler(this.menuEditCopy_Click));
						break;
					case "Undo":
						ctlUndo = InitToolbarMenu(ref x, y, "Undo", bUndo.Image, new EventHandler(this.menuEditUndo_Click));
						break;
					case "Paste":
						ctlPaste = InitToolbarMenu(ref x, y, "Paste", bPaste.Image, new EventHandler(this.menuEditPaste_Click));
						break;
					case "Print":
						ctlPrint = InitToolbarMenu(ref x, y, "Print", bPrint.Image, new EventHandler(this.menuFilePrint_Click));
						break;
					case "XML":
						ctlXml = InitToolbarMenu(ref x, y, "XML", bXml.Image, new EventHandler(this.menuExportXml_Click));
						break;
					case "PDF":
						ctlPdf = InitToolbarMenu(ref x, y, "PDF", bPdf.Image, new EventHandler(this.menuExportPdf_Click));
						break;
					case "HTML":
						ctlHtml = InitToolbarMenu(ref x, y, "HTML", bHtml.Image, new EventHandler(this.menuExportHtml_Click));
						break;
					case "MHT":
						ctlMht = InitToolbarMenu(ref x, y, "MHT", bMht.Image, new EventHandler(this.menuExportMHtml_Click));
						break;
					case "Edit":
						ctlEditTextbox = InitToolbarEditTextbox(ref x, y);
						break;
					case "Textbox":
						ctlInsertTextbox = InitToolbarInsertToogle(ref x, y, "Textbox", bText.Image);
						break;
					case "Chart":
						ctlInsertChart = InitToolbarInsertToogle(ref x, y, "Chart", bChart.Image);
						break;
					case "Rectangle":
						ctlInsertRectangle = InitToolbarInsertToogle(ref x, y, "Rectangle", bRectangle.Image);
						break;
					case "Table":
						ctlInsertTable = InitToolbarInsertToogle(ref x, y, "Table",	bTable.Image);
						break;
					case "Matrix":
						ctlInsertMatrix = InitToolbarInsertToogle(ref x, y, "Matrix", bMatrix.Image);
						break;
					case "List":
						ctlInsertList = InitToolbarInsertToogle(ref x, y, "List", bList.Image);
						break;
					case "Line":
						ctlInsertLine = InitToolbarInsertToogle(ref x, y, "Line", bLine.Image);
						break;
					case "Image":
						ctlInsertImage = InitToolbarInsertToogle(ref x, y, "Image", bImage.Image);
						break;
					case "Subreport":
						ctlInsertSubreport = InitToolbarInsertToogle(ref x, y, "Subreport", bSubreport.Image);
						break;
					case "Zoom":
						ctlZoom = InitToolbarZoom(ref x, y);
						ctlZoom.SelectedValueChanged +=new EventHandler(ctlZoom_Change);
						ctlZoom.Validated +=new EventHandler(ctlZoom_Change);
						break;
					default:
						break;
				}
			}
            
            // put the tab control in
            if (mainTC == null)
            {
                mainTC = new TabControl();
                mainTC.SelectedIndexChanged += new EventHandler(mainTC_SelectedIndexChanged);
                mainTC.ShowToolTips = true;
            }
            mainTC.Parent = mainTB;
            mainTC.Visible = _ShowTabbedInterface;
            if (_ShowTabbedInterface)
            {   // When tabbed we force the mdi children to be maximized (on reset)
                foreach (MDIChild mc in this.MdiChildren)
                {
                    mc.WindowState = FormWindowState.Maximized;
                }
            }
            mainTC.Location = new Point(0, y + LINEHEIGHT + 1);
            mainTC.Size = new Size(mainTB.Width, LINEHEIGHT);
            if (_ShowTabbedInterface)
                y += LINEHEIGHT;

            mainTB.Parent = this;
			mainTB.BorderStyle = BorderStyle.None;
			mainTB.DropDownArrows = true;
			mainTB.Name = "mainTB";
			mainTB.ShowToolTips = true;
			//			mainTB.Size = new Size(440,20);
			mainTB.TabIndex = 1;
			mainTB.AutoSize = false;
			mainTB.Height = y + LINEHEIGHT + 1;     // 1 was 4	
			if (bResumeLayout)
			{
				mainTB.ResumeLayout();
				this.ResumeLayout();
			}
		}
Esempio n. 5
0
		private void Insert_Click(object sender, EventArgs e)
		{
			if (ctlInsertCurrent != null)
				ctlInsertCurrent.Checked = false;

			SimpleToggle ctl = (SimpleToggle) sender;
			ctlInsertCurrent = ctl.Checked? ctl: null;

			MDIChild mc = this.ActiveMdiChild as MDIChild;
			if (mc == null)
				return;
			mc.SetFocus();

			mc.CurrentInsert = ctlInsertCurrent == null? null: (string) ctlInsertCurrent.Tag;		
		}
Esempio n. 6
0
		private void ReportItemInserted(object sender, System.EventArgs e)
		{
			MDIChild mc = this.ActiveMdiChild as MDIChild;
			if (mc == null)
				return;

			// turn off the current selection after an item is inserted
			if (ctlInsertCurrent != null)
			{
				ctlInsertCurrent.Checked = false;
				mc.CurrentInsert = null;
				ctlInsertCurrent = null;
			}
		}
Esempio n. 7
0
        private int InitToolbarSelectTool(int x, int y)
        {
            ctlSelectTool = new SimpleToggle();
            ctlSelectTool.Image = bSelectTool.Image;
            ctlSelectTool.ImageAlign = ContentAlignment.MiddleCenter;
            ctlSelectTool.Height = ctlSelectTool.Image.Height + 5;
            ctlSelectTool.Width = ctlSelectTool.Image.Width + 8;
            ctlSelectTool.Text = "";

            ctlSelectTool.Click += new EventHandler(ctlSelectTool_Click);

            ctlSelectTool.Tag = "Selection Tool";
            ctlSelectTool.Left = x;
            ctlSelectTool.Top = y;
            ctlSelectTool.FlatStyle = FlatStyle.Flat;
            ctlSelectTool.TextAlign = ContentAlignment.MiddleCenter;

            ToolTip tipb = new ToolTip();
            tipb.AutomaticDelay = 500;
            tipb.ShowAlways = true;
            tipb.SetToolTip(ctlSelectTool, "Selection Tool");
            mainTB.Controls.Add(ctlSelectTool);

            return ctlSelectTool.Width;
        }