コード例 #1
0
ファイル: GfxPrinter.cs プロジェクト: jsuen123/openpetragit
        /// <summary>
        /// todoComment
        /// </summary>
        public override void Init(eOrientation AOrientation, TPrinterLayout APrinterLayout, eMarginType AMarginType)
        {
            base.Init(AOrientation, APrinterLayout, AMarginType);
            SetPageSize();

            if (AOrientation == eOrientation.ePortrait)
            {
                FDocument.DefaultPageSettings.Margins.Left   = Convert.ToInt32(Cm2Inch(0.5f) * 100);
                FDocument.DefaultPageSettings.Margins.Right  = Convert.ToInt32(Cm2Inch(0.5f) * 100);
                FDocument.DefaultPageSettings.Margins.Top    = Convert.ToInt32(Cm2Inch(0.5f) * 100);
                FDocument.DefaultPageSettings.Margins.Bottom = Convert.ToInt32(Cm2Inch(1) * 100);
            }
            else if (AOrientation == eOrientation.eLandscape)
            {
                FDocument.DefaultPageSettings.Margins.Left   = Convert.ToInt32(Cm2Inch(0.5f) * 100);
                FDocument.DefaultPageSettings.Margins.Right  = Convert.ToInt32(Cm2Inch(1) * 100);
                FDocument.DefaultPageSettings.Margins.Top    = Convert.ToInt32(Cm2Inch(0.5f) * 100);
                FDocument.DefaultPageSettings.Margins.Bottom = Convert.ToInt32(Cm2Inch(0.5f) * 100);
            }

            // Associate the eventhandling method with the
            // document's PrintPage event.
            FDocument.PrintPage  += new PrintPageEventHandler(this.PrintPage);
            FDocument.BeginPrint += new PrintEventHandler(this.BeginPrint);
            FDocument.EndPrint   += new PrintEventHandler(this.EndPrint);

            FDocument.DefaultPageSettings.Landscape = (FOrientation == eOrientation.eLandscape);
        }
コード例 #2
0
ファイル: LayoutDetector.cs プロジェクト: wirfree/CVCapture
 public LayoutDetector(Mat graySrcImage, RegionInfo region, Variables v)
 {
     _graySrcImage   = GetPartial(graySrcImage, region);
     _region         = region;
     _v              = v;
     _binarizedImage = GetBinary();
     _vertical       = AnalyseVerticalSumUp();
     _horizontal     = AnalyseHorizontalSumUp();
     if (_vertical.Count >= _horizontal.Count)
     {
         Orientation = eOrientation.Vertical;
     }
     else
     {
         Orientation = eOrientation.Horizontal;
     }
     if (Orientation == eOrientation.Vertical)
     {
         _childRegions = _vertical.Select(p => Segment2Region(p)).ToList();
     }
     else
     {
         _childRegions = _horizontal.Select(p => Segment2Region(p)).ToList();
     }
 }
コード例 #3
0
		public static ItemContainer CreateItemContainer(IDesignerServices designer, BaseItem parent, eOrientation containerOrientation)
		{
			IDesignerHost dh=designer.GetService(typeof(IDesignerHost)) as IDesignerHost;
			IComponentChangeService cc=designer.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
			
			if(dh==null || parent==null || cc==null)
				return null;

			ItemContainer c=null;

			DesignerTransaction trans=dh.CreateTransaction("New DotNetBar Item Container");
			try
			{
				c=dh.CreateComponent(typeof(ItemContainer)) as ItemContainer;
				TypeDescriptor.GetProperties(c)["LayoutOrientation"].SetValue(c,containerOrientation);
				cc.OnComponentChanging(parent,TypeDescriptor.GetProperties(c)["SubItems"]);
				parent.SubItems.Add(c);
				cc.OnComponentChanged(parent,TypeDescriptor.GetProperties(c)["SubItems"],null,null);
			}
			finally
			{
				if(!trans.Canceled)
					trans.Commit();
			}

			return c;
        }
コード例 #4
0
ファイル: TxtPrinter.cs プロジェクト: Davincier/openpetra
        /// <summary>
        /// set the orientation of the page
        /// </summary>
        public override void Init(eOrientation AOrientation, TPrinterLayout APrinterLayout, eMarginType AMarginType)
        {
            base.Init(AOrientation, APrinterLayout, AMarginType);

            // FWidth: don't try to fit on a page at the moment
            FWidth = DEFAULT_LENGTH_LINE;
            FLeftMargin = 0;
            FRightMargin = 0;
            CurrentPageNr = 1;
        }
コード例 #5
0
        /// <summary>
        /// set the orientation of the page
        /// </summary>
        public override void Init(eOrientation AOrientation, TPrinterLayout APrinterLayout, eMarginType AMarginType)
        {
            base.Init(AOrientation, APrinterLayout, AMarginType);

            // FWidth: don't try to fit on a page at the moment
            FWidth        = DEFAULT_LENGTH_LINE;
            FLeftMargin   = 0;
            FRightMargin  = 0;
            CurrentPageNr = 1;
        }
コード例 #6
0
 /// <summary>
 /// constructor
 ///
 /// </summary>
 public TPrinter() : base()
 {
     FOrientation     = eOrientation.ePortrait;
     PrintingMode     = ePrintingMode.eDoPrint;
     FMarginType      = eMarginType.eDefaultMargins;
     CurrentPageNr    = 0;
     FNumberOfPages   = 0;
     CurrentFont      = eFont.eDefaultFont;
     FPageFooterSpace = 0;
 }
コード例 #7
0
        /// <summary>
        /// set the orientation based on the attribute: ControlsOrientation;
        /// the default is vertical
        /// </summary>
        /// <param name="ACtrl"></param>
        public void SetOrientation(TControlDef ACtrl)
        {
            FOrientation = eOrientation.Vertical;

            if (TYml2Xml.HasAttribute(ACtrl.xmlNode, "ControlsOrientation") &&
                (TYml2Xml.GetAttribute(ACtrl.xmlNode, "ControlsOrientation").ToLower() == "horizontal"))
            {
                FOrientation = eOrientation.Horizontal;
            }
        }
コード例 #8
0
        public override void RecordSetting(BaseItem item)
        {
            if (this.SettingsRecorded)
                return;
            
            ItemContainer cont = item as ItemContainer;
            m_MultiLine = cont.MultiLine;
            m_LayoutOrientation = cont.LayoutOrientation;

            base.RecordSetting(item);
        }
コード例 #9
0
		/// <summary>
		/// Creates new instance of the object and initializes it with specified values.
		/// </summary>
		/// <param name="documents">Array of documents to host in this container.</param>
		/// <param name="orientation">Container orientation</param>
		public DocumentDockContainer(DocumentBaseContainer[] documents, eOrientation orientation)
		{
			m_Orientation=orientation;
			m_Documents.Owner=this;
			m_Documents.DocumentAdded+=new EventHandler(DocumentAdded);
			m_Documents.DocumentRemoved+=new EventHandler(DocumentRemoved);

			if(documents!=null)
			{
				foreach(DocumentBaseContainer doc in documents)
					m_Documents.Add(doc);
			}
		}
コード例 #10
0
		private void CreateContainer(eOrientation orientation)
		{
            try
            {
                m_CreatingItem = true;
                DesignerSupport.CreateItemContainer(this, (BaseItem)this.Component, orientation);
                this.RecalcLayout();
            }
            finally
            {
                m_CreatingItem = false;
            }
		}
コード例 #11
0
 private void PrinterSettings(ExcelWorksheet ws, int?repeatedRow = null, eOrientation orientation = eOrientation.Portrait)
 {
     ws.PrinterSettings.PaperSize   = ePaperSize.A4;
     ws.PrinterSettings.Orientation = orientation;
     //ws.PrinterSettings.VerticalCentered = true;
     ws.PrinterSettings.HorizontalCentered = true;
     ws.PrinterSettings.FitToPage          = true;
     ws.PrinterSettings.FitToWidth         = 1;
     ws.PrinterSettings.FitToHeight        = 0;
     if (repeatedRow.HasValue)
     {
         ws.PrinterSettings.RepeatRows = new ExcelAddress($"{repeatedRow}:{repeatedRow}");
     }
 }
コード例 #12
0
        protected static void ApplyPrinterSettings(ExcelWorksheet worksheet, eOrientation pageOrientation, int startPrintTitle, int endPrintTitle)
        {
            worksheet.PrinterSettings.PaperSize   = ePaperSize.A4;
            worksheet.PrinterSettings.Orientation = pageOrientation;
            worksheet.PrinterSettings.FitToPage   = true;
            worksheet.PrinterSettings.FitToWidth  = 1;
            worksheet.PrinterSettings.FitToHeight = 0;

            // Page borders
            worksheet.PrinterSettings.TopMargin    = 2.4M / 2.54M;
            worksheet.PrinterSettings.RightMargin  = 0.8M / 2.54M;
            worksheet.PrinterSettings.BottomMargin = 1.4M / 2.54M;
            worksheet.PrinterSettings.LeftMargin   = 0.8M / 2.54M;

            // Print title
            worksheet.PrinterSettings.RepeatRows = new ExcelAddress($"${startPrintTitle}:${endPrintTitle}");
        }
コード例 #13
0
ファイル: FormPanelForHisto.cs プロジェクト: cyrenaique/HCSA
        public FormPanelForHisto(List<cExtendedList> ListValues, bool IsStacked, eGraphType GraphType, eOrientation HistoOrientation)
        {
            InitializeComponent();
            this.IsStacked = IsStacked;
            this.HistoOrientation = HistoOrientation;
            this.ListValues = ListValues;

            #region adapt the context menu
            if (this.ListValues.Count > 1)
            {
                ToolStripMenuItem_Stacked = new ToolStripMenuItem("Stacked");
                ToolStripMenuItem_Stacked.CheckOnClick = true;
                ToolStripMenuItem_Stacked.Checked = IsStacked;
                ToolStripMenuItem_Stacked.Click += new System.EventHandler(this.ChangeStackedState);

                contextMenuStrip.Items.Add(ToolStripMenuItem_Stacked);
            }

            this.GraphType = GraphType;
            if (this.GraphType == eGraphType.HISTOGRAM)
            {
                ToolStripMenuItem_BinNumber = new ToolStripMenuItem("Bin Number");
                // ToolStripMenuItem_Stacked.CheckOnClick = true;
                // ToolStripMenuItem_Stacked.Checked = IsStacked;
                ToolStripMenuItem_BinNumber.Click += new System.EventHandler(this.ChangeBinNumber);

                contextMenuStrip.Items.Add(ToolStripMenuItem_BinNumber);

            }
            #endregion

            CurrentChartArea = new ChartArea();
            CurrentChartArea.BorderColor = Color.Black;

            this.chart.ChartAreas.Add(CurrentChartArea);

            this.chart.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDoubleClick);
            this.chart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart_MouseClick);
            RedrawHisto();
        }
コード例 #14
0
 protected Vector3 GetRayAngle(eOrientation orientation)
 {
     if (orientation == eOrientation.up)
     {
         return(transform.up.normalized);
     }
     else if (orientation == eOrientation.down)
     {
         return(-transform.up.normalized);
     }
     else if (orientation == eOrientation.right)
     {
         return(transform.right.normalized);
     }
     else if (orientation == eOrientation.left)
     {
         return(-transform.right.normalized);
     }
     else if (orientation == eOrientation.downRight)
     {
         return((-transform.up + transform.right).normalized);
     }
     else if (orientation == eOrientation.left)
     {
         return((-transform.up - transform.right).normalized);
     }
     else if (orientation == eOrientation.upRight)
     {
         return((transform.up + transform.right).normalized);
     }
     else if (orientation == eOrientation.upLeft)
     {
         return((transform.up - transform.right).normalized);
     }
     return(this.zeroVector3);
 }
コード例 #15
0
        /// <summary>
        /// this function should be used for any collection of controls: on a TabPage, in a table, in a groupbox, radio button list etc.
        /// </summary>
        /// <returns>the layout control that still needs to be added to the parent</returns>
        public void CreateLayout(TFormWriter writer, TControlDef parentContainer, TControlDef layoutPanel, Int32 ANewWidth, Int32 ANewHeight)
        {
            if (layoutPanel == null)
            {
                layoutPanel = parentContainer;
            }

            // first check if the table layout has already been defined in the container with sets of rows?
            XmlNode containerNode = parentContainer.xmlNode;
            XmlNode controlsNode = TXMLParser.GetChild(containerNode, "Controls");

            if (controlsNode != null)
            {
                FTabOrder = TYml2Xml.GetAttribute(controlsNode, "TabOrder");
            }

            List <XmlNode>childNodes = TYml2Xml.GetChildren(controlsNode, true);

            if ((childNodes.Count > 0) && TYml2Xml.GetElementName(childNodes[0]).StartsWith("Row"))
            {
                // create a layout using the defined rows in Controls
                // create TableLayoutPanel that has as many columns (including the labels) and rows as needed
                FOrientation = eOrientation.TableLayout;
                FCurrentRow = 0;
                FCurrentColumn = 0;
                FColumnCount = 2;

                // determine maximum number of columns
                foreach (XmlNode row in TYml2Xml.GetChildren(controlsNode, true))
                {
                    // one other column for the label; will be cleaned up in WriteTableLayout
                    int columnCount = 2 * TYml2Xml.GetElements(row).Count;

                    if (columnCount > FColumnCount)
                    {
                        FColumnCount = columnCount;
                    }
                }

                FRowCount = TYml2Xml.GetChildren(controlsNode, true).Count;

                InitTableLayoutGrid();

                foreach (TControlDef childctrl in parentContainer.Children)
                {
                    childctrl.parentName = layoutPanel.controlName;
                }
            }
            else
            {
                // create TableLayoutPanel that has a column for the labels and as many rows as needed
                FCurrentRow = 0;
                FCurrentColumn = 0;

                if (FOrientation == eOrientation.Vertical)
                {
                    FColumnCount = 2;
                    FRowCount = parentContainer.Children.Count;
                }
                else if (FOrientation == eOrientation.Horizontal)
                {
                    // horizontal: label and control, all controls in one row
                    FColumnCount = parentContainer.Children.Count * 2;
                    FRowCount = 1;
                }

                InitTableLayoutGrid();

                foreach (TControlDef childControl in parentContainer.Children)
                {
                    childControl.parentName = layoutPanel.controlName;
                }
            }

            #region Custom Column Widths and custom Row Heights

            /*
             * Record custom Column Widths, if specified.
             */
            XmlNode colWidthsNode = TXMLParser.GetChild(containerNode, "ColWidths");

            StringCollection ColWidths = TYml2Xml.GetElements(colWidthsNode);

            if (ColWidths.Count > 0)
            {
                FColWidths = new Dictionary <int, string>();

                foreach (string colWidth in ColWidths)
                {
//                    Console.WriteLine(containerNode.Name + ".colWidth: " + colWidth + "    " + String.Format("FColWidths: {0}  /   {1})",
//                            colWidth.Substring(0, colWidth.IndexOf('=')),
//                            colWidth.Substring(colWidth.IndexOf('=') + 1)));

                    FColWidths.Add(Convert.ToInt32(colWidth.Substring(0, colWidth.IndexOf('='))),
                        colWidth.Substring(colWidth.IndexOf('=') + 1));
                }
            }

            /*
             * Record custom Row Heights, if specified.
             */
            XmlNode colHeightsNode = TXMLParser.GetChild(containerNode, "RowHeights");

            StringCollection RowHeights = TYml2Xml.GetElements(colHeightsNode);

            if (RowHeights.Count > 0)
            {
                FRowHeights = new Dictionary <int, string>();

                foreach (string rowHeight in RowHeights)
                {
//                    Console.WriteLine(containerNode.Name + ".rowHeight: " + rowHeight + "    " + String.Format("FRowHeights: {0}  /   {1})",
//                            rowHeight.Substring(0, rowHeight.IndexOf('=')),
//                            rowHeight.Substring(rowHeight.IndexOf('=') + 1)));

                    FRowHeights.Add(Convert.ToInt32(rowHeight.Substring(0, rowHeight.IndexOf('='))),
                        rowHeight.Substring(rowHeight.IndexOf('=') + 1));
                }
            }

            #endregion
        }
コード例 #16
0
		/// <summary>
		/// Creates new instance of BaseItem and assigns item name and item text.
		/// </summary>
		/// <param name="sItemName">Item Name</param>
		/// <param name="ItemText">Item Text</param>
		public BaseItem(string sItemName, string ItemText)
		{
            if (ItemText == null)
                ItemText = "";
			m_Text=ItemText;
			if(m_Text!="")
				m_AccessKey=NativeFunctions.GetAccessKey(m_Text);
			m_Rect=System.Drawing.Rectangle.Empty;
			m_ContainerControl=null;
			m_HotSubItem=null;
			m_IsContainer=false;
			m_SubItems=null;
			m_Parent=null;
			m_NeedRecalcSize=true;
			m_Visible=true;
			m_Expanded=false;
			m_AutoExpand=false;
			m_ItemData="";
			m_Enabled=true;
			m_BeginGroup=false;
			m_Style=eDotNetBarStyle.OfficeXP;
			m_Description="";
			m_Tooltip="";
			m_Name=sItemName;
			m_Category="";
			m_Orientation=eOrientation.Horizontal;
			m_ToolTipWnd=null;
			m_Id=++s_IdCounter;
			m_IsOnCustomizeMenu=false;
			m_IsOnCustomizeDialog=false;
			m_SystemItem=false;
			//m_AccessKey=;
			m_Shortcuts=null;
			m_DesignMode=false;
			m_CanCustomize=true;
			m_ShowSubItems=true;
			m_ItemAlignment=eItemAlignment.Near;
			m_Focused=false;
			m_Owner=null;
            MarkupTextChanged();
        }
コード例 #17
0
		private void AlignItemsFar(Stack FarAlignItems, eOrientation orientation)
		{
			int iPos=0;
			int iGroupLineSize=this.GroupLineSize;
			if(orientation==eOrientation.Horizontal)
			{
				iPos=m_Rect.Right-m_PaddingRight;
				if(m_MoreItems!=null)
					iPos-=m_MoreItems.WidthInternal;
				while(FarAlignItems.Count>0)
				{
					BaseItem objItem=FarAlignItems.Pop() as BaseItem;
					if(objItem.Displayed && objItem.Visible)
					{
						objItem.LeftInternal=iPos- GetItemLayoutWidth(objItem);
						iPos=objItem.LeftInternal-m_ItemSpacing;
						if(objItem.BeginGroup)
							iPos-=iGroupLineSize;
					}
				}
			}
			else
			{
				iPos=m_Rect.Bottom-m_PaddingBottom;
				if(m_MoreItems!=null)
					iPos-=m_MoreItems.HeightInternal;
				while(FarAlignItems.Count>0)
				{
					BaseItem objItem=FarAlignItems.Pop() as BaseItem;
					if(objItem.Displayed && objItem.Visible)
					{
						objItem.TopInternal=iPos-GetItemLayoutHeight(objItem);
						iPos=objItem.TopInternal-m_ItemSpacing;
						if(objItem.BeginGroup)
							iPos-=iGroupLineSize;
					}
				}
			}
		}
コード例 #18
0
        public ExcelWriter SetOrientation(eOrientation orientation)
        {
            Backer.PrinterSettings.Orientation = orientation;

            return(this);
        }
コード例 #19
0
ファイル: ExcelHelper.cs プロジェクト: chidongyh2/WebsiteAPI
 public static void AddHeaderAndFooter(ExcelWorksheet sheet, eOrientation orientation = eOrientation.Landscape, ePaperSize pagerSize = ePaperSize.A4)
 {
     AddHeaderAndFooter(sheet, @"Template\Images\HeaderVTI.jpg", @"Template\Images\FooterVTI.jpg", orientation, pagerSize);
 }
コード例 #20
0
		private void CreateContainer(eOrientation orientation)
		{
			DesignerSupport.CreateItemContainer(this,(BaseItem)this.Component,orientation);
			this.RecalcLayout();
		}
コード例 #21
0
ファイル: GridViewer.cs プロジェクト: RichardBradley/MMEd
            public RespawnSetting(int x, int y, int xiNewDirectionValue)
            {
                X = x;
                Y = y;
                Orientation = eOrientation.North;

                if (xiNewDirectionValue > FlatChunk.STEERING_HIGHESTDIRECTION + 1)
                {
                  throw new Exception("Tried to set respawn direction to a value higher than the maximum");
                }

                // The direction value passed in is based on the brush numbering and so needs to be reduced by one.
                Direction = (eDirection)(xiNewDirectionValue - 1);
            }
コード例 #22
0
        private System.Drawing.Size RecalcSizeDotNet(bool bCalculateOnly, System.Drawing.Size objFrameSize, eOrientation barOrientation, eBarState barState, bool bWrapItems)
        {
            System.Drawing.Size thisSize = System.Drawing.Size.Empty;
            int iTopMargin = 0, iBottomMargin = 0, iLeftMargin = 0, iRightMargin = 0, iRightTabMargin = 0;
            int iOrgWidth = 0, iOrgHeight = 0;
            eOrientation oldOrientation = m_ItemContainer.Orientation;
            eBarState thisBarState = m_BarState;
            bool bOldStretch = m_ItemContainer.Stretch;
            bool bOldWrapItems = m_ItemContainer.WrapItems;
            m_ItemContainer.IsRightToLeft = (this.RightToLeft == RightToLeft.Yes);
            if (bCalculateOnly)
            {
                m_ItemContainer.Orientation = barOrientation;
                thisBarState = barState;
                m_ItemContainer.WrapItems = bWrapItems;
                if (barState == eBarState.Docked)
                    m_ItemContainer.Stretch = m_DockStretch;
                else
                {
                    if (m_ItemContainer.LayoutType == eLayoutType.DockContainer)
                        m_ItemContainer.Stretch = m_DockStretch;
                    else
                        m_ItemContainer.Stretch = false;
                }
            }

            if (thisBarState == eBarState.Docked)
            {
                if (m_DockedBorder != eBorderType.None)
                {
                    iTopMargin = 3;
                    iBottomMargin = 3;
                    iLeftMargin = 3;
                    iRightMargin = 3;
                }
            }
            else if (thisBarState == eBarState.Floating)
            {
                if (this.IsThemed || this.DrawThemedCaption)
                {
                    if (m_ThemeWindowMargins.IsEmpty)
                        this.RefreshThemeMargins();
                    iTopMargin = m_ThemeWindowMargins.Top;
                    iLeftMargin = m_ThemeWindowMargins.Left;
                    iRightMargin = m_ThemeWindowMargins.Right;
                    iBottomMargin = m_ThemeWindowMargins.Bottom;
                    if (this.GrabHandleStyle == eGrabHandleStyle.CaptionTaskPane)
                        iTopMargin = GetGrabHandleTaskPaneHeight() + m_ThemeWindowMargins.Bottom;
                }
                else
                {
                    if (this.GrabHandleStyle == eGrabHandleStyle.CaptionTaskPane)
                        iTopMargin = GetGrabHandleTaskPaneHeight() + 4;
                    else
                        iTopMargin = GetNonClientHeight();
                    iLeftMargin = 2;
                    iRightMargin = 2;
                    iBottomMargin = 3;
                }
            }
            else
            {
                iTopMargin = this.ClientMarginTop;
                iLeftMargin = this.ClientMarginLeft;
                iRightMargin = this.ClientMarginRight;
                iBottomMargin = this.ClientMarginBottom;
            }

            int iTop = iTopMargin, iLeft = iLeftMargin;

            if (BarType == eBarType.StatusBar && BarFunctions.IsOffice2007Style(m_ItemContainer.EffectiveStyle))
                iTop += 2;

            if (m_ItemContainer.LayoutType == eLayoutType.DockContainer && !m_AutoHideState && GetDockTabVisible())
            {
                if (m_ItemContainer.VisibleSubItems > 1 || m_AlwaysDisplayDockTab && m_ItemContainer.VisibleSubItems == 1 && m_BarState != eBarState.Floating)
                {
                    switch (m_DockTabAlignment)
                    {
                        case eTabStripAlignment.Top:
                            {
                                iTop += DockTabStripHeight;
                                break;
                            }
                        case eTabStripAlignment.Left:
                            {
                                iLeft += DockTabStripHeight;
                                break;
                            }
                        case eTabStripAlignment.Right:
                            {
                                iRightTabMargin = DockTabStripHeight;
                                break;
                            }
                        default:
                            {
                                iBottomMargin += DockTabStripHeight;
                                break;
                            }
                    }
                }
            }

            // Take in account the side bar picture
            if (thisBarState == eBarState.Popup && m_SideBarImage.Picture != null)
                iLeft += m_SideBarImage.Picture.Width;
            else if (thisBarState == eBarState.Docked || this.BarState == eBarState.AutoHide)
            {
                // Show grab handles if any selected
                if (m_GrabHandleStyle != eGrabHandleStyle.None)
                {
                    if (m_GrabHandleStyle == eGrabHandleStyle.ResizeHandle)
                    {
                        // Leave space for the window sizer at the right
                        if (this.RightToLeft == RightToLeft.Yes)
                            iLeft += GrabHandleResizeWidth;
                        else
                            iRightMargin += GrabHandleResizeWidth;
                    }
                    else
                    {
                        if (m_ItemContainer.Orientation == eOrientation.Horizontal && m_ItemContainer.LayoutType == eLayoutType.Toolbar)
                        {

                            if (m_GrabHandleStyle == eGrabHandleStyle.Caption)
                                iLeft += GetGrabHandleCaptionHeight();
                            else
                            {
                                if (this.RightToLeft == RightToLeft.Yes)
                                    iRightMargin += GrabHandleDotNetWidth;
                                else
                                    iLeft += GrabHandleDotNetWidth;
                            }
                        }
                        else
                        {
                            if (m_GrabHandleStyle == eGrabHandleStyle.Caption)
                                iTop += GetGrabHandleCaptionHeight();
                            else if (m_GrabHandleStyle == eGrabHandleStyle.CaptionTaskPane || m_GrabHandleStyle == eGrabHandleStyle.CaptionDotted)
                                iTop += GetGrabHandleTaskPaneHeight();
                            else
                                iTop += GrabHandleDotNetWidth;
                        }
                    }
                }
            }

            if (!bCalculateOnly)
            {
                m_ItemContainer.TopInternal = iTop;
                m_ItemContainer.LeftInternal = iLeft;
            }
            else
            {
                iOrgHeight = m_ItemContainer.HeightInternal;
                iOrgWidth = m_ItemContainer.WidthInternal;
            }

            // Suspend Layout while setting suggested size
            m_ItemContainer.SuspendLayout = true;
            if (!bCalculateOnly)
            {
                if (thisBarState == eBarState.Popup)
                    m_ItemContainer.WidthInternal = m_InitialContainerWidth;
                else
                {
                    m_ItemContainer.WidthInternal = objFrameSize.Width - iLeft - iRightMargin - iRightTabMargin; //m_ItemContainer.WidthInternal=this.Width-iLeft-iRightMargin;
                    m_ItemContainer.HeightInternal = objFrameSize.Height - iTop - iBottomMargin; //m_ItemContainer.HeightInternal=this.Height-iTop-iBottomMargin;
                }
            }
            else
            {
                m_ItemContainer.WidthInternal = objFrameSize.Width - iLeft - iRightMargin - iRightTabMargin;
                m_ItemContainer.HeightInternal = objFrameSize.Height - iTop - iBottomMargin;
            }
            m_ItemContainer.SuspendLayout = false;

            if (m_ItemContainer.VisibleSubItems == 0 || (m_ItemContainer.SubItems.Count == 1 && m_ItemContainer.SubItems[0] is CustomizeItem && !m_ItemContainer.SubItems[0].Visible))
            {
                m_ItemContainer.RecalcSize();
                if (this.LayoutType != eLayoutType.DockContainer && this.DockSide != eDockSide.Document)
                {
                    m_ItemContainer.WidthInternal = 36;
                    m_ItemContainer.HeightInternal = 24;
                }
            }
            else
                m_ItemContainer.RecalcSize();

            iTop += m_ItemContainer.HeightInternal;
            if (IsGradientStyle && this.LayoutType == eLayoutType.Toolbar && !this.MenuBar && !this.IsThemed && BarType != eBarType.StatusBar)
                iTop++;

            if (!bCalculateOnly)
            {
                if (this.RightToLeft == RightToLeft.Yes)
                {
                    if (this.LayoutType == eLayoutType.Toolbar && m_ItemContainer.WidthInternal < objFrameSize.Width - iLeft - iRightMargin - iRightTabMargin && this.Stretch)
                    {
                        m_ItemContainer.LeftInternal = objFrameSize.Width - iRightMargin - m_ItemContainer.WidthInternal;
                        m_ItemContainer.RecalcSize();
                    }
                    m_ClientRect = new Rectangle(m_ItemContainer.LeftInternal, iTopMargin, m_ItemContainer.WidthInternal, iTop);
                }
                else
                    m_ClientRect = new Rectangle(iLeft, iTopMargin, m_ItemContainer.WidthInternal, iTop);
            }

            if (!bCalculateOnly)
            {
                if ((thisBarState == eBarState.Docked || thisBarState == eBarState.AutoHide) && m_GrabHandleStyle != eGrabHandleStyle.None && m_GrabHandleStyle != eGrabHandleStyle.ResizeHandle)
                {
                    if (m_ItemContainer.Orientation == eOrientation.Horizontal && m_ItemContainer.LayoutType == eLayoutType.Toolbar)
                    {
                        if (m_GrabHandleStyle == eGrabHandleStyle.Caption)
                            m_GrabHandleRect = new Rectangle(iLeftMargin, iTopMargin, GetGrabHandleCaptionHeight(), iTop);
                        else
                        {
                            if (this.RightToLeft == RightToLeft.Yes)
                                m_GrabHandleRect = new Rectangle(m_ItemContainer.WidthInternal + iLeft + iLeftMargin, iTopMargin, 10, iTop);
                            else
                                m_GrabHandleRect = new Rectangle(iLeftMargin, iTopMargin, 10, iTop);
                        }
                    }
                    else
                    {
                        if (m_GrabHandleStyle == eGrabHandleStyle.Caption)
                            m_GrabHandleRect = new Rectangle(iLeftMargin, iTopMargin, m_ItemContainer.WidthInternal + iLeft - iLeftMargin + iRightTabMargin, GetGrabHandleCaptionHeight());
                        else if (m_GrabHandleStyle == eGrabHandleStyle.CaptionTaskPane || m_GrabHandleStyle == eGrabHandleStyle.CaptionDotted)
                            m_GrabHandleRect = new Rectangle(iLeftMargin, iTopMargin, m_ItemContainer.WidthInternal + iLeft - iLeftMargin + iRightTabMargin, GetGrabHandleTaskPaneHeight());
                        else
                        {
                            //if (this.RightToLeft == RightToLeft.Yes)
                            //    m_GrabHandleRect = new Rectangle(objFrameSize.Width - iLeft - iRightMargin - iRightTabMargin, iTopMargin, m_ItemContainer.WidthInternal + iLeft - iLeftMargin + iRightTabMargin, 10);
                            //else
                            m_GrabHandleRect = new Rectangle(iLeftMargin, iTopMargin, m_ItemContainer.WidthInternal + iLeft - iLeftMargin + iRightTabMargin, 10);
                        }
                    }
                }
                else if (thisBarState == eBarState.Floating)
                {
                    if (m_GrabHandleStyle == eGrabHandleStyle.CaptionTaskPane)
                    {
                        m_GrabHandleRect = new Rectangle(iLeftMargin, ((this.IsThemed || this.DrawThemedCaption) ? m_ThemeWindowMargins.Bottom : 2), m_ItemContainer.WidthInternal + iLeft - iLeftMargin + iRightTabMargin, GetGrabHandleTaskPaneHeight());
                    }
                    else
                    {
                        m_GrabHandleRect = new Rectangle(2, 2, m_ItemContainer.WidthInternal + iRightTabMargin, GetGrabHandleCaptionHeight());
                        if (this.CanHideResolved)
                            m_GrabHandleRect.Width -= 14;
                    }
                }

                if (thisBarState == eBarState.Popup && m_SideBarImage.Picture != null)
                    m_SideBarRect = new Rectangle(iLeft - m_SideBarImage.Picture.Width, iTopMargin, m_SideBarImage.Picture.Width, iTop - iTopMargin);

                //if(iLeft+m_ItemContainer.Width+iRightMargin!=this.ClientSize.Width || this.ClientSize.Height!=iTop+iBottomMargin)
                //	this.ClientSize=new Size(iLeft+m_ItemContainer.Width+iRightMargin,iTop+iBottomMargin);
                thisSize = new Size(iLeft + m_ItemContainer.WidthInternal + iRightMargin + iRightTabMargin, iTop + iBottomMargin);
            }
            else
            {
                //if(m_BarState==eBarState.Floating)
                thisSize = new Size(iLeft + m_ItemContainer.WidthInternal + iRightMargin + iRightTabMargin, iTop + iBottomMargin);
                //else
                //	thisSize=new Size(iLeft+m_ItemContainer.WidthInternal+iRightMargin+iRightTabMargin+14,iTop+iBottomMargin);
                m_ItemContainer.WidthInternal = iOrgWidth;
                m_ItemContainer.HeightInternal = iOrgHeight;
                m_ItemContainer.Orientation = oldOrientation;
                m_ItemContainer.WrapItems = bOldWrapItems;
                m_ItemContainer.Stretch = bOldStretch;
                m_ItemContainer.RecalcSize();
            }
            return thisSize;
        }
コード例 #23
0
 /// <summary>
 /// Returns Minimum docked size of the control.
 /// </summary>
 System.Drawing.Size IDockInfo.MinimumDockSize(eOrientation dockOrientation)
 {
     return this.MinimumDockSize(dockOrientation);
 }
コード例 #24
0
 /// <summary>
 /// sets the orientation of the page
 /// </summary>
 public virtual void Init(eOrientation AOrientation, TPrinterLayout APrinterLayout, eMarginType AMarginType)
 {
     FPrinterLayout = APrinterLayout;
     FOrientation   = AOrientation;
     FMarginType    = AMarginType;
 }
コード例 #25
0
ファイル: Printer.cs プロジェクト: Davincier/openpetra
 /// <summary>
 /// sets the orientation of the page
 /// </summary>
 public virtual void Init(eOrientation AOrientation, TPrinterLayout APrinterLayout, eMarginType AMarginType)
 {
     FPrinterLayout = APrinterLayout;
     FOrientation = AOrientation;
     FMarginType = AMarginType;
 }
コード例 #26
0
ファイル: Printer.cs プロジェクト: Davincier/openpetra
 /// <summary>
 /// constructor
 ///
 /// </summary>
 public TPrinter() : base()
 {
     FOrientation = eOrientation.ePortrait;
     PrintingMode = ePrintingMode.eDoPrint;
     FMarginType = eMarginType.eDefaultMargins;
     CurrentPageNr = 0;
     FNumberOfPages = 0;
     CurrentFont = eFont.eDefaultFont;
     FPageFooterSpace = 0;
 }
コード例 #27
0
        protected virtual ItemContainer CreateContainer(BaseItem parent, eOrientation orientation)
        {
            ItemContainer container = null;
            m_CreatingItem = true;
            try
            {
                container = DesignerSupport.CreateItemContainer(this, parent, orientation);
            }
            finally
            {
                m_CreatingItem = false;
            }
            this.RecalcLayout();

            return container;
        }
コード例 #28
0
 private System.Drawing.Size RecalcSizeOnly(System.Drawing.Size objFrameSize, eOrientation barOrientation, eBarState barState, bool bWrapItems)
 {
     if (m_ItemContainer.SubItems.Count > 0)
     {
         if (m_ItemContainer.EffectiveStyle == eDotNetBarStyle.Office2000)
             return RecalcSizeOffice(true, objFrameSize, barOrientation, barState, bWrapItems);
         else
             return RecalcSizeDotNet(true, objFrameSize, barOrientation, barState, bWrapItems);
     }
     return System.Drawing.Size.Empty;
 }
コード例 #29
0
ファイル: GridViewer.cs プロジェクト: RichardBradley/MMEd
            public void RotateTo(eOrientation xiOrientation)
            {
                int lDifference = xiOrientation - Orientation;

                if (lDifference <= 0)
                {
                  lDifference += 4;
                }

                int lOldX = X;
                int lOldY = Y;
                int lMaxValue = FlatChunk.STEERINGDIMENSION - 1;

                switch (lDifference)
                {
                  case 0:
                  // No change
                  case 1:
                X = lMaxValue - lOldY;
                Y = lOldX;
                Direction += 4;
                break;
                  case 2:
                X = lMaxValue - lOldX;
                Y = lMaxValue - lOldY;
                Direction += 8;
                break;
                  case 3:
                X = lOldY;
                Y = lMaxValue - lOldX;
                Direction += 12;
                break;
                }

                if ((int)Direction >= 16)
                {
                  Direction -= 16;
                }

                Orientation = xiOrientation;
            }
コード例 #30
0
ファイル: GfxPrinter.cs プロジェクト: ip-config/openpetra
        /// <summary>
        /// todoComment
        /// </summary>
        public override void Init(eOrientation AOrientation, TPrinterLayout APrinterLayout, eMarginType AMarginType)
        {
            base.Init(AOrientation, APrinterLayout, AMarginType);
//            SetPageSize();
        }
コード例 #31
0
ファイル: ExcelHelper.cs プロジェクト: chidongyh2/WebsiteAPI
        public static void AddFooter(ExcelWorksheet sheet, string imgFooterPath, int addHeightFooter, PictureAlignment footerAlign, eOrientation orientation = eOrientation.Landscape, ePaperSize pagerSize = ePaperSize.A4)
        {
            var footerPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, imgFooterPath);

            // TODO: Check this later.
            //var evenFooter = sheet.HeaderFooter.EvenFooter.InsertPicture(new FileInfo(footerPath), footerAlign);
            //evenFooter.Width = evenFooter.Width + (addHeightFooter * evenFooter.Width / evenFooter.Height);
            //evenFooter.Height = evenFooter.Height + addHeightFooter;

            //var oddFooter = sheet.HeaderFooter.OddFooter.InsertPicture(new FileInfo(footerPath), footerAlign);
            //oddFooter.Width = oddFooter.Width + (addHeightFooter * oddFooter.Width / oddFooter.Height);
            //oddFooter.Height = oddFooter.Height + addHeightFooter;

            sheet.View.PageLayoutView         = true;
            sheet.PrinterSettings.TopMargin   = 2.4M / 2.54M;
            sheet.PrinterSettings.Orientation = orientation;
            sheet.PrinterSettings.PaperSize   = pagerSize;
        }
コード例 #32
0
        // IDockInfo Interface implementation
        /// <summary>
        /// Returns the Minimum Size for specified orientation.
        /// </summary>
        /// <param name="dockOrientation">Orientation to return minimum size for.</param>
        /// <returns></returns>
        public System.Drawing.Size MinimumDockSize(eOrientation dockOrientation)
        {
            if (m_ItemContainer == null) return new Size(32, 32);
            if (m_ItemContainer.LayoutType == eLayoutType.DockContainer && (m_ItemContainer.Stretch || m_DockStretch))
            {
                if (m_ItemContainer.SubItems.Count > 0 && m_ItemContainer.SubItems[0] is DockContainerItem)
                    return ((DockContainerItem)m_ItemContainer.SubItems[0]).MinimumSize;
                return new Size(32, 32);
            }

            if (m_ItemContainer.Stretch || m_DockStretch)
                return PreferredDockSize(dockOrientation);

            if (m_ItemContainer.SubItems.Count > 0)
            {
                BaseItem objItem = m_ItemContainer.SubItems[0];
                if (objItem != null)
                {
                    return new Size(objItem.WidthInternal + m_ClientRect.Left * 2, objItem.HeightInternal);
                }
            }

            return new Size(0, 0);
        }
コード例 #33
0
		private void AlignItemsFar(ArrayList FarAlignLines, eOrientation orientation)
		{
			if(orientation==eOrientation.Horizontal)
			{
				foreach(Stack FarAlignItems in FarAlignLines)
					AlignItemsFar(FarAlignItems,orientation);
			}
			else
			{
				foreach(Stack FarAlignItems in FarAlignLines)
					AlignItemsFar(FarAlignItems,orientation);
			}
		}
コード例 #34
0
ファイル: ExcelHelper.cs プロジェクト: chidongyh2/WebsiteAPI
        public static void AddHeaderAndFooter(ExcelWorksheet sheet, string imgHeaderPath, string imgFooterPath, eOrientation orientation = eOrientation.Landscape, ePaperSize pagerSize = ePaperSize.A4)
        {
            var headerPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, imgHeaderPath);
            var footerPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, imgFooterPath);

            // TODO: Check this later.
            //var evenHeader = sheet.HeaderFooter.EvenHeader.InsertPicture(new FileInfo(headerPath), PictureAlignment.Left);
            //if (orientation == eOrientation.Portrait)
            //{
            //    evenHeader.Width = evenHeader.Width - (5 * evenHeader.Width / evenHeader.Height);
            //    evenHeader.Height = evenHeader.Height - 5;
            //}
            //else
            //{
            //    evenHeader.Width = evenHeader.Width + (5 * evenHeader.Width / evenHeader.Height);
            //    evenHeader.Height = evenHeader.Height + 5;
            //}

            //var oddHeader = sheet.HeaderFooter.OddHeader.InsertPicture(new FileInfo(headerPath), PictureAlignment.Left);
            //if (orientation == eOrientation.Portrait)
            //{
            //    oddHeader.Width = oddHeader.Width - (5 * oddHeader.Width / oddHeader.Height);
            //    oddHeader.Height = oddHeader.Height - 5;
            //}
            //else
            //{
            //    oddHeader.Width = oddHeader.Width + (5 * oddHeader.Width / oddHeader.Height);
            //    oddHeader.Height = oddHeader.Height + 5;
            //}

            //var evenFooter = sheet.HeaderFooter.EvenFooter.InsertPicture(new FileInfo(footerPath), PictureAlignment.Centered);
            //if (orientation == eOrientation.Portrait)
            //{
            //    evenFooter.Width = evenFooter.Width - (53 * evenFooter.Width / evenFooter.Height);
            //    evenFooter.Height = evenFooter.Height - 53;
            //}
            //else
            //{
            //    evenFooter.Width = evenFooter.Width - (50 * evenFooter.Width / evenFooter.Height);
            //    evenFooter.Height = evenFooter.Height - 50;
            //}

            //var oddFooter = sheet.HeaderFooter.OddFooter.InsertPicture(new FileInfo(footerPath), PictureAlignment.Centered);
            //if (orientation == eOrientation.Portrait)
            //{
            //    oddFooter.Width = oddFooter.Width - (53 * oddFooter.Width / oddFooter.Height);
            //    oddFooter.Height = oddFooter.Height - 53;
            //}
            //else
            //{
            //    oddFooter.Width = oddFooter.Width - (50 * oddFooter.Width / oddFooter.Height);
            //    oddFooter.Height = oddFooter.Height - 50;
            //}

            sheet.View.PageLayoutView         = true;
            sheet.PrinterSettings.TopMargin   = 2.4M / 2.54M;
            sheet.PrinterSettings.Orientation = orientation;
            sheet.PrinterSettings.PaperSize   = pagerSize;
        }
コード例 #35
0
        private System.Drawing.Size RecalcSizeOffice(bool bCalculateOnly, System.Drawing.Size objFrameSize, eOrientation barOrientation, eBarState barState, bool bWrapItems)
        {
            System.Drawing.Size thisSize = System.Drawing.Size.Empty;

            int iTopMargin = 0, iBottomMargin = 0, iLeftMargin = 0, iRightMargin = 0, iRightTabMargin = 0;
            int iOrgWidth = 0, iOrgHeight = 0;
            eOrientation oldOrientation = m_ItemContainer.Orientation;
            eBarState thisBarState = m_BarState;
            bool bOldStretch = m_ItemContainer.Stretch;
            bool bOldWrapItems = m_ItemContainer.WrapItems;
            m_ItemContainer.IsRightToLeft = (this.RightToLeft == RightToLeft.Yes);
            if (bCalculateOnly)
            {
                m_ItemContainer.Orientation = barOrientation;
                thisBarState = barState;
                m_ItemContainer.WrapItems = bWrapItems;
                if (barState == eBarState.Docked)
                    m_ItemContainer.Stretch = m_DockStretch;
                else
                {
                    if (m_ItemContainer.LayoutType == eLayoutType.DockContainer)
                        m_ItemContainer.Stretch = m_DockStretch;
                    else
                        m_ItemContainer.Stretch = false;
                }
            }

            if (thisBarState == eBarState.Docked)
            {
                if (m_DockedBorder != eBorderType.None)
                {
                    iTopMargin = 2;
                    iBottomMargin = 2;
                    iLeftMargin = 2;
                    iRightMargin = 2;
                }
            }
            else if (thisBarState == eBarState.Floating)
            {
                iTopMargin = 22;
                iLeftMargin = 4;
                iRightMargin = 4;
                iBottomMargin = 4;
            }
            else
            {
                iTopMargin = this.ClientMarginTop;
                iLeftMargin = this.ClientMarginLeft;
                iRightMargin = this.ClientMarginRight;
                iBottomMargin = this.ClientMarginBottom;
            }

            int iTop = iTopMargin, iLeft = iLeftMargin;

            if (m_ItemContainer.LayoutType == eLayoutType.DockContainer && !m_AutoHideState && GetDockTabVisible())
            {
                if (m_ItemContainer.VisibleSubItems > 1 || m_AlwaysDisplayDockTab && m_ItemContainer.VisibleSubItems == 1 && m_BarState != eBarState.Floating)
                {
                    switch (m_DockTabAlignment)
                    {
                        case eTabStripAlignment.Top:
                            {
                                iTop += DockTabStripHeight;
                                break;
                            }
                        case eTabStripAlignment.Left:
                            {
                                iLeft += DockTabStripHeight;
                                break;
                            }
                        case eTabStripAlignment.Right:
                            {
                                iRightTabMargin = DockTabStripHeight;
                                break;
                            }
                        default:
                            {
                                iBottomMargin += DockTabStripHeight;
                                break;
                            }
                    }
                }
            }

            // Take in account the side bar picture
            if (thisBarState == eBarState.Popup && m_SideBarImage.Picture != null)
                iLeft += m_SideBarImage.Picture.Width;
            else if (thisBarState == eBarState.Docked || this.BarState == eBarState.AutoHide)
            {
                // Show grab handles if any selected
                if (m_GrabHandleStyle != eGrabHandleStyle.None)
                {
                    if (m_ItemContainer.Orientation == eOrientation.Horizontal && m_ItemContainer.LayoutType != eLayoutType.DockContainer)
                        iLeft += GrabHandleOfficeWidth;
                    else
                    {
                        if (m_GrabHandleStyle == eGrabHandleStyle.Caption)
                            iTop += GetGrabHandleCaptionHeight();
                        else if (m_GrabHandleStyle == eGrabHandleStyle.CaptionTaskPane || m_GrabHandleStyle == eGrabHandleStyle.CaptionDotted)
                            iTop += GetGrabHandleTaskPaneHeight();
                        else
                            iTop += GrabHandleOfficeWidth;
                    }
                }
            }

            if (!bCalculateOnly)
            {
                m_ItemContainer.TopInternal = iTop;
                m_ItemContainer.LeftInternal = iLeft;
            }
            else
            {
                iOrgHeight = m_ItemContainer.HeightInternal;
                iOrgWidth = m_ItemContainer.WidthInternal;
            }

            if (!bCalculateOnly)
            {
                if (thisBarState == eBarState.Popup)
                    m_ItemContainer.WidthInternal = m_InitialContainerWidth;
                else
                {
                    m_ItemContainer.WidthInternal = objFrameSize.Width - iLeft - iRightMargin - iRightTabMargin; //m_ItemContainer.WidthInternal=this.Width-iLeft-iRightMargin;
                    m_ItemContainer.HeightInternal = objFrameSize.Height - iTop - iBottomMargin; //m_ItemContainer.HeightInternal=this.Height-iTop-iBottomMargin;
                }
            }
            else
            {
                m_ItemContainer.WidthInternal = objFrameSize.Width - iLeft - iRightMargin - iRightTabMargin;
                m_ItemContainer.HeightInternal = objFrameSize.Height - iTop - iBottomMargin;
            }

            if (m_ItemContainer.VisibleSubItems == 0)
            {
                m_ItemContainer.WidthInternal = 36;
                m_ItemContainer.HeightInternal = 24;
            }
            else
                m_ItemContainer.RecalcSize();

            iTop += m_ItemContainer.HeightInternal;

            if (!bCalculateOnly)
                m_ClientRect = new Rectangle(iLeft, iTopMargin, m_ItemContainer.WidthInternal, iTop);

            if (!bCalculateOnly)
            {
                if ((thisBarState == eBarState.Docked || this.BarState == eBarState.AutoHide) && m_GrabHandleStyle != eGrabHandleStyle.None)
                {
                    if (m_ItemContainer.Orientation == eOrientation.Horizontal && m_ItemContainer.LayoutType != eLayoutType.DockContainer)
                    {
                        m_GrabHandleRect = new Rectangle(iLeftMargin, iTopMargin, 12, iTop);
                    }
                    else
                    {
                        if (m_GrabHandleStyle == eGrabHandleStyle.Caption)
                            m_GrabHandleRect = new Rectangle(iLeftMargin, iTopMargin, m_ItemContainer.WidthInternal + iLeft - iLeftMargin + iRightTabMargin, GetGrabHandleCaptionHeight());
                        else if (m_GrabHandleStyle == eGrabHandleStyle.CaptionTaskPane || m_GrabHandleStyle == eGrabHandleStyle.CaptionDotted)
                            m_GrabHandleRect = new Rectangle(iLeftMargin, iTopMargin, m_ItemContainer.WidthInternal + iLeft - iLeftMargin + iRightTabMargin, GetGrabHandleTaskPaneHeight());
                        else
                            m_GrabHandleRect = new Rectangle(iLeftMargin, iTopMargin, m_ItemContainer.WidthInternal + iLeft - iLeftMargin + iRightTabMargin, 12);
                    }
                }
                else if (thisBarState == eBarState.Floating)
                {
                    if (m_GrabHandleStyle == eGrabHandleStyle.CaptionTaskPane)
                        m_GrabHandleRect = new Rectangle(4, 4, m_ItemContainer.WidthInternal + iRightTabMargin, GetGrabHandleTaskPaneHeight());
                    else
                        m_GrabHandleRect = new Rectangle(4, 4, m_ItemContainer.WidthInternal + iRightTabMargin, 15);
                    if (this.CanHideResolved)
                        m_GrabHandleRect.Width -= 14;
                }

                if (thisBarState == eBarState.Popup && m_SideBarImage.Picture != null)
                    m_SideBarRect = new Rectangle(iLeft - m_SideBarImage.Picture.Width, iTopMargin, m_SideBarImage.Picture.Width, iTop - iTopMargin);
                //this.ClientSize=new Size(iLeft+m_ItemContainer.Width+iRightMargin,iTop+iBottomMargin);
                thisSize = new Size(iLeft + m_ItemContainer.WidthInternal + iRightMargin + iRightTabMargin, iTop + iBottomMargin);
            }
            else
            {
                thisSize = new Size(iLeft + m_ItemContainer.WidthInternal + iRightMargin + iRightTabMargin, iTop + iBottomMargin);
                m_ItemContainer.WidthInternal = iOrgWidth;
                m_ItemContainer.HeightInternal = iOrgHeight;
                m_ItemContainer.Orientation = oldOrientation;
                m_ItemContainer.WrapItems = bOldWrapItems;
                m_ItemContainer.Stretch = bOldStretch;
                m_ItemContainer.RecalcSize();
            }
            return thisSize;
        }
コード例 #36
0
ファイル: Helper.cs プロジェクト: nnazim/ExcelCodeReporter
        public static void ApplyDefaultReportSettings(ExcelWriter ws, DateTime generatedTimestamp, eOrientation orientation)
        {
            ws.Backer.Calculate();

            ws.SetPrintArea()
            .SetOrientation(orientation)
            .SetFitToWidth()
            .SetFreezeHeader()
            .PrintGridLines()
            .PrintHeaderOnEachPage()
            .PrintTitleInFooter()
            .PrintPageNumberInFooter("Page {0} of {1}")
            .PrintCenteredTextInFooter(generatedTimestamp.Kind == DateTimeKind.Utc ? $"Generated {generatedTimestamp} UTC" : $"Generated {generatedTimestamp}");
        }
コード例 #37
0
        /// <summary>
        /// this function should be used for any collection of controls: on a TabPage, in a table, in a groupbox, radio button list etc.
        /// </summary>
        /// <returns>the layout control that still needs to be added to the parent</returns>
        public void CreateLayout(TFormWriter writer, TControlDef parentContainer, TControlDef layoutPanel, Int32 ANewWidth, Int32 ANewHeight)
        {
            if (layoutPanel == null)
            {
                layoutPanel = parentContainer;
            }

            // first check if the table layout has already been defined in the container with sets of rows?
            XmlNode containerNode = parentContainer.xmlNode;
            XmlNode controlsNode  = TXMLParser.GetChild(containerNode, "Controls");

            if (controlsNode != null)
            {
                FTabOrder = TYml2Xml.GetAttribute(controlsNode, "TabOrder");
            }

            List <XmlNode> childNodes = TYml2Xml.GetChildren(controlsNode, true);

            if ((childNodes.Count > 0) && TYml2Xml.GetElementName(childNodes[0]).StartsWith("Row"))
            {
                // create a layout using the defined rows in Controls
                // create TableLayoutPanel that has as many columns (including the labels) and rows as needed
                FOrientation   = eOrientation.TableLayout;
                FCurrentRow    = 0;
                FCurrentColumn = 0;
                FColumnCount   = 2;

                // determine maximum number of columns
                foreach (XmlNode row in TYml2Xml.GetChildren(controlsNode, true))
                {
                    // one other column for the label; will be cleaned up in WriteTableLayout
                    int columnCount = 2 * TYml2Xml.GetElements(row).Count;

                    if (columnCount > FColumnCount)
                    {
                        FColumnCount = columnCount;
                    }
                }

                FRowCount = TYml2Xml.GetChildren(controlsNode, true).Count;

                InitTableLayoutGrid();

                foreach (TControlDef childctrl in parentContainer.Children)
                {
                    childctrl.parentName = layoutPanel.controlName;
                }
            }
            else
            {
                // create TableLayoutPanel that has a column for the labels and as many rows as needed
                FCurrentRow    = 0;
                FCurrentColumn = 0;

                if (FOrientation == eOrientation.Vertical)
                {
                    FColumnCount = 2;
                    FRowCount    = parentContainer.Children.Count;
                }
                else if (FOrientation == eOrientation.Horizontal)
                {
                    // horizontal: label and control, all controls in one row
                    FColumnCount = parentContainer.Children.Count * 2;
                    FRowCount    = 1;
                }

                InitTableLayoutGrid();

                foreach (TControlDef childControl in parentContainer.Children)
                {
                    childControl.parentName = layoutPanel.controlName;
                }
            }

            #region Custom Column Widths and custom Row Heights

            /*
             * Record custom Column Widths, if specified.
             */
            XmlNode colWidthsNode = TXMLParser.GetChild(containerNode, "ColWidths");

            StringCollection ColWidths = TYml2Xml.GetElements(colWidthsNode);

            if (ColWidths.Count > 0)
            {
                FColWidths = new Dictionary <int, string>();

                foreach (string colWidth in ColWidths)
                {
//                    Console.WriteLine(containerNode.Name + ".colWidth: " + colWidth + "    " + String.Format("FColWidths: {0}  /   {1})",
//                            colWidth.Substring(0, colWidth.IndexOf('=')),
//                            colWidth.Substring(colWidth.IndexOf('=') + 1)));

                    FColWidths.Add(Convert.ToInt32(colWidth.Substring(0, colWidth.IndexOf('='))),
                                   colWidth.Substring(colWidth.IndexOf('=') + 1));
                }
            }

            /*
             * Record custom Row Heights, if specified.
             */
            XmlNode colHeightsNode = TXMLParser.GetChild(containerNode, "RowHeights");

            StringCollection RowHeights = TYml2Xml.GetElements(colHeightsNode);

            if (RowHeights.Count > 0)
            {
                FRowHeights = new Dictionary <int, string>();

                foreach (string rowHeight in RowHeights)
                {
//                    Console.WriteLine(containerNode.Name + ".rowHeight: " + rowHeight + "    " + String.Format("FRowHeights: {0}  /   {1})",
//                            rowHeight.Substring(0, rowHeight.IndexOf('=')),
//                            rowHeight.Substring(rowHeight.IndexOf('=') + 1)));

                    FRowHeights.Add(Convert.ToInt32(rowHeight.Substring(0, rowHeight.IndexOf('='))),
                                    rowHeight.Substring(rowHeight.IndexOf('=') + 1));
                }
            }

            #endregion
        }
コード例 #38
0
        private void SetupOverflowButton()
        {
            if (m_OverflowButton != null || m_ItemContainer.SubItems.Count==0)
                return;
            m_SuspendRecalcSize = true;

            
            RibbonOverflowButtonItem overflowButton = new RibbonOverflowButtonItem();
            overflowButton.Name = "sysOverflowButton";
            overflowButton.Text = GetOverflowButtonText();
            overflowButton.RibbonBar = this;
            overflowButton.Image = GetOverflowButtonImage();
            overflowButton.ButtonStyle = eButtonStyle.ImageAndText;
            overflowButton.ImagePosition = eImagePosition.Top;
            overflowButton.AutoExpandOnClick = true;
            overflowButton.PopupType = ePopupType.Menu;
            overflowButton.ImagePaddingHorizontal = 16;
            overflowButton.VerticalPadding = 12;
            overflowButton.SubItemsExpandWidth = 14;
            overflowButton.HotTrackingStyle = eHotTrackingStyle.None;
            overflowButton.PopupOpen += new DotNetBarManager.PopupOpenEventHandler(OverflowButton_PopupOpen);
            if (OverflowButtonSetup != null)
                OverflowButtonSetup(this, new OverflowButtonEventArgs(overflowButton));

            ArrayList items = new ArrayList();
            m_ItemContainer.SubItems.CopyTo(items);
            m_ItemContainer.SubItems.Clear();

            //ItemContainer cont = m_ItemContainer.Copy() as ItemContainer;
            //m_OverflowButton.SubItems.Add(cont);
            m_ItemContainer.SubItems.Add(overflowButton);
            m_OverflowRibbonBar = CreateOverflowRibbon();
            m_OverflowRibbonBar.OverflowParent = this;

            m_OriginalVerticalItemAlign = m_ItemContainer.VerticalItemAlignment;
            m_OriginalLayoutOrientation = m_ItemContainer.LayoutOrientation;
            m_OriginalHorizontalItemAlign = m_ItemContainer.HorizontalItemAlignment;
            m_ItemContainer.VerticalItemAlignment = eVerticalItemsAlignment.Top;
            m_ItemContainer.LayoutOrientation = eOrientation.Horizontal;
            m_ItemContainer.HorizontalItemAlignment = eHorizontalItemsAlignment.Center;

            IOwner owner = (IOwner)this;
            foreach (BaseItem item in items)
            {
                m_OverflowRibbonBar.Items.Add(item);
                owner.AddShortcutsFromItem(item);
            }
            
            ItemContainer ic = new ItemContainer();
            ic.Stretch = true;
            ControlContainerItem cont = new ControlContainerItem();
            cont.AllowItemResize = false;
            ic.SubItems.Add(cont);
            cont.Control = m_OverflowRibbonBar;
            overflowButton.SubItems.Add(ic);
			m_ItemContainer.RefreshImageSize();

            m_OverflowButton = overflowButton;

            if (OverflowButtonSetupComplete != null)
                OverflowButtonSetupComplete(this, new OverflowButtonEventArgs(m_OverflowButton));
            m_SuspendRecalcSize = false;
        }
コード例 #39
0
 public DockPanel(DirectXPlot mainPlot, eOrientation orientation)
     : base(mainPlot)
 {
     Orientation = orientation;
 }
コード例 #40
0
 private void CreateContainer(BaseItem parent, eOrientation orientation)
 {
     m_CreatingItem = true;
     try
     {
         DesignerSupport.CreateItemContainer(this, parent, orientation);
     }
     finally
     {
         m_CreatingItem = false;
     }
     this.RecalcLayout();
 }
コード例 #41
0
ファイル: StepIndicator.cs プロジェクト: huamanhtuyen/VNACCS
 /// <summary>
 /// Called when Orientation property has changed.
 /// </summary>
 /// <param name="oldValue">Old property value</param>
 /// <param name="newValue">New property value</param>
 protected virtual void OnOrientationChanged(eOrientation oldValue, eOrientation newValue)
 {
     //OnPropertyChanged(new PropertyChangedEventArgs("Orientation"));
     this.Invalidate();
 }
コード例 #42
0
        /// <summary>
        /// set the orientation based on the attribute: ControlsOrientation;
        /// the default is vertical
        /// </summary>
        /// <param name="ACtrl"></param>
        public void SetOrientation(TControlDef ACtrl)
        {
            FOrientation = eOrientation.Vertical;

            if (TYml2Xml.HasAttribute(ACtrl.xmlNode, "ControlsOrientation")
                && (TYml2Xml.GetAttribute(ACtrl.xmlNode, "ControlsOrientation").ToLower() == "horizontal"))
            {
                FOrientation = eOrientation.Horizontal;
            }
        }
コード例 #43
0
        /// <summary>
        /// Returns the preferred size of the Bar when docked.
        /// </summary>
        /// <param name="dockOrientation">Orientation to return preferred size for.</param>
        /// <returns></returns>
        public System.Drawing.Size PreferredDockSize(eOrientation dockOrientation)
        {
            // Return preffered size for this container
            IOwner owner = m_Owner as IOwner;
            if (dockOrientation == eOrientation.Horizontal)
            {
                if (m_DockedSizeH.IsEmpty)
                {
                    if (owner != null && owner.ParentForm != null)
                        m_DockedSizeH = RecalcSizeOnly(owner.ParentForm.Size, eOrientation.Horizontal, eBarState.Docked, m_WrapItemsDock);
                    else
                        m_DockedSizeH = RecalcSizeOnly(System.Windows.Forms.Screen.FromControl(this).WorkingArea.Size, eOrientation.Horizontal, eBarState.Docked, m_WrapItemsDock);
                }

                return m_DockedSizeH;
            }
            else
            {
                // We will need to calculate that size
                if (m_DockedSizeV.IsEmpty)
                {
                    Size size = Size.Empty;
                    if (owner != null && owner.ParentForm != null)
                        size = RecalcSizeOnly(owner.ParentForm.Size, eOrientation.Horizontal, eBarState.Docked, m_WrapItemsDock);
                    else
                        size = RecalcSizeOnly(System.Windows.Forms.Screen.FromControl(this).WorkingArea.Size, eOrientation.Horizontal, eBarState.Docked, m_WrapItemsDock);
                    m_DockedSizeV = new Size(size.Height, size.Width);
                }

                return m_DockedSizeV;
            }
        }
コード例 #44
0
ファイル: PageSlider.cs プロジェクト: huamanhtuyen/VNACCS
 /// <summary>
 /// Called when Orientation property has changed.
 /// </summary>
 /// <param name="oldValue">Old property value</param>
 /// <param name="newValue">New property value</param>
 protected virtual void OnOrientationChanged(eOrientation oldValue, eOrientation newValue)
 {
     //OnPropertyChanged(new PropertyChangedEventArgs("Orientation"));
     UpdateBoundsForAllPages(false);
 }
コード例 #45
0
        public int GetBarDockedSize(eOrientation o)
        {
            const int TOTAL_BORDER_SIZE = 6;
            if (m_ItemContainer == null)
                return 0;
            if (o == eOrientation.Horizontal && m_LastDockSiteInfo.DockedHeight > 0 && (m_LastDockSiteInfo.DockSide == DockStyle.Top || m_LastDockSiteInfo.DockSide == DockStyle.Bottom))
                return m_LastDockSiteInfo.DockedHeight;
            else if (o == eOrientation.Vertical && m_LastDockSiteInfo.DockedWidth > 0 && (m_LastDockSiteInfo.DockSide == DockStyle.Left || m_LastDockSiteInfo.DockSide == DockStyle.Right))
                return m_LastDockSiteInfo.DockedWidth;

            if (o == eOrientation.Horizontal && m_ItemContainer.MinHeight > 0 && m_ItemContainer.MinHeight + SystemInformation.ToolWindowCaptionHeight < this.GetFormClientHeight())
                return m_ItemContainer.MinHeight + SystemInformation.ToolWindowCaptionHeight;
            else if (o == eOrientation.Vertical && m_ItemContainer.MinWidth > 0 && m_ItemContainer.MinWidth + SystemInformation.ToolWindowCaptionHeight < this.GetFormClientWidth())
                return m_ItemContainer.MinWidth + SystemInformation.ToolWindowCaptionHeight;

            if (this.SelectedDockTab >= 0 || this.VisibleItemCount > 0 && this.LayoutType == eLayoutType.DockContainer)
            {
                DockContainerItem item = null;
                if (this.SelectedDockTab >= 0)
                    item = this.Items[this.SelectedDockTab] as DockContainerItem;
                else
                    item = GetFirstVisibleItem() as DockContainerItem;
                if (item != null)
                {
                    if (o == eOrientation.Horizontal)
                    {
                        if (item.MinimumSize.Height > 0)
                        {
                            int height = this.Height;
                            if (this.Parent != null && (this.DockSide == eDockSide.Left || this.DockSide == eDockSide.Right) ||
                                this.Parent == null && (LastDockSide == eDockSide.Left || LastDockSide == eDockSide.Right))
                                height = this.Width;

                            if (height > item.MinimumSize.Height)
                                return height;
                            return item.MinimumSize.Height * 2 + DockTabStripHeight + TOTAL_BORDER_SIZE;
                        }
                    }
                    else
                    {
                        if (item.MinimumSize.Width > 0)
                        {
                            int width = this.Width;
                            if (this.Parent != null && (this.DockSide == eDockSide.Top || this.DockSide == eDockSide.Bottom) ||
                                this.Parent == null && (LastDockSide == eDockSide.Top || LastDockSide == eDockSide.Bottom))
                                width = this.Height;
                            if (width > item.MinimumSize.Width)
                                return width;
                            return item.MinimumSize.Width * 2 + TOTAL_BORDER_SIZE;
                        }
                    }
                }
            }

            if (o == eOrientation.Horizontal)
                return this.Height;
            else
                return this.Width;
        }
コード例 #46
0
 /// <summary>
 /// Sets orientation of the item but it does not cause the recalculate layout flag setting on the parent item.
 /// </summary>
 /// <param name="o">New orientation value.</param>
 internal void SetOrientation(eOrientation o)
 {
     if (m_Orientation != o)
     {
         m_Orientation = o;
         if (m_SubItems != null)
         {
             foreach (BaseItem objItem in m_SubItems)
             {
                 objItem.Orientation = m_Orientation;
             }
         }
         m_NeedRecalcSize = true;
     }
 }
コード例 #47
0
 /// <summary>
 /// Returns Preferrred size of the docked control.
 /// </summary>
 System.Drawing.Size IDockInfo.PreferredDockSize(eOrientation dockOrientation)
 {
     return this.PreferredDockSize(dockOrientation);
 }