public static Size DrawTip(Control control, Graphics graphics, TipSection tipData)
        {
            Size       empty        = Size.Empty;
            SizeF      requiredSize = SizeF.Empty;
            PointF     screen       = control.PointToScreen(Point.Empty);
            RectangleF workingArea  = TipPainter.GetWorkingArea(control);
            SizeF      sizeF        = new SizeF(workingArea.Right - screen.X - 4f, workingArea.Bottom - screen.Y - 2f);

            if (sizeF.Width > 0f && sizeF.Height > 0f)
            {
                graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                tipData.SetMaximumSize(sizeF);
                requiredSize = tipData.GetRequiredSize();
                tipData.SetAllocatedSize(requiredSize);
                requiredSize += new SizeF(4f, 2f);
                empty         = Size.Ceiling(requiredSize);
            }
            if (control.ClientSize != empty)
            {
                control.ClientSize = empty;
            }
            if (empty != Size.Empty)
            {
                Rectangle  rectangle  = new Rectangle(Point.Empty, empty - new Size(1, 1));
                RectangleF rectangleF = new RectangleF(2f, 1f, requiredSize.Width - 4f, requiredSize.Height - 2f);
                graphics.DrawRectangle(SystemPens.WindowFrame, rectangle);
                tipData.Draw(new PointF(2f, 1f));
            }
            return(empty);
        }
예제 #2
0
		public static Size GetLeftHandSideTipSize(Control control, Graphics graphics, TipSection tipData, Point p)
		{
			Size tipSize = Size.Empty;
			SizeF tipSizeF = SizeF.Empty;
			
			RectangleF workingArea = GetWorkingArea(control);
			
			PointF screenLocation = p;
			
			SizeF maxLayoutSize = new SizeF(screenLocation.X - HorizontalBorder * 2,
			                                workingArea.Bottom - screenLocation.Y - VerticalBorder * 2);
			
			if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0) {
				graphics.TextRenderingHint =
					TextRenderingHint.AntiAliasGridFit;
				
				tipData.SetMaximumSize(maxLayoutSize);
				tipSizeF = tipData.GetRequiredSize();
				tipData.SetAllocatedSize(tipSizeF);
				
				tipSizeF += new SizeF(HorizontalBorder * 2,
				                      VerticalBorder   * 2);
				tipSize = Size.Ceiling(tipSizeF);
			}
			
			return tipSize;
		}
예제 #3
0
		public static Size GetTipSize(Control control, Graphics graphics, TipSection tipData)
		{
			Size tipSize = Size.Empty;
			SizeF tipSizeF = SizeF.Empty;
			
			if (workingArea == RectangleF.Empty) {
				Form ownerForm = control.FindForm();
				if (ownerForm.Owner != null) {
					ownerForm = ownerForm.Owner;
				}
				
				workingArea = Screen.GetWorkingArea(ownerForm);
			}
			
			PointF screenLocation = control.PointToScreen(Point.Empty);
			SizeF maxLayoutSize = new SizeF(workingArea.Right /*- screenLocation.X*/ - HorizontalBorder * 2,
			                                workingArea.Bottom /*- screenLocation.Y*/ - VerticalBorder * 2);
			
			float global_max_x = workingArea.Right - HorizontalBorder * 2;
			
			if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0) {
				/*graphics.TextRenderingHint =
				TextRenderingHint.AntiAliasGridFit;*/
				tipData.GlobalMaxX = global_max_x;
				tipData.SetMaximumSize(maxLayoutSize);
				//if (tipData.LeftOffset > 0) 
				//	control.Left = control.Left - tipData.LeftOffset;
				tipSizeF = tipData.GetRequiredSize();
				tipData.SetAllocatedSize(tipSizeF);
				
				tipSizeF += new SizeF(HorizontalBorder * 2,
				                      VerticalBorder   * 2);
				tipSize = Size.Ceiling(tipSizeF);
			}
			if (control is ICSharpCode.TextEditor.Gui.InsightWindow.PABCNETInsightWindow)
			{
				Rectangle rect = Rectangle.Ceiling(workingArea);
				Point pt = (control as ICSharpCode.TextEditor.Gui.InsightWindow.PABCNETInsightWindow).GetCusorCoord();
				if (pt.X + tipSize.Width > rect.Width)
				{
					control.Location = new Point(rect.Width-tipSize.Width,pt.Y);
				}
			}
			else
			{
				Rectangle rect = Rectangle.Ceiling(workingArea);
				Point pt = control.Location;
				if (pt.X + tipSize.Width > rect.Width)
				{
					control.Location = new Point(rect.Width-tipSize.Width,pt.Y);
				}
			}
			if (control.ClientSize != tipSize) {
				control.ClientSize = tipSize;
			}
			
			return tipSize;
		}
예제 #4
0
        public static Size DrawTip(Control control, Graphics graphics, TipSection tipData)
        {
            Size  tipSize  = Size.Empty;
            SizeF tipSizeF = SizeF.Empty;

            PointF screenLocation = control.PointToScreen(Point.Empty);

            if (workingArea == RectangleF.Empty)
            {
                Form ownerForm = control.FindForm();
                if (ownerForm.Owner != null)
                {
                    ownerForm = ownerForm.Owner;
                }

                workingArea = Screen.GetWorkingArea(ownerForm);
            }

            SizeF maxLayoutSize = new SizeF(workingArea.Right - screenLocation.X - HorizontalBorder * 2,
                                            workingArea.Bottom - screenLocation.Y - VerticalBorder * 2);

            if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0)
            {
                graphics.TextRenderingHint =
                    TextRenderingHint.AntiAliasGridFit;

                tipData.SetMaximumSize(maxLayoutSize);
                tipSizeF = tipData.GetRequiredSize();
                tipData.SetAllocatedSize(tipSizeF);

                tipSizeF += new SizeF(HorizontalBorder * 2,
                                      VerticalBorder * 2);
                tipSize = Size.Ceiling(tipSizeF);
            }

            if (control.ClientSize != tipSize)
            {
                control.ClientSize = tipSize;
            }

            if (tipSize != Size.Empty)
            {
                Rectangle borderRectangle = new Rectangle
                                                (Point.Empty, tipSize - new Size(1, 1));

                RectangleF displayRectangle = new RectangleF
                                                  (HorizontalBorder, VerticalBorder,
                                                  tipSizeF.Width - HorizontalBorder * 2,
                                                  tipSizeF.Height - VerticalBorder * 2);

                // DrawRectangle draws from Left to Left + Width. A bug? :-/
                graphics.DrawRectangle(SystemPens.WindowFrame,
                                       borderRectangle);
                tipData.Draw(new PointF(HorizontalBorder, VerticalBorder));
            }
            return(tipSize);
        }
예제 #5
0
        public static Size DrawFixedWidthTip(Control control, Graphics graphics, TipSection tipData)
        {
            var tipSize  = Size.Empty;
            var tipSizeF = SizeF.Empty;

            PointF screenLocation = control.PointToScreen(new Point(control.Width, y: 0));

            RectangleF workingArea = GetWorkingArea(control);

            var maxLayoutSize = new SizeF(
                screenLocation.X - HorizontalBorder * 2,
                workingArea.Bottom - screenLocation.Y - VerticalBorder * 2);

            if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0)
            {
                graphics.TextRenderingHint =
                    TextRenderingHint.AntiAliasGridFit;

                tipData.SetMaximumSize(maxLayoutSize);
                tipSizeF = tipData.GetRequiredSize();
                tipData.SetAllocatedSize(tipSizeF);

                tipSizeF += new SizeF(
                    HorizontalBorder * 2,
                    VerticalBorder * 2);
                tipSize = Size.Ceiling(tipSizeF);
            }

            if (control.Height != tipSize.Height)
            {
                control.Height = tipSize.Height;
            }

            if (tipSize != Size.Empty)
            {
                var borderRectangle = new Rectangle
                                          (Point.Empty, control.Size - new Size(width: 1, height: 1));

//                var displayRectangle = new RectangleF
//                (
//                    HorizontalBorder, VerticalBorder,
//                    tipSizeF.Width - HorizontalBorder*2,
//                    tipSizeF.Height - VerticalBorder*2);

                // DrawRectangle draws from Left to Left + Width. A bug? :-/
                graphics.DrawRectangle(
                    SystemPens.WindowFrame,
                    borderRectangle);
                tipData.Draw(new PointF(HorizontalBorder, VerticalBorder));
            }

            return(tipSize);
        }
예제 #6
0
		public static Size DrawTip(Control control, Graphics graphics, TipSection tipData)
		{
			Size tipSize = Size.Empty;
			SizeF tipSizeF = SizeF.Empty;
			
			PointF screenLocation = control.PointToScreen(Point.Empty);
			
			if (workingArea == RectangleF.Empty) {
				Form ownerForm = control.FindForm();
				if (ownerForm.Owner != null) {
					ownerForm = ownerForm.Owner;
				}
				
				workingArea = Screen.GetWorkingArea(ownerForm);
			}
	
			SizeF maxLayoutSize = new SizeF(workingArea.Right - screenLocation.X - HorizontalBorder * 2,
			                                workingArea.Bottom - screenLocation.Y - VerticalBorder * 2);
			
			if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0) {
				//graphics.TextRenderingHint =
				//TextRenderingHint.AntiAliasGridFit;
				
				tipData.SetMaximumSize(maxLayoutSize);
				tipSizeF = tipData.GetRequiredSize();
				tipData.SetAllocatedSize(tipSizeF);
				
				tipSizeF += new SizeF(HorizontalBorder * 2,
				                      VerticalBorder   * 2);
				tipSize = Size.Ceiling(tipSizeF);
			}
			
			if (control.ClientSize != tipSize) {
				control.ClientSize = tipSize;
			}
			
			if (tipSize != Size.Empty) {
				Rectangle borderRectangle = new Rectangle
				(Point.Empty, tipSize - new Size(1, 1));
				
				RectangleF displayRectangle = new RectangleF
				(HorizontalBorder, VerticalBorder,
				 tipSizeF.Width - HorizontalBorder * 2,
				 tipSizeF.Height - VerticalBorder * 2);
				
				// DrawRectangle draws from Left to Left + Width. A bug? :-/
				graphics.DrawRectangle(SystemPens.WindowFrame,
				                       borderRectangle);
				tipData.Draw(new PointF(HorizontalBorder, VerticalBorder));
			}
			return tipSize;
		}
        protected override void OnMaximumSizeChanged()
        {
            float single;

            base.OnMaximumSizeChanged();
            float single1     = 0f;
            float single2     = 0f;
            SizeF maximumSize = base.MaximumSize;

            for (int i = 0; i < (int)this.tipSections.Length; i++)
            {
                TipSection tipSection = this.tipSections[i];
                tipSection.SetMaximumSize(maximumSize);
                SizeF requiredSize = tipSection.GetRequiredSize();
                this.offsets[i] = single1;
                if (!this.isHorizontal)
                {
                    single             = (float)Math.Ceiling((double)requiredSize.Height);
                    single1           += single;
                    maximumSize.Height = Math.Max(0f, maximumSize.Height - single);
                    single2            = Math.Max(single2, requiredSize.Width);
                }
                else
                {
                    single            = (float)Math.Ceiling((double)requiredSize.Width);
                    single1          += single;
                    maximumSize.Width = Math.Max(0f, maximumSize.Width - single);
                    single2           = Math.Max(single2, requiredSize.Height);
                }
            }
            TipSection[] tipSectionArray = this.tipSections;
            for (int j = 0; j < (int)tipSectionArray.Length; j++)
            {
                TipSection tipSection1 = tipSectionArray[j];
                if (!this.isHorizontal)
                {
                    SizeF sizeF = tipSection1.GetRequiredSize();
                    tipSection1.SetAllocatedSize(new SizeF(single2, sizeF.Height));
                }
                else
                {
                    SizeF requiredSize1 = tipSection1.GetRequiredSize();
                    tipSection1.SetAllocatedSize(new SizeF(requiredSize1.Width, single2));
                }
            }
            if (this.isHorizontal)
            {
                base.SetRequiredSize(new SizeF(single1, single2));
                return;
            }
            base.SetRequiredSize(new SizeF(single2, single1));
        }
예제 #8
0
        public static Size DrawTip(Control control, Graphics graphics, TipSection tipData)
        {
            Size  tipSize  = Size.Empty;
            SizeF tipSizeF = SizeF.Empty;

            PointF screenLocation = control.PointToScreen(Point.Empty);

            RectangleF workingArea = GetWorkingArea(control);

            SizeF maxLayoutSize = new SizeF(workingArea.Right - screenLocation.X - HorizontalBorder * 2,
                                            workingArea.Bottom - screenLocation.Y - VerticalBorder * 2);

            if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0)
            {
                graphics.TextRenderingHint =
                    TextRenderingHint.ClearTypeGridFit;
                graphics.TextContrast = 0;

                tipData.SetMaximumSize(maxLayoutSize);
                tipSizeF = tipData.GetRequiredSize();
                tipData.SetAllocatedSize(tipSizeF);

                tipSizeF += new SizeF(HorizontalBorder * 2,
                                      VerticalBorder * 2);
                tipSize = Size.Ceiling(tipSizeF);
            }

            if (control.ClientSize != tipSize)
            {
                control.ClientSize = tipSize;
            }

            if (tipSize != Size.Empty)
            {
                Rectangle borderRectangle = new Rectangle
                                                (Point.Empty, tipSize - new Size(1, 1));

                RectangleF displayRectangle = new RectangleF
                                                  (HorizontalBorder, VerticalBorder,
                                                  tipSizeF.Width - HorizontalBorder * 2,
                                                  tipSizeF.Height - VerticalBorder * 2);

                Pen borderFrame = new Pen((darkScheme) ? Color.FromArgb(0x70, 0x70, 0x80) : Color.Black);

                // DrawRectangle draws from Left to Left + Width. A bug? :-/
                graphics.DrawRectangle(borderFrame,
                                       borderRectangle);
                tipData.Draw(new PointF(HorizontalBorder, VerticalBorder));
            }
            return(tipSize);
        }
예제 #9
0
        public static Size DrawHelpTip(Control control, Graphics graphics, Font font, string countMessage, string basicDescription, string documentation)
        {
            object obj;
            object obj1;

            if (!TipPainterTools.IsVisibleText(countMessage) && !TipPainterTools.IsVisibleText(basicDescription) && !TipPainterTools.IsVisibleText(documentation))
            {
                return(Size.Empty);
            }
            CountTipText countTipText = new CountTipText(graphics, font, countMessage);
            Graphics     graphic      = graphics;

            if (TipPainterTools.IsVisibleText(countMessage))
            {
                obj = 4;
            }
            else
            {
                obj = null;
            }
            TipSpacer tipSpacer = new TipSpacer(graphic, new SizeF((float)obj, 0f));
            TipText   tipText   = new TipText(graphics, font, basicDescription);
            Graphics  graphic1  = graphics;

            if (TipPainterTools.IsVisibleText(documentation))
            {
                obj1 = 4;
            }
            else
            {
                obj1 = null;
            }
            TipSpacer tipSpacer1 = new TipSpacer(graphic1, new SizeF(0f, (float)obj1));
            TipText   tipText1   = new TipText(graphics, font, documentation);

            TipSection[] tipSectionArray = new TipSection[] { tipText, tipSpacer1 };
            TipSplitter  tipSplitter     = new TipSplitter(graphics, false, tipSectionArray);

            TipSection[] tipSectionArray1 = new TipSection[] { countTipText, tipSpacer, tipSplitter };
            TipSplitter  tipSplitter1     = new TipSplitter(graphics, true, tipSectionArray1);

            TipSection[] tipSectionArray2 = new TipSection[] { tipSplitter1, tipText1 };
            TipSplitter  tipSplitter2     = new TipSplitter(graphics, false, tipSectionArray2);
            Size         size             = TipPainter.DrawTip(control, graphics, tipSplitter2);

            TipPainterTools.DrawingRectangle1 = countTipText.DrawingRectangle1;
            TipPainterTools.DrawingRectangle2 = countTipText.DrawingRectangle2;
            return(size);
        }
예제 #10
0
        public static Size DrawFixedWidthTip(Control control, Graphics graphics, TipSection tipData)
        {
            Size tipSize = Size.Empty;
            SizeF tipSizeF = SizeF.Empty;

            PointF screenLocation = control.PointToScreen(new Point(control.Width, 0));

            RectangleF workingArea = GetWorkingArea(control);

            SizeF maxLayoutSize = new SizeF(screenLocation.X - HorizontalBorder * 2,
                                            workingArea.Bottom - screenLocation.Y - VerticalBorder * 2);

            if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0) {
                graphics.TextRenderingHint =
                    TextRenderingHint.AntiAliasGridFit;

                tipData.SetMaximumSize(maxLayoutSize);
                tipSizeF = tipData.GetRequiredSize();
                tipData.SetAllocatedSize(tipSizeF);

                tipSizeF += new SizeF(HorizontalBorder * 2,
                                      VerticalBorder   * 2);
                tipSize = Size.Ceiling(tipSizeF);
            }

            if (control.Height != tipSize.Height) {
                control.Height = tipSize.Height;
            }

            if (tipSize != Size.Empty) {
                Rectangle borderRectangle = new Rectangle
                    (Point.Empty, control.Size - new Size(1, 1));

                RectangleF displayRectangle = new RectangleF
                    (HorizontalBorder, VerticalBorder,
                     tipSizeF.Width - HorizontalBorder * 2,
                     tipSizeF.Height - VerticalBorder * 2);

                // DrawRectangle draws from Left to Left + Width. A bug? :-/
                graphics.DrawRectangle(SystemPens.WindowFrame,
                                       borderRectangle);
                tipData.Draw(new PointF(HorizontalBorder, VerticalBorder));
            }
            return tipSize;
        }
예제 #11
0
        public static Size GetTipSize(Control control, Graphics graphics, TipSection tipData)
        {
            Size  tipSize  = Size.Empty;
            SizeF tipSizeF = SizeF.Empty;

            if (workingArea == RectangleF.Empty)
            {
                Form ownerForm = control.FindForm();
                if (ownerForm.Owner != null)
                {
                    ownerForm = ownerForm.Owner;
                }

                workingArea = Screen.GetWorkingArea(ownerForm);
            }

            PointF screenLocation = control.PointToScreen(Point.Empty);

            SizeF maxLayoutSize = new SizeF(workingArea.Right - screenLocation.X - HorizontalBorder * 2,
                                            workingArea.Bottom - screenLocation.Y - VerticalBorder * 2);

            if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0)
            {
                graphics.TextRenderingHint =
                    TextRenderingHint.AntiAliasGridFit;

                tipData.SetMaximumSize(maxLayoutSize);
                tipSizeF = tipData.GetRequiredSize();
                tipData.SetAllocatedSize(tipSizeF);

                tipSizeF += new SizeF(HorizontalBorder * 2,
                                      VerticalBorder * 2);
                tipSize = Size.Ceiling(tipSizeF);
            }

            if (control.ClientSize != tipSize)
            {
                control.ClientSize = tipSize;
            }

            return(tipSize);
        }
예제 #12
0
		public static Size GetTipSize(Control control, Graphics graphics, TipSection tipData)
		{
			Size tipSize = Size.Empty;
			SizeF tipSizeF = SizeF.Empty;
			
			if (workingArea == RectangleF.Empty) {
				Form ownerForm = control.FindForm();
				if (ownerForm.Owner != null) {
					ownerForm = ownerForm.Owner;
				}
				
				workingArea = Screen.GetWorkingArea(ownerForm);
			}
			
			PointF screenLocation = control.PointToScreen(Point.Empty);
			
			SizeF maxLayoutSize = new SizeF(workingArea.Right - screenLocation.X - HorizontalBorder * 2,
			                                workingArea.Bottom - screenLocation.Y - VerticalBorder * 2);
			
			if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0) {
				//graphics.TextRenderingHint =
				//TextRenderingHint.AntiAliasGridFit;
				
				tipData.SetMaximumSize(maxLayoutSize);
				tipSizeF = tipData.GetRequiredSize();
				tipData.SetAllocatedSize(tipSizeF);
				
				tipSizeF += new SizeF(HorizontalBorder * 2,
				                      VerticalBorder   * 2);
				tipSize = Size.Ceiling(tipSizeF);
			}
			
			if (control.ClientSize != tipSize) {
				control.ClientSize = tipSize;
			}
			
			return tipSize;
		}
        public static Size GetTipSize(Control control, Graphics graphics, TipSection tipData)
        {
            Size       empty        = Size.Empty;
            SizeF      requiredSize = SizeF.Empty;
            RectangleF workingArea  = TipPainter.GetWorkingArea(control);
            PointF     screen       = control.PointToScreen(Point.Empty);
            SizeF      sizeF        = new SizeF(workingArea.Right - screen.X - 4f, workingArea.Bottom - screen.Y - 2f);

            if (sizeF.Width > 0f && sizeF.Height > 0f)
            {
                graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                tipData.SetMaximumSize(sizeF);
                requiredSize = tipData.GetRequiredSize();
                tipData.SetAllocatedSize(requiredSize);
                requiredSize += new SizeF(4f, 2f);
                empty         = Size.Ceiling(requiredSize);
            }
            if (control.ClientSize != empty)
            {
                control.ClientSize = empty;
            }
            return(empty);
        }
        protected override void OnMaximumSizeChanged()
        {
            base.OnMaximumSizeChanged();

            float currentDim    = 0;
            float otherDim      = 0;
            SizeF availableArea = MaximumSize;

            for (int i = 0; i < tipSections.Length; i++)
            {
                TipSection section = (TipSection)tipSections[i];

                section.SetMaximumSize(availableArea);

                SizeF requiredArea = section.GetRequiredSize();
                offsets[i] = currentDim;

                // It's best to start on pixel borders, so this will
                // round up to the nearest pixel. Otherwise there are
                // weird cutoff artifacts.
                float pixelsUsed;

                if (isHorizontal)
                {
                    pixelsUsed  = (float)Math.Ceiling(requiredArea.Width);
                    currentDim += pixelsUsed;

                    availableArea.Width = Math.Max
                                              (0, availableArea.Width - pixelsUsed);

                    otherDim = Math.Max(otherDim, requiredArea.Height);
                }
                else
                {
                    pixelsUsed  = (float)Math.Ceiling(requiredArea.Height);
                    currentDim += pixelsUsed;

                    availableArea.Height = Math.Max
                                               (0, availableArea.Height - pixelsUsed);

                    otherDim = Math.Max(otherDim, requiredArea.Width);
                }
            }

            foreach (TipSection section in tipSections)
            {
                if (isHorizontal)
                {
                    section.SetAllocatedSize(new SizeF(section.GetRequiredSize().Width, otherDim));
                }
                else
                {
                    section.SetAllocatedSize(new SizeF(otherDim, section.GetRequiredSize().Height));
                }
            }

            if (isHorizontal)
            {
                SetRequiredSize(new SizeF(currentDim, otherDim));
            }
            else
            {
                SetRequiredSize(new SizeF(otherDim, currentDim));
            }
        }
예제 #15
0
        public static Size GetLeftHandSideTipSize(Control control, Graphics graphics, TipSection tipData, Point p)
        {
            var tipSize = Size.Empty;

            RectangleF workingArea = GetWorkingArea(control);

            PointF screenLocation = p;

            var maxLayoutSize = new SizeF(
                screenLocation.X - HorizontalBorder * 2,
                workingArea.Bottom - screenLocation.Y - VerticalBorder * 2);

            if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0)
            {
                graphics.TextRenderingHint =
                    TextRenderingHint.AntiAliasGridFit;

                tipData.SetMaximumSize(maxLayoutSize);
                var tipSizeF = tipData.GetRequiredSize();
                tipData.SetAllocatedSize(tipSizeF);

                tipSizeF += new SizeF(
                    HorizontalBorder * 2,
                    VerticalBorder * 2);
                tipSize = Size.Ceiling(tipSizeF);
            }

            return(tipSize);
        }
        public static Size GetLeftHandSideTipSize(Control control, Graphics graphics, TipSection tipData, Point p)
        {
            Size       empty        = Size.Empty;
            SizeF      requiredSize = SizeF.Empty;
            RectangleF workingArea  = TipPainter.GetWorkingArea(control);
            PointF     pointF       = p;
            SizeF      sizeF        = new SizeF(pointF.X - 4f, workingArea.Bottom - pointF.Y - 2f);

            if (sizeF.Width > 0f && sizeF.Height > 0f)
            {
                graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                tipData.SetMaximumSize(sizeF);
                requiredSize = tipData.GetRequiredSize();
                tipData.SetAllocatedSize(requiredSize);
                requiredSize += new SizeF(4f, 2f);
                empty         = Size.Ceiling(requiredSize);
            }
            return(empty);
        }
예제 #17
0
        public static Size GetTipSize(Control control, Graphics graphics, TipSection tipData)
        {
            Size  tipSize  = Size.Empty;
            SizeF tipSizeF = SizeF.Empty;

            if (workingArea == RectangleF.Empty)
            {
                Form ownerForm = control.FindForm();
                if (ownerForm.Owner != null)
                {
                    ownerForm = ownerForm.Owner;
                }

                workingArea = Screen.GetWorkingArea(ownerForm);
            }

            PointF screenLocation = control.PointToScreen(Point.Empty);
            SizeF  maxLayoutSize  = new SizeF(workingArea.Right /*- screenLocation.X*/ - HorizontalBorder * 2,
                                              workingArea.Bottom /*- screenLocation.Y*/ - VerticalBorder * 2);

            float global_max_x = workingArea.Right - HorizontalBorder * 2;

            if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0)
            {
                /*graphics.TextRenderingHint =
                 * TextRenderingHint.AntiAliasGridFit;*/
                tipData.GlobalMaxX = global_max_x;
                tipData.SetMaximumSize(maxLayoutSize);
                //if (tipData.LeftOffset > 0)
                //	control.Left = control.Left - tipData.LeftOffset;
                tipSizeF = tipData.GetRequiredSize();
                tipData.SetAllocatedSize(tipSizeF);

                tipSizeF += new SizeF(HorizontalBorder * 2,
                                      VerticalBorder * 2);
                tipSize = Size.Ceiling(tipSizeF);
            }
            if (control is ICSharpCode.TextEditor.Gui.InsightWindow.PABCNETInsightWindow)
            {
                Rectangle rect = Rectangle.Ceiling(workingArea);
                Point     pt   = (control as ICSharpCode.TextEditor.Gui.InsightWindow.PABCNETInsightWindow).GetCusorCoord();
                if (pt.X + tipSize.Width > rect.Width)
                {
                    control.Location = new Point(rect.Width - tipSize.Width, pt.Y);
                }
            }
            else
            {
                Rectangle rect = Rectangle.Ceiling(workingArea);
                Point     pt   = control.Location;
                if (pt.X + tipSize.Width > rect.Width)
                {
                    control.Location = new Point(rect.Width - tipSize.Width, pt.Y);
                }
            }
            if (control.ClientSize != tipSize)
            {
                control.ClientSize = tipSize;
            }

            return(tipSize);
        }
예제 #18
0
        public static Size DrawTip(Control control, Graphics graphics, TipSection tipData)
        {
            Size  tipSize  = Size.Empty;
            SizeF tipSizeF = SizeF.Empty;

            PointF screenLocation = control.PointToScreen(Point.Empty);

            if (workingArea == RectangleF.Empty)
            {
                Form ownerForm = control.FindForm();
                if (ownerForm.Owner != null)
                {
                    ownerForm = ownerForm.Owner;
                }

                workingArea = Screen.GetWorkingArea(ownerForm);
            }

            SizeF maxLayoutSize = new SizeF(workingArea.Right /*- screenLocation.X*/ - HorizontalBorder * 2,
                                            workingArea.Bottom /*- screenLocation.Y*/ - VerticalBorder * 2);

            if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0)
            {
                /*graphics.TextRenderingHint =
                 * TextRenderingHint.AntiAliasGridFit;*/

                tipData.SetMaximumSize(maxLayoutSize);
                tipSizeF = tipData.GetRequiredSize();
                tipData.SetAllocatedSize(tipSizeF);

                tipSizeF += new SizeF(HorizontalBorder * 2,
                                      VerticalBorder * 2);
                tipSize = Size.Ceiling(tipSizeF);
            }

            if (control is ICSharpCode.TextEditor.Gui.InsightWindow.PABCNETInsightWindow)
            {
                Rectangle rect = Rectangle.Ceiling(workingArea);
                Point     pt   = (control as ICSharpCode.TextEditor.Gui.InsightWindow.PABCNETInsightWindow).GetCusorCoord();
                if (pt.X + tipSize.Width > rect.Width)
                {
                    control.Location = new Point(rect.Width - tipSize.Width, pt.Y);
                }
            }
            else
            {
                Rectangle rect = Rectangle.Ceiling(workingArea);
                Point     pt   = control.Location;
                if (pt.X + tipSize.Width > rect.Width)
                {
                    if (rect.Width - tipSize.Width > 0)
                    {
                        control.Location = new Point(rect.Width - tipSize.Width, pt.Y);
                    }
                    else
                    {
                        control.Location = new Point(10, pt.Y);
                    }
                }
            }

            if (control.ClientSize != tipSize)
            {
                control.ClientSize = tipSize;
            }

            if (tipSize != Size.Empty)
            {
                Rectangle borderRectangle = new Rectangle
                                                (Point.Empty, tipSize - new Size(1, 1));

                RectangleF displayRectangle = new RectangleF
                                                  (HorizontalBorder, VerticalBorder,
                                                  tipSizeF.Width - HorizontalBorder * 2,
                                                  tipSizeF.Height - VerticalBorder * 2);

                // DrawRectangle draws from Left to Left + Width. A bug? :-/
                graphics.DrawRectangle(SystemPens.WindowFrame,
                                       borderRectangle);
                tipData.Draw(new PointF(HorizontalBorder, VerticalBorder));
            }
            return(tipSize);
        }
예제 #19
0
		public static Size DrawTip(Control control, Graphics graphics, TipSection tipData)
		{
			Size tipSize = Size.Empty;
			SizeF tipSizeF = SizeF.Empty;
			
			PointF screenLocation = control.PointToScreen(Point.Empty);
			
			if (workingArea == RectangleF.Empty) {
				Form ownerForm = control.FindForm();
				if (ownerForm.Owner != null) {
					ownerForm = ownerForm.Owner;
				}
				
				workingArea = Screen.GetWorkingArea(ownerForm);
			}
				
			SizeF maxLayoutSize = new SizeF(workingArea.Right /*- screenLocation.X*/ - HorizontalBorder * 2,
			                                workingArea.Bottom /*- screenLocation.Y*/ - VerticalBorder * 2);
			if (maxLayoutSize.Width > 0 && maxLayoutSize.Height > 0) {
				/*graphics.TextRenderingHint =
				TextRenderingHint.AntiAliasGridFit;*/
				
				tipData.SetMaximumSize(maxLayoutSize);
				tipSizeF = tipData.GetRequiredSize();
				tipData.SetAllocatedSize(tipSizeF);
				
				tipSizeF += new SizeF(HorizontalBorder * 2,
				                      VerticalBorder   * 2);
				tipSize = Size.Ceiling(tipSizeF);
			}
			
			if (control is ICSharpCode.TextEditor.Gui.InsightWindow.PABCNETInsightWindow)
			{
				Rectangle rect = Rectangle.Ceiling(workingArea);
				Point pt = (control as ICSharpCode.TextEditor.Gui.InsightWindow.PABCNETInsightWindow).GetCusorCoord();
				if (pt.X + tipSize.Width > rect.Width)
				{
					control.Location = new Point(rect.Width-tipSize.Width,pt.Y);
				}
			}
			else
			{
				Rectangle rect = Rectangle.Ceiling(workingArea);
				Point pt = control.Location;
				if (pt.X + tipSize.Width > rect.Width)
				{
					if (rect.Width-tipSize.Width > 0)
					control.Location = new Point(rect.Width-tipSize.Width,pt.Y);
					else
					control.Location = new Point(10,pt.Y);
				}
			}
			
			if (control.ClientSize != tipSize) {
				control.ClientSize = tipSize;
			}
			
			if (tipSize != Size.Empty) {
				Rectangle borderRectangle = new Rectangle
				(Point.Empty, tipSize - new Size(1, 1));
				
				RectangleF displayRectangle = new RectangleF
				(HorizontalBorder, VerticalBorder,
				 tipSizeF.Width - HorizontalBorder * 2,
				 tipSizeF.Height - VerticalBorder * 2);
				
				// DrawRectangle draws from Left to Left + Width. A bug? :-/
				graphics.DrawRectangle(SystemPens.WindowFrame,
				                       borderRectangle);
				tipData.Draw(new PointF(HorizontalBorder, VerticalBorder));
			}
			return tipSize;
		}