DrawTip() 공개 정적인 메소드

public static DrawTip ( Control control, Graphics graphics, Font font, string description ) : Size
control System.Windows.Forms.Control
graphics System.Drawing.Graphics
font System.Drawing.Font
description string
리턴 System.Drawing.Size
예제 #1
0
        public static Size DrawHelpTip(Control control, Graphics graphics, Font font, string countMessage, string basicDescription, string documentation)
        {
            if (IsVisibleText(countMessage) || IsVisibleText(basicDescription) || IsVisibleText(documentation))
            {
                // Create all the TipSection objects.
                CountTipText countMessageTip = new CountTipText(graphics, font, countMessage);

                TipSpacer countSpacer = new TipSpacer(graphics, new SizeF(IsVisibleText(countMessage) ? 4 : 0, 0));

                TipText descriptionTip = new TipText(graphics, font, basicDescription);

                TipSpacer docSpacer = new TipSpacer(graphics, new SizeF(0, IsVisibleText(documentation) ? 4 : 0));

                TipText docTip = new TipText(graphics, font, documentation);

                // Now put them together.
                TipSplitter descSplitter = new TipSplitter(graphics, false, descriptionTip, docSpacer);

                TipSplitter mainSplitter = new TipSplitter(graphics, true, countMessageTip, countSpacer, descSplitter);

                TipSplitter mainSplitter2 = new TipSplitter(graphics, false, mainSplitter, docTip);

                // Show it.
                Size size = TipPainter.DrawTip(control, graphics, mainSplitter2);
                DrawingRectangle1 = countMessageTip.DrawingRectangle1;
                DrawingRectangle2 = countMessageTip.DrawingRectangle2;
                return(size);
            }

            return(Size.Empty);
        }
        public static Size DrawHelpTip(Control control,
                                       Graphics graphics, Font font,
                                       string countMessage,
                                       string basicDescription,
                                       string documentation)
        {
            if (IsVisibleText(countMessage) ||
                IsVisibleText(basicDescription) ||
                IsVisibleText(documentation))
            {
                // Create all the TipSection objects.
                CountTipText countMessageTip = new CountTipText(graphics, font, countMessage);

                TipSpacer countSpacer = new TipSpacer(graphics, new SizeF(IsVisibleText(countMessage) ? 4 : 0, 0));

                Font boldfont = font;
                if (boldTile && documentation != null)
                {
                    boldfont = new Font(font.FontFamily, 9.75f, FontStyle.Bold);
                }

                TipText descriptionTip = new TipText(graphics, boldfont, basicDescription);

                if (boldTile && documentation != null)
                {
                    descriptionTip.Color = (TipPainter.darkScheme) ? Color.WhiteSmoke : Color.FromArgb(50, 50, 50);
                }

                TipSpacer docSpacer = new TipSpacer(graphics, new SizeF(0, IsVisibleText(documentation) ? 4 : 0));

                TipText docTip = new TipText(graphics, font, documentation);

                // Now put them together.
                TipSplitter descSplitter = new TipSplitter(graphics, false,
                                                           descriptionTip,
                                                           docSpacer
                                                           );

                TipSplitter mainSplitter = new TipSplitter(graphics, true,
                                                           countMessageTip,
                                                           countSpacer,
                                                           descSplitter);

                TipSplitter mainSplitter2 = new TipSplitter(graphics, false,
                                                            mainSplitter,
                                                            docTip);

                // Show it.
                Size size = TipPainter.DrawTip(control, graphics, mainSplitter2);
                DrawingRectangle1 = countMessageTip.DrawingRectangle1;
                DrawingRectangle2 = countMessageTip.DrawingRectangle2;
                return(size);
            }
            return(Size.Empty);
        }
예제 #3
0
        public static Size DrawHelpTip(
            Control control,
            Graphics graphics, Font font,
            string countMessage,
            string basicDescription,
            string documentation)
        {
            if (!string.IsNullOrEmpty(countMessage) ||
                !string.IsNullOrEmpty(basicDescription) ||
                !string.IsNullOrEmpty(documentation))
            {
                // Create all the TipSection objects.
                var countMessageTip = new CountTipText(graphics, font, countMessage);

                var countSpacer = new TipSpacer(graphics, new SizeF(!string.IsNullOrEmpty(countMessage) ? 4 : 0, height: 0));

                var descriptionTip = new TipText(graphics, font, basicDescription);

                var docSpacer = new TipSpacer(graphics, new SizeF(width: 0, !string.IsNullOrEmpty(documentation) ? 4 : 0));

                var docTip = new TipText(graphics, font, documentation);

                // Now put them together.
                var descSplitter = new TipSplitter(
                    graphics, horizontal: false,
                    descriptionTip,
                    docSpacer
                    );

                var mainSplitter = new TipSplitter(
                    graphics, horizontal: true,
                    countMessageTip,
                    countSpacer,
                    descSplitter);

                var mainSplitter2 = new TipSplitter(
                    graphics, horizontal: false,
                    mainSplitter,
                    docTip);

                // Show it.
                var size = TipPainter.DrawTip(control, graphics, mainSplitter2);
                DrawingRectangle1 = countMessageTip.DrawingRectangle1;
                DrawingRectangle2 = countMessageTip.DrawingRectangle2;
                return(size);
            }

            return(Size.Empty);
        }
예제 #4
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);
        }
예제 #5
0
        public static Size DrawHelpTip(Control control,
                                       Graphics graphics, Font font,
                                       string countMessage,
                                       string basicDescription,
                                       string documentation,
                                       int beg_bold, int bold_len, int param_num, bool addit_info)
        {
            if (IsVisibleText(countMessage) ||
                IsVisibleText(basicDescription) ||
                IsVisibleText(documentation))
            {
                // Create all the TipSection objects.
                CountTipText countMessageTip = new CountTipText(graphics, font, countMessage);

                TipSpacer countSpacer = new TipSpacer(graphics, new SizeF(IsVisibleText(countMessage) ? 4 : 0, 0));

                TipText descriptionTip = new TipText(graphics, font, basicDescription);
                descriptionTip.insight_wnd = control is ICSharpCode.TextEditor.Gui.InsightWindow.PABCNETInsightWindow;
                descriptionTip.beg_bold    = beg_bold;
                descriptionTip.len_bold    = bold_len;
                TipText descriptionTip1 = new TipText(graphics, font, basicDescription.Substring(0, beg_bold));
                TipText descriptionTip2 = new TipText(graphics, new Font(font, FontStyle.Bold), basicDescription.Substring(beg_bold, bold_len));
                TipText descriptionTip3 = new TipText(graphics, font, basicDescription.Substring(beg_bold + bold_len));
                descriptionTip.desc1 = descriptionTip1;
                descriptionTip.desc2 = descriptionTip2;
                descriptionTip.desc3 = descriptionTip3;
                TipSpacer         docSpacer = new TipSpacer(graphics, new SizeF(0, IsVisibleText(documentation) ? 4 : 0));
                List <TipSection> sections  = new List <TipSection>();
                if (documentation != null)
                {
                    try
                    {
                        int     params_ind          = documentation.IndexOf("<params>");
                        TipText paramsTextTipHeader = null;
                        TipText paramsTextTip       = null;
                        if (params_ind != -1 && addit_info)
                        {
                            paramsTextTipHeader         = new TipText(graphics, new Font(font, FontStyle.Bold), PascalABCCompiler.StringResources.Get("CODE_COMPLETION_PARAMETERS"));
                            paramsTextTipHeader.is_head = true;
                            int    end_param = documentation.IndexOf("<returns>", params_ind);
                            string params_text;
                            if (end_param == -1)
                            {
                                params_text = documentation.Substring(params_ind + 8).Trim(' ', '\n', '\r', '\t');
                                //paramsTextTip = new TipText(graphics,font,params_text);
                            }
                            else
                            {
                                params_text = documentation.Substring(params_ind + 8, end_param - params_ind - 8).Trim(' ', '\n', '\r', '\t');
                                //paramsTextTip = new TipText(graphics,font,documentation.Substring(params_ind+8,end_param-params_ind-8).Trim(' ','\n','\r','\t'));
                            }
                            List <string> prms_list = new List <string>();
                            int           ind       = params_text.IndexOf("<param>", 0);
                            while (ind != -1)
                            {
                                int end_ind = params_text.IndexOf("</param>", ind + 1);
                                prms_list.Add(params_text.Substring(ind + 7, end_ind - ind - 7).Trim(' ', '\n', '\t', '\r'));
                                ind = params_text.IndexOf("<param>", end_ind);
                                if (ind != -1)
                                {
                                    if (ind - end_ind - 7 > 0)
                                    {
                                        prms_list.Add(params_text.Substring(end_ind + 8, ind - end_ind - 8).Trim(' ', '\n', '\t', '\r'));
                                    }
                                    else
                                    {
                                        prms_list.Add("");
                                    }
                                }
                                else
                                {
                                    prms_list.Add(params_text.Substring(end_ind + 8).Trim(' ', '\n', '\t', '\r'));
                                }
                            }

                            List <TipSection> prm_sections = new List <TipSection>();
                            int i = 0;
                            while (i < prms_list.Count)
                            {
                                TipText prm_name_sect = new TipText(graphics, font, prms_list[i]);
                                prm_name_sect.param_name = true;
                                TipText desc_param_sect = new TipText(graphics, font, prms_list[i + 1]);
                                desc_param_sect.need_tab   = true;
                                desc_param_sect.param_desc = true;
                                //TipSplitter spltr = new TipSplitter(graphics,true,prm_name_sect,desc_param_sect);
                                if (!string.IsNullOrEmpty(prms_list[i + 1]))
                                {
                                    prm_sections.Add(prm_name_sect);
                                    prm_sections.Add(desc_param_sect);
                                }
                                i += 2;
                            }
                            if (prm_sections.Count > 0)
                            {
                                sections.Add(new TipText(graphics, new Font(font.FontFamily, 3), " "));
                                sections.Add(paramsTextTipHeader);
                                sections.AddRange(prm_sections);
                            }
                        }
                        int return_ind = documentation.IndexOf("<returns>");

                        /*TipText returnTextTipHeader = null;
                         * TipText returnTextTip = null;
                         * if (return_ind != -1 && addit_info)
                         * {
                         *  returnTextTipHeader = new TipText(graphics,new Font(font, FontStyle.Bold),PascalABCCompiler.StringResources.Get("CODE_COMPLETION_RETURN"));
                         *  returnTextTipHeader.is_head = true;
                         *  int end_return = documentation.IndexOf("<params>",return_ind);
                         *  string return_text;
                         *  if (end_return == -1)
                         *      return_text = documentation.Substring(return_ind+9).Trim(' ','\n','\r','\t');
                         *  else
                         *      return_text = documentation.Substring(return_ind+9,end_return-return_ind-9).Trim(' ','\n','\r','\t');
                         *
                         *  if (!string.IsNullOrEmpty(return_text))
                         *  {
                         *      returnTextTip = new TipText(graphics,font,return_text);
                         *      sections.Add(new TipText(graphics,new Font(font.FontFamily,3)," "));
                         *      sections.Add(returnTextTipHeader);
                         *      sections.Add(returnTextTip);
                         *      returnTextTip.need_tab = true;
                         *  }
                         * }*/
                        if (params_ind != -1 && return_ind != -1)
                        {
                            documentation = documentation.Substring(0, Math.Min(params_ind, return_ind)).Trim(' ', '\n', '\t', '\r');
                        }
                        else
                        if (params_ind != -1)
                        {
                            documentation = documentation.Substring(0, params_ind).Trim(' ', '\n', '\t', '\r');
                        }
                        else
                        if (return_ind != -1)
                        {
                            documentation = documentation.Substring(0, return_ind).Trim(' ', '\n', '\t', '\r');
                        }
                    }
                    catch
                    {
                    }
                }
                TipText docTip = new TipText(graphics, font, documentation);
                //docTip.is_doc = true;
                docTip.need_tab = true;
                sections.Insert(0, docTip);
                if (!string.IsNullOrEmpty(documentation))
                {
                    TipText descr_head = new TipText(graphics, new Font(font, FontStyle.Bold), PascalABCCompiler.StringResources.Get("CODE_COMPLETION_DESCRIPTION"));
                    descr_head.is_head = true;
                    sections.Insert(0, descr_head);
                    sections.Insert(0, new TipText(graphics, new Font(font.FontFamily, 1), " "));
                }
                TipSplitter descSplitter = new TipSplitter(graphics, true,
                                                           descriptionTip,
                                                           docSpacer
                                                           );
                // Now put them together.

                /*TipSplitter descSplitter = new TipSplitter(graphics,true,
                 *                                         descriptionTip1,
                 *                                         descriptionTip2,
                 *                                         descriptionTip3,
                 *                                         docSpacer
                 *                                         );*/
                descSplitter.is_desc = true;

                /*TipSplitter descSplitter1 = new TipSplitter(graphics, false,
                 *                                         //descriptionTip,
                 *                                         descriptionTip1
                 *                                         );
                 *
                 * TipSplitter descSplitter2 = new TipSplitter(graphics, false,
                 *                                         //descriptionTip,
                 *                                         descriptionTip2
                 *                                         );
                 *
                 * TipSplitter descSplitter3 = new TipSplitter(graphics, false,
                 *                                         //descriptionTip,
                 *                                         descriptionTip3,
                 *                                         docSpacer
                 *                                         );*/

                TipSplitter mainSplitter = new TipSplitter(graphics, true,
                                                           countMessageTip,
                                                           countSpacer,
                                                           descSplitter);

                sections.Insert(0, mainSplitter);
                TipSplitter mainSplitter2 = new TipSplitter(graphics, false,
                                                            sections.ToArray());
                // Show it.
                Size size = TipPainter.DrawTip(control, graphics, mainSplitter2);
                DrawingRectangle1 = countMessageTip.DrawingRectangle1;
                DrawingRectangle2 = countMessageTip.DrawingRectangle2;
                return(size);
            }
            return(Size.Empty);
        }
 public static Size DrawTip(Control control, Graphics graphics, Font font, string description)
 {
     return(TipPainter.DrawTip(control, graphics, new TipText(graphics, font, description)));
 }