Exemplo n.º 1
0
 public static void DrawStringDisabled(Graphics graphics, string s, Font font, Color_ color, RectangleF_ layoutRectangle, StringFormat format)
 {
     ThemeEngine.Current.CPDrawStringDisabled(graphics, s, font, color, layoutRectangle, format);
 }
Exemplo n.º 2
0
			private void InitFormsSize ()
			{
				int tb_width = 0;

				// Max width of messagebox must be 60% of screen width
				int max_width = (int) (Screen.GetWorkingArea (this).Width * 0.6);
				if (max_width > 500) {
					float dx;
					using (Graphics g = this.CreateGraphics ()) {
						dx = g.DpiX;
					}
					int new_max_width = (int) (dx * 5.0);	// aim for text no wider than 5.0 inches
					if (new_max_width < max_width)
						max_width = new_max_width;
				}
				// First we have to know the Size_ of text + image
				int iconImageWidth = 0;
				if (icon_image != null)
					iconImageWidth = icon_image.Width + 10;
				SizeF_ tsize = TextRenderer.MeasureText (msgbox_text, this.Font, new Size_ (max_width - iconImageWidth, int.MaxValue), TextFormatFlags.WordBreak);
				text_rect = new RectangleF ();
				text_rect.Height = tsize.Height;

				if (icon_image != null) {
					tsize.Width += iconImageWidth;
					if(icon_image.Height > tsize.Height) {
						// Place text middle-right
						text_rect.Location = new Point_ (icon_image.Width + space_image_text + space_border, (int)((icon_image.Height/2)-(tsize.Height/2)) + space_border);
					} else {
						text_rect.Location = new Point_ (icon_image.Width + space_image_text + space_border, 2 + space_border);
					}
					if (tsize.Height < icon_image.Height)
						tsize.Height = icon_image.Height;
				} else {
					text_rect.Location = new Point_ (space_border + button_space, space_border);
				}
				tsize.Height += space_border * 2;
				text_rect.Height += space_border;

				// Now we want to know the amount of buttons
				int buttoncount;
				switch (msgbox_buttons) {
					case MessageBoxButtons.OK:
						buttoncount = 1;
						break;

					case MessageBoxButtons.OKCancel:
						buttoncount = 2;
						break;

					case MessageBoxButtons.AbortRetryIgnore:
						buttoncount = 3;
						break;

					case MessageBoxButtons.YesNoCancel:
						buttoncount = 3;
						break;

					case MessageBoxButtons.YesNo:
						buttoncount = 2;
						break;

					case MessageBoxButtons.RetryCancel:
						buttoncount = 2;
						break;
					
					default:
						buttoncount = 0;
						break;
				
				}
				if (show_help)
					buttoncount ++;
				
				// Calculate the width based on amount of buttons 
				tb_width = (button_width + button_space) * buttoncount;  

				// The form caption can also make us bigger
				SizeF_ caption = TextRenderer.MeasureString (Text, new Font (DefaultFont, FontStyle.Bold));
				
				// Use the bigger of the caption Size_ (plus some arbitrary borders/close button)
				// or the text size, up to 60% of the screen (max_size)
				Size_ new_size = new SizeF_ (Math.Min (Math.Max (caption.Width + 40, tsize.Width), max_width), tsize.Height).ToSize ();
				
				// Now we choose the good Size_ for the form
				if (new_size.Width > tb_width)
					this.ClientSize = new Size_ (new_size.Width + (space_border * 2), Height = new_size.Height + (space_border * 4));
				else
					this.ClientSize = new Size_ (tb_width + (space_border * 2), Height = new_size.Height + (space_border * 4));

				text_rect.Width = new_size.Width - iconImageWidth;

				// Now we set the left of the buttons
				button_left = (this.ClientSize.Width / 2) - (tb_width / 2) + 5;
				AddButtons ();
				size_known = true;

				// Still needs to implement defaultButton and options
				switch(msgbox_default) {
					case MessageBoxDefaultButton.Button2: {
						if (this.buttons[1] != null) {
							ActiveControl = this.buttons[1];
						}
						break;
					}

					case MessageBoxDefaultButton.Button3: {
						if (this.buttons[2] != null) {
							ActiveControl = this.buttons[2];
						}
						break;
					}
				}
			}
Exemplo n.º 3
0
 public void Warp(PointF_[] destPoints, RectangleF_ srcRect)
 {
     Warp(destPoints, srcRect, null, WarpMode.Perspective, FlatnessDefault);
 }
Exemplo n.º 4
0
 public void Warp(PointF_[] destPoints, RectangleF_ srcRect, Matrix matrix, WarpMode warpMode)
 {
     Warp(destPoints, srcRect, matrix, warpMode, FlatnessDefault);
 }
Exemplo n.º 5
0
        //
        // AddEllipse
        //
        public void AddEllipse(RectangleF_ r)
        {
            Status status = GDIPlus.GdipAddPathEllipse(nativePath, r.X, r.Y, r.Width, r.Height);

            GDIPlus.CheckStatus(status);
        }
Exemplo n.º 6
0
        public void AddRectangle(RectangleF_ rect)
        {
            Status status = GDIPlus.GdipAddPathRectangle(nativePath, rect.X, rect.Y, rect.Width, rect.Height);

            GDIPlus.CheckStatus(status);
        }
Exemplo n.º 7
0
 public abstract void CPDrawStringDisabled(Graphics graphics, string s, Font font, Color_ color, RectangleF_ layoutRectangle,
                                           StringFormat format);
Exemplo n.º 8
0
        public void AddArc(RectangleF_ rect, float start_angle, float sweep_angle)
        {
            Status status = GDIPlus.GdipAddPathArc(nativePath, rect.X, rect.Y, rect.Width, rect.Height, start_angle, sweep_angle);

            GDIPlus.CheckStatus(status);
        }
Exemplo n.º 9
0
 internal static Region[] MeasureCharacterRanges(string text, Font font, RectangleF_ layoutRect, StringFormat stringFormat)
 {
     return(Hwnd.GraphicsContext.MeasureCharacterRanges(text, font, layoutRect, stringFormat));
 }
Exemplo n.º 10
0
 public abstract void CPDrawBorder(Graphics graphics, RectangleF_ bounds, Color_ leftColor, int leftWidth,
                                   ButtonBorderStyle leftStyle, Color_ topColor, int topWidth, ButtonBorderStyle topStyle,
                                   Color_ rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color_ bottomColor,
                                   int bottomWidth, ButtonBorderStyle bottomStyle);
Exemplo n.º 11
0
 public Metafile(string fileName, IntPtr referenceHdc, RectangleF_ frameRect, MetafileFrameUnit frameUnit,
                 string description) : this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual,
                                            description)
 {
 }
Exemplo n.º 12
0
 public Metafile(string fileName, IntPtr referenceHdc, RectangleF_ frameRect, MetafileFrameUnit frameUnit,
                 EmfType type) : this(fileName, referenceHdc, frameRect, frameUnit, type, null)
 {
 }
Exemplo n.º 13
0
 public Metafile(Stream stream, IntPtr referenceHdc, RectangleF_ frameRect, MetafileFrameUnit frameUnit,
                 EmfType type) : this(stream, referenceHdc, frameRect, frameUnit, type, null)
 {
 }
Exemplo n.º 14
0
 public Metafile(string fileName, IntPtr referenceHdc, RectangleF_ frameRect) :
     this(fileName, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible, EmfType.EmfPlusDual, null)
 {
 }
Exemplo n.º 15
0
 public Metafile(IntPtr referenceHdc, RectangleF_ frameRect, MetafileFrameUnit frameUnit) :
     this(referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, null)
 {
 }