// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// Copyright (c) 2004-2005 Novell, Inc.
+// Copyright (c) 2004-2006 Novell, Inc.
//
// Authors:
// Jordi Mas i Hernandez, jordi@ximian.com
// Peter Bartok, pbartok@novell.com
// John BouAntoun, jba-mono@optusnet.com.au
-// Marek Safar, marek.safar@seznam.cz
+// Marek Safar, marek.safar@seznam.cz
//
internal class ThemeWin32Classic : Theme
{
- public override Version Version {\r
- get {\r
- return new Version(0, 1, 0, 0);\r
- }\r
- }\r
-
-
- /* Default colors for Win32 classic theme */
- uint [] theme_colors = { /* AARRGGBB */
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_SCROLLBAR, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BACKGROUND, 0xff008080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_ACTIVECAPTION, 0xff000080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INACTIVECAPTION, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_MENU, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_WINDOW, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_WINDOWFRAME, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_MENUTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_WINDOWTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_CAPTIONTEXT, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_ACTIVEBORDER, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INACTIVEBORDER, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_APPWORKSPACE, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHT, 0xff000080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHTTEXT, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNFACE, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNSHADOW, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_GRAYTEXT, 0xff808080,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INACTIVECAPTIONTEXT, 0xffc0c0c0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_BTNHIGHLIGHT, 0xffffffff,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_3DDKSHADOW, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_3DLIGHT, 0xffe0e0e0,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INFOTEXT, 0xff000000,
- (uint) XplatUIWin32.GetSysColorIndex.COLOR_INFOBK, 0xffffffff,
-
- };
-
+ public override Version Version {
+ get {
+ return new Version(0, 1, 0, 0);
+ }
+ }
+
/* Hardcoded colour values not exposed in the API constants in all configurations */
- static readonly Color arrow_color = Color.Black;
- static readonly Color pen_ticks_color = Color.Black;
- static readonly Color progressbarblock_color = Color.FromArgb (255, 0, 0, 128);
- static StringFormat string_format_menu_text;
- static StringFormat string_format_menu_shortcut;
- static StringFormat string_format_menu_menubar_text;
+ protected static readonly Color arrow_color = Color.Black;
+ protected static readonly Color pen_ticks_color = Color.Black;
+ protected static readonly Color progressbarblock_color = Color.FromArgb (255, 0, 0, 128);
+ protected static StringFormat string_format_menu_text;
+ protected static StringFormat string_format_menu_shortcut;
+ protected static StringFormat string_format_menu_menubar_text;
static readonly Rectangle checkbox_rect = new Rectangle (2, 2, 11,11); // Position of the checkbox relative to the item
static ImageAttributes imagedisabled_attributes = null;
const int SEPARATOR_HEIGHT = 5;
#region Principal Theme Methods
public ThemeWin32Classic ()
{
- /* Init Default colour array*/
- syscolors = Array.CreateInstance (typeof (Color), (uint) XplatUIWin32.GetSysColorIndex.COLOR_MAXVALUE+1);
-
- for (int i = 0; i < theme_colors.Length; i +=2)
- syscolors.SetValue (Color.FromArgb ((int)theme_colors[i+1]), (int) theme_colors[i]);
-
- defaultWindowBackColor = SystemColors.Window;
- defaultWindowForeColor = ColorButtonText;
+ defaultWindowBackColor = this.ColorWindow;
+ defaultWindowForeColor = this.ColorControlText;
default_font = new Font (FontFamily.GenericSansSerif, 8.25f);
/* Menu string formats */
string_format_menu_menubar_text.LineAlignment = StringAlignment.Center;
string_format_menu_menubar_text.Alignment = StringAlignment.Center;
string_format_menu_menubar_text.HotkeyPrefix = HotkeyPrefix.Show;
+ always_draw_hotkeys = false;
}
public override void ResetDefaults() {
#region Internal Methods
protected SolidBrush GetControlBackBrush (Color c) {
if (c == DefaultControlBackColor)
- return ResPool.GetSolidBrush (ColorButtonFace);
- return new SolidBrush (c);
+ return ResPool.GetSolidBrush (ColorControl);
+ return ResPool.GetSolidBrush (c);
}
protected SolidBrush GetControlForeBrush (Color c) {
if (c == DefaultControlForeColor)
- return ResPool.GetSolidBrush (ColorButtonText);
- return new SolidBrush (c);
+ return ResPool.GetSolidBrush (ColorControlText);
+ return ResPool.GetSolidBrush (c);
}
#endregion // Internal Methods
#region ButtonBase
public override void DrawButtonBase(Graphics dc, Rectangle clip_area, ButtonBase button) {
- int width;
- int height;
+ // Draw the button: fill rectangle, draw border, etc.
+ ButtonBase_DrawButton(button, dc);
+
+ // First, draw the image
+ if ((button.image != null) || (button.image_list != null))
+ ButtonBase_DrawImage(button, dc);
+
+ // Draw the focus rectangle
+ if (button.has_focus)
+ ButtonBase_DrawFocus(button, dc);
+
+ // Now the text
+ if (button.text != null && button.text != String.Empty)
+ ButtonBase_DrawText(button, dc);
+ }
+
+ protected virtual void ButtonBase_DrawButton(ButtonBase button, Graphics dc)
+ {
Rectangle buttonRectangle;
Rectangle borderRectangle;
-
- width = button.ClientSize.Width;
- height = button.ClientSize.Height;
- dc.FillRectangle(ResPool.GetSolidBrush (button.BackColor), button.ClientRectangle);
+ dc.FillRectangle(ResPool.GetSolidBrush (button.BackColor), button.ClientRectangle);
// set up the button rectangle
buttonRectangle = button.ClientRectangle;
- if (button.has_focus) {
+ if (button.has_focus || button.paint_as_acceptbutton) {
// shrink the rectangle for the normal button drawing inside the focus rectangle
borderRectangle = Rectangle.Inflate(buttonRectangle, -1, -1);
} else {
if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
DrawFlatStyleButton (dc, borderRectangle, button);
} else {
- CPDrawButton(dc, borderRectangle, button.ButtonState);
- }
-
- // First, draw the image
- if ((button.image != null) || (button.image_list != null)) {
- // Need to draw a picture
- Image i;
- int image_x;
- int image_y;
- int image_width;
- int image_height;
-
- if (button.ImageIndex!=-1) { // We use ImageIndex instead of image_index since it will return -1 if image_list is null
- i = button.image_list.Images[button.image_index];
- } else {
- i = button.image;
+ CPDrawButton(dc, borderRectangle, button.ButtonState);
+ if (button.has_focus || button.paint_as_acceptbutton) {
+ dc.DrawRectangle(ResPool.GetPen(button.ForeColor), borderRectangle);
}
+ }
+ }
- image_width = button.image.Width;
- image_height = button.image.Height;
-
- switch(button.image_alignment) {
+ protected virtual void ButtonBase_DrawImage(ButtonBase button, Graphics dc)
+ {
+ // Need to draw a picture
+ Image i;
+ int image_x;
+ int image_y;
+ int image_width;
+ int image_height;
+
+ int width = button.ClientSize.Width;
+ int height = button.ClientSize.Height;
+
+ if (button.ImageIndex != -1) { // We use ImageIndex instead of image_index since it will return -1 if image_list is null
+ i = button.image_list.Images[button.image_index];
+ } else {
+ i = button.image;
+ }
+
+ image_width = button.image.Width;
+ image_height = button.image.Height;
+
+ switch (button.image_alignment) {
case ContentAlignment.TopLeft: {
image_x=0;
image_y=0;
break;
}
-
+
case ContentAlignment.TopCenter: {
image_x=(width-image_width)/2;
image_y=0;
break;
}
-
+
case ContentAlignment.TopRight: {
image_x=width-image_width;
image_y=0;
break;
}
-
+
case ContentAlignment.MiddleLeft: {
image_x=0;
image_y=(height-image_height)/2;
break;
}
-
+
case ContentAlignment.MiddleCenter: {
image_x=(width-image_width)/2;
image_y=(height-image_height)/2;
break;
}
-
+
case ContentAlignment.MiddleRight: {
image_x=width-image_width;
image_y=(height-image_height)/2;
break;
}
-
+
case ContentAlignment.BottomLeft: {
image_x=0;
image_y=height-image_height;
break;
}
-
+
case ContentAlignment.BottomCenter: {
image_x=(width-image_width)/2;
image_y=height-image_height;
break;
}
-
+
case ContentAlignment.BottomRight: {
image_x=width-image_width;
image_y=height-image_height;
break;
}
-
+
default: {
image_x=0;
image_y=0;
break;
}
- }
-
- if (button.is_pressed) {
- image_x+=1;
- image_y+=1;
- }
-
- if (button.is_enabled) {
- dc.DrawImage(i, image_x, image_y);
- } else {
- CPDrawImageDisabled(dc, i, image_x, image_y, ColorButtonFace);
- }
}
- // Draw the focus rectangle
- if (button.has_focus) {
- if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
- DrawFlatStyleFocusRectangle (dc, button.ClientRectangle, button, button.ForeColor, button.BackColor);
- } else {
- CPDrawFocusRectangle(dc, button.ClientRectangle, button.ForeColor, button.BackColor);
- }
+ if (button.is_pressed) {
+ image_x+=1;
+ image_y+=1;
}
- // Now the text
- if (button.text != null && button.text != String.Empty) {
- Rectangle text_rect = Rectangle.Inflate(buttonRectangle, -4, -4);
-
- if (button.is_pressed) {
- text_rect.X++;
- text_rect.Y++;
- }
-
- if (button.is_enabled) {
- dc.DrawString(button.text, button.Font, ResPool.GetSolidBrush (button.ForeColor), text_rect, button.text_format);
-
+ if (button.is_enabled) {
+ dc.DrawImage(i, image_x, image_y);
+ }
+ else {
+ CPDrawImageDisabled(dc, i, image_x, image_y, ColorControl);
+ }
+ }
+
+ protected virtual void ButtonBase_DrawFocus(ButtonBase button, Graphics dc)
+ {
+ if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
+ DrawFlatStyleFocusRectangle (dc, button.ClientRectangle, button, button.ForeColor, button.BackColor);
+ } else {
+ Rectangle rect = button.ClientRectangle;
+ rect.Inflate (-4, -4);
+ CPDrawFocusRectangle(dc, rect, button.ForeColor, button.BackColor);
+ }
+ }
+
+ protected virtual void ButtonBase_DrawText(ButtonBase button, Graphics dc)
+ {
+ Rectangle buttonRectangle = button.ClientRectangle;
+ Rectangle text_rect = Rectangle.Inflate(buttonRectangle, -4, -4);
+
+ if (button.is_pressed) {
+ text_rect.X++;
+ text_rect.Y++;
+ }
+
+ if (button.is_enabled) {
+ dc.DrawString(button.text, button.Font, ResPool.GetSolidBrush (button.ForeColor), text_rect, button.text_format);
+ } else {
+ if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
+ dc.DrawString(button.text, button.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorControl)), text_rect, button.text_format);
} else {
- if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
- dc.DrawString(button.text, button.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorButtonFace)), text_rect, button.text_format);
- } else {
- CPDrawStringDisabled(dc, button.text, button.Font, ColorButtonText, text_rect, button.text_format);
- }
+ CPDrawStringDisabled(dc, button.text, button.Font, ColorControlText, text_rect, button.text_format);
}
}
}
// else it must be a popup button
if (button.Capture && button.is_entered) {
- graphics.DrawRectangle(ResPool.GetPen (this.ColorButtonText), trace_rectangle);
+ graphics.DrawRectangle(ResPool.GetPen (this.ColorControlText), trace_rectangle);
} else {
// draw a 3d border
CPDrawBorder3D (graphics, rectangle, Border3DStyle.RaisedInner, Border3DSide.Left | Border3DSide.Top, button.BackColor);
- graphics.DrawLine ( ResPool.GetPen (this.ColorButtonText), trace_rectangle.X, trace_rectangle.Bottom, trace_rectangle.Right, trace_rectangle.Bottom);
- graphics.DrawLine ( ResPool.GetPen (this.ColorButtonText), trace_rectangle.Right, trace_rectangle.Y, trace_rectangle.Right, trace_rectangle.Bottom);
+ graphics.DrawLine ( ResPool.GetPen (this.ColorControlText), trace_rectangle.X, trace_rectangle.Bottom, trace_rectangle.Right, trace_rectangle.Bottom);
+ graphics.DrawLine ( ResPool.GetPen (this.ColorControlText), trace_rectangle.Right, trace_rectangle.Y, trace_rectangle.Right, trace_rectangle.Bottom);
}
}
} else {
// popup has a ButtonColorText forecolor, not a button.ForeCOlor
if (button.FlatStyle == FlatStyle.Popup) {
- rect_fore_color = this.ColorButtonText;
+ rect_fore_color = this.ColorControlText;
}
// fill then draw outer rect
(radiobutton != null && radiobutton.Checked)) {
if (button.FlatStyle == FlatStyle.Flat && button.is_entered && !button.Capture) {
// render the hover for flat flatstyle and cheked
- graphics.DrawRectangle(ResPool.GetPen (this.ColorButtonText), trace_rectangle);
+ graphics.DrawRectangle(ResPool.GetPen (this.ColorControlText), trace_rectangle);
} else if (!button.is_entered && !button.Capture) {
// render the checked state for popup when unhovered
CPDrawBorder3D (graphics, rectangle, Border3DStyle.SunkenInner, Border3DSide.Right | Border3DSide.Bottom, button.BackColor);
bool draw_popup_checked = false;
if (button.FlatStyle == FlatStyle.Popup) {
- rect_fore_color = this.ColorButtonText;
+ rect_fore_color = this.ColorControlText;
// see if we should draw a disabled checked popup button
draw_popup_checked = ((checkbox != null && checkbox.Checked) ||
Rectangle client_rectangle;
Rectangle text_rectangle;
Rectangle checkbox_rectangle;
- SolidBrush sb;
int checkmark_size=13;
int checkmark_space = 4;
// Start drawing
+ CheckBox_DrawCheckBox(dc, checkbox, state, checkbox_rectangle);
+
+ CheckBox_DrawText(checkbox, text_rectangle, dc, text_format);
+
+ CheckBox_DrawFocus(checkbox, dc, text_rectangle);
+
+ text_format.Dispose ();
+ }
+
+ protected virtual void CheckBox_DrawCheckBox( Graphics dc, CheckBox checkbox, ButtonState state, Rectangle checkbox_rectangle )
+ {
dc.FillRectangle (ResPool.GetSolidBrush (checkbox.BackColor), checkbox.ClientRectangle);
// render as per normal button
if (checkbox.appearance==Appearance.Button) {
ControlPaint.DrawCheckBox(dc, checkbox_rectangle, state);
}
}
+ }
+
+ protected virtual void CheckBox_DrawText( CheckBox checkbox, Rectangle text_rectangle, Graphics dc, StringFormat text_format )
+ {
+ SolidBrush sb;
// offset the text if it's pressed and a button
if (checkbox.Appearance == Appearance.Button) {
}
/* Place the text; to be compatible with Windows place it after the checkbox has been drawn */
+
+ // Windows seems to not wrap text in certain situations, this matches as close as I could get it
+ if ((float)(checkbox.Font.Height * 1.5f) > text_rectangle.Height) {
+ text_format.FormatFlags |= StringFormatFlags.NoWrap;
+ }
if (checkbox.Enabled) {
sb = ResPool.GetSolidBrush(checkbox.ForeColor);
- dc.DrawString(checkbox.Text, checkbox.Font, sb, text_rectangle, text_format);
+ dc.DrawString(checkbox.Text, checkbox.Font, sb, text_rectangle, text_format);
} else if (checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup) {
- dc.DrawString(checkbox.Text, checkbox.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorButtonFace)), text_rectangle, text_format);
+ dc.DrawString(checkbox.Text, checkbox.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorControl)), text_rectangle, text_format);
} else {
- CPDrawStringDisabled(dc, checkbox.Text, checkbox.Font, ColorButtonText, text_rectangle, text_format);
+ CPDrawStringDisabled(dc, checkbox.Text, checkbox.Font, ColorControlText, text_rectangle, text_format);
}
-
+ }
+
+ protected virtual void CheckBox_DrawFocus( CheckBox checkbox, Graphics dc, Rectangle text_rectangle )
+ {
if (checkbox.Focused) {
if (checkbox.FlatStyle != FlatStyle.Flat) {
DrawInnerFocusRectangle (dc, Rectangle.Inflate (text_rectangle, -1, -1), checkbox.BackColor);
}
// renders a checkBox with the Flat and Popup FlatStyle
- private void DrawFlatStyleCheckBox (Graphics graphics, Rectangle rectangle, CheckBox checkbox)
+ protected virtual void DrawFlatStyleCheckBox (Graphics graphics, Rectangle rectangle, CheckBox checkbox)
{
Pen pen;
Rectangle rect;
ControlPaint.DrawBorder(graphics, checkbox_rectangle, checkbox.ForeColor, ButtonBorderStyle.Solid);
} else {
// draw sunken effect
- CPDrawBorder3D (graphics, checkbox_rectangle, Border3DStyle.SunkenInner, Border3DSide.All, checkbox.BackColor);
+ CPDrawBorder3D (graphics, checkbox_rectangle, Border3DStyle.SunkenInner, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, checkbox.BackColor);
}
} else {
graphics.FillRectangle(ResPool.GetSolidBrush (ControlPaint.LightLight (checkbox.BackColor)), fill_rectangle);
}
// draw disabled state,
- ControlPaint.DrawBorder(graphics, checkbox_rectangle, ColorButtonShadow, ButtonBorderStyle.Solid);
+ ControlPaint.DrawBorder(graphics, checkbox_rectangle, ColorControlDark, ButtonBorderStyle.Solid);
}
/* Make sure we've got at least a line width of 1 */
/* Draw text*/
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
- back_color = ThemeEngine.Current.ColorHilight;
- fore_color = ThemeEngine.Current.ColorHilightText;
+ back_color = ColorHighlight;
+ fore_color = ColorHighlightText;
}
else {
back_color = e.BackColor;
fore_color = e.ForeColor;
}
- e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush
+ e.Graphics.FillRectangle (ResPool.GetSolidBrush
(back_color), item_rect);
e.Graphics.DrawString (ctrl.GetItemText (ctrl.Items[e.Index]), e.Font,
- ThemeEngine.Current.ResPool.GetSolidBrush (fore_color),
+ ResPool.GetSolidBrush (fore_color),
item_rect, string_format);
if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) {
- ThemeEngine.Current.CPDrawFocusRectangle (e.Graphics, item_rect,
+ CPDrawFocusRectangle (e.Graphics, item_rect,
fore_color, back_color);
}
}
public override void DrawComboBoxEditDecorations (Graphics dc, ComboBox ctrl, Rectangle cl)
{
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), cl.X, cl.Y, cl.X + cl.Width, cl.Y); //top
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), cl.X + 1, cl.Y + 1, cl.X + cl.Width - 2, cl.Y + 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonFace), cl.X, cl.Y + cl.Height - 2, cl.X + cl.Width, cl.Y + cl.Height - 2); //down
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), cl.X, cl.Y + cl.Height - 1, cl.X + cl.Width, cl.Y + cl.Height - 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), cl.X, cl.Y, cl.X, cl.Y + cl.Height); //left
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), cl.X + 1, cl.Y + 1, cl.X + 1, cl.Y + cl.Height - 2);
- dc.DrawLine (ResPool.GetPen (ColorButtonFace), cl.X + cl.Width - 2, cl.Y, cl.X + cl.Width - 2, cl.Y + cl.Height); //right
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), cl.X + cl.Width - 1, cl.Y + 1 , cl.X + cl.Width - 1, cl.Y + cl.Height - 1);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), cl.X, cl.Y, cl.X + cl.Width, cl.Y); //top
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), cl.X + 1, cl.Y + 1, cl.X + cl.Width - 2, cl.Y + 1);
+ dc.DrawLine (ResPool.GetPen (ColorControl), cl.X, cl.Y + cl.Height - 2, cl.X + cl.Width, cl.Y + cl.Height - 2); //down
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), cl.X, cl.Y + cl.Height - 1, cl.X + cl.Width, cl.Y + cl.Height - 1);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), cl.X, cl.Y, cl.X, cl.Y + cl.Height); //left
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), cl.X + 1, cl.Y + 1, cl.X + 1, cl.Y + cl.Height - 2);
+ dc.DrawLine (ResPool.GetPen (ColorControl), cl.X + cl.Width - 2, cl.Y, cl.X + cl.Width - 2, cl.Y + cl.Height); //right
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), cl.X + cl.Width - 1, cl.Y + 1 , cl.X + cl.Width - 1, cl.Y + cl.Height - 1);
}
// Sizing
DrawComboBoxEditDecorations (dc, ctrl, cl);
}
else {
- dc.DrawRectangle (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorWindowFrame),
+ dc.DrawRectangle (ResPool.GetPen (ColorWindowFrame),
cl.X, cl.Y, cl.Width - 1, cl.Height - 1);
}
}
string_format.FormatFlags = StringFormatFlags.LineLimit;
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
- back_color = ThemeEngine.Current.ColorHilight;
- fore_color = ThemeEngine.Current.ColorHilightText;
+ back_color = ColorHighlight;
+ fore_color = ColorHighlightText;
}
else {
back_color = e.BackColor;
fore_color = e.ForeColor;
}
- e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (back_color), e.Bounds);
+ e.Graphics.FillRectangle (ResPool.GetSolidBrush (back_color), e.Bounds);
if (e.Index != -1) {
e.Graphics.DrawString (ctrl.GetItemText (ctrl.Items[e.Index]), e.Font,
- ThemeEngine.Current.ResPool.GetSolidBrush (fore_color),
+ ResPool.GetSolidBrush (fore_color),
text_draw, string_format);
}
if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) {
- ThemeEngine.Current.CPDrawFocusRectangle (e.Graphics, e.Bounds, fore_color, back_color);
+ CPDrawFocusRectangle (e.Graphics, e.Bounds, fore_color, back_color);
}
+
+ string_format.Dispose ();
}
#endregion ComboBox
public override int DataGridMinimumColumnCheckBoxWidth { get { return 16;} }
public override Color DataGridAlternatingBackColor { get { return ColorWindow;} }
public override Color DataGridBackColor { get { return ColorWindow;} }
- public override Color DataGridBackgroundColor { get { return ColorAppWorkSpace;} }
- public override Color DataGridCaptionBackColor { get { return ColorActiveTitle;} }
- public override Color DataGridCaptionForeColor { get { return SystemColors.ActiveCaptionText;} }
- public override Color DataGridGridLineColor { get { return SystemColors.Control;} }
- public override Color DataGridHeaderBackColor { get { return SystemColors.Control;} }
- public override Color DataGridHeaderForeColor { get { return SystemColors.ControlText;} }
- public override Color DataGridLinkColor { get { return SystemColors.HotTrack;} }
- public override Color DataGridLinkHoverColor { get { return SystemColors.HotTrack;} }
- public override Color DataGridParentRowsBackColor { get { return SystemColors.Control;} }
- public override Color DataGridParentRowsForeColor { get { return SystemColors.WindowText;} }
- public override Color DataGridSelectionBackColor { get { return ColorActiveTitle;} }
- public override Color DataGridSelectionForeColor { get { return ColorTitleText;} }
+ public override Color DataGridBackgroundColor { get { return ColorAppWorkspace;} }
+ public override Color DataGridCaptionBackColor { get { return ColorActiveCaption;} }
+ public override Color DataGridCaptionForeColor { get { return ColorActiveCaptionText;} }
+ public override Color DataGridGridLineColor { get { return ColorControl;} }
+ public override Color DataGridHeaderBackColor { get { return ColorControl;} }
+ public override Color DataGridHeaderForeColor { get { return ColorControlText;} }
+ public override Color DataGridLinkColor { get { return ColorHotTrack;} }
+ public override Color DataGridLinkHoverColor { get { return ColorHotTrack;} }
+ public override Color DataGridParentRowsBackColor { get { return ColorControl;} }
+ public override Color DataGridParentRowsForeColor { get { return ColorWindowText;} }
+ public override Color DataGridSelectionBackColor { get { return ColorActiveCaption;} }
+ public override Color DataGridSelectionForeColor { get { return ColorActiveCaptionText;} }
public override void DataGridPaint (PaintEventArgs pe, DataGrid grid)
{
// Paint scrollBar corner
if (grid.vert_scrollbar.Visible && grid.horiz_scrollbar.Visible) {
- Rectangle corner = new Rectangle (grid.grid_drawing.client_area.X + grid.grid_drawing.client_area.Width - grid.horiz_scrollbar.Height,
- grid.grid_drawing.client_area.Y + grid.grid_drawing.client_area.Height - grid.horiz_scrollbar.Height,
+ Rectangle corner = new Rectangle (grid.ClientRectangle.X + grid.ClientRectangle.Width - grid.horiz_scrollbar.Height,
+ grid.ClientRectangle.Y + grid.ClientRectangle.Height - grid.horiz_scrollbar.Height,
grid.horiz_scrollbar.Height, grid.horiz_scrollbar.Height);
if (pe.ClipRectangle.IntersectsWith (corner)) {
corner);
}
}
-
- ThemeEngine.Current.CPDrawBorderStyle (pe.Graphics, grid.ClientRectangle, grid.border_style);
}
public override void DataGridPaintCaption (Graphics g, Rectangle clip, DataGrid grid)
modified_area);
g.DrawString (grid.CaptionText, grid.CaptionFont,
- ThemeEngine.Current.ResPool.GetSolidBrush (grid.CaptionForeColor),
+ ResPool.GetSolidBrush (grid.CaptionForeColor),
grid.grid_drawing.caption_area);
}
current_clip.Dispose ();
g.ResetClip ();
-
- // This fills with background colour the unused part in the row headers
- if (rect_columnhdr.X + rect_columnhdr.Height < grid.grid_drawing.client_area.X + grid.grid_drawing.client_area.Width) {
- Rectangle not_usedarea = columnshdrs_area_complete;
- not_usedarea.X = rect_columnhdr.X + rect_columnhdr.Width;
- not_usedarea.Width = grid.grid_drawing.client_area.X + grid.grid_drawing.client_area.Width - rect_columnhdr.X - rect_columnhdr.Height;
+ Rectangle not_usedarea = columnshdrs_area_complete;
+ not_usedarea.X = rect_columnhdr.X + rect_columnhdr.Width;
+ not_usedarea.Width = grid.ClientRectangle.X + grid.ClientRectangle.Width - rect_columnhdr.X - rect_columnhdr.Height;
+ g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), not_usedarea);
- g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor),
- not_usedarea);
- }
}
public override void DataGridPaintRowsHeaders (Graphics g, Rectangle clip, DataGrid grid)
Rectangle rowshdrs_area_complete = grid.grid_drawing.rowshdrs_area;
rowshdrs_area_complete.Height = grid.grid_drawing.rowshdrs_maxheight;
Rectangle rect_row = new Rectangle ();
- rect_row.X = grid.grid_drawing.rowshdrs_area.X;
- int last_y = 0;
+ rect_row.X = grid.grid_drawing.rowshdrs_area.X;
int rowcnt = grid.FirstVisibleRow + grid.VisibleRowCount;
+ Rectangle not_usedarea = rowshdrs_area_complete;
if (rowcnt < grid.RowsCount) { // Paint one row more for partial rows
rowcnt++;
rect_row.Y = grid.grid_drawing.rowshdrs_area.Y + ((row - grid.FirstVisibleRow) * grid.RowHeight);
if (clip.IntersectsWith (rect_row)) {
- DataGridPaintRowHeader (g, rect_row, row, grid);
- last_y = rect_row.Y;
+ DataGridPaintRowHeader (g, rect_row, row, grid);
}
}
g.ResetClip ();
-
- // This fills with background colour the unused part in the row headers
- if (last_y > 0 && rect_row.Y + rect_row.Height < grid.grid_drawing.cells_area.Y + grid.grid_drawing.cells_area.Height) {
- Rectangle not_usedarea = clip;
- not_usedarea.Intersect (rowshdrs_area_complete);
-
- not_usedarea.Y = rect_row.Y + rect_row.Height;
- not_usedarea.Height = rowshdrs_area_complete.Y + rowshdrs_area_complete.Height - rect_row.Height - rect_row.Y;
- g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor),
- not_usedarea);
- }
-
-
+ not_usedarea.Height = grid.grid_drawing.rowshdrs_maxheight - grid.grid_drawing.rowshdrs_area.Height;
+ not_usedarea.Y = grid.grid_drawing.rowshdrs_area.Y + grid.grid_drawing.rowshdrs_area.Height;
+ g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), not_usedarea);
}
public override void DataGridPaintRowHeaderArrow (Graphics g, Rectangle bounds, DataGrid grid)
arrow[1] = P2;
arrow[2] = P3;
- g.FillPolygon (ThemeEngine.Current.ResPool.GetSolidBrush
+ g.FillPolygon (ResPool.GetSolidBrush
(grid.CurrentTableStyle.CurrentHeaderForeColor), arrow, FillMode.Winding);
}
public override void DataGridPaintRowHeader (Graphics g, Rectangle bounds, int row, DataGrid grid)
{
// Background
- g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderBackColor),
+ g.FillRectangle (ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderBackColor),
bounds);
if (grid.FlatMode == false) {
// Paint Borders
- g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonHilight),
+ g.DrawLine (ResPool.GetPen (ColorControlLight),
bounds.X, bounds.Y, bounds.X + bounds.Width, bounds.Y);
- g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonHilight),
+ g.DrawLine (ResPool.GetPen (ColorControlLight),
bounds.X, bounds.Y + 1, bounds.X, bounds.Y + bounds.Height - 1);
- g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonShadow),
+ g.DrawLine (ResPool.GetPen (ColorControlDark),
bounds.X + bounds.Width - 1, bounds.Y + 1 , bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 1);
- g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonShadow),
+ g.DrawLine (ResPool.GetPen (ColorControlDark),
bounds.X, bounds.Y + bounds.Height -1, bounds.X + bounds.Width, bounds.Y + bounds.Height -1);
}
- if (grid.ShowEditRow && row == grid.RowsCount && !(row == grid.CurrentCell.RowNumber && grid.is_changing == true)) {
+ if (grid.ShowEditRow && grid.RowsCount > 0 && row == grid.RowsCount && !(row == grid.CurrentCell.RowNumber && grid.is_changing == true)) {
g.DrawString ("*", grid.grid_drawing.font_newrow, ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderForeColor),
bounds);
if (grid.is_changing == true) {
g.DrawString ("...", grid.Font,
- ThemeEngine.Current.ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderForeColor),
+ ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderForeColor),
bounds);
} else {
int rowcnt = grid.FirstVisibleRow + grid.VisibleRowCount;
- if (grid.ShowEditRow) {
+ if (grid.ShowEditRow && grid.RowsCount > 0) {
rowcnt--;
}
}
}
- if (grid.ShowEditRow && grid.FirstVisibleRow + grid.VisibleRowCount == grid.RowsCount + 1) {
+ if (grid.ShowEditRow && grid.RowsCount > 0 && grid.FirstVisibleRow + grid.VisibleRowCount == grid.RowsCount + 1) {
rect_row.Y = cells.Y + ((rowcnt - grid.FirstVisibleRow) * grid.RowHeight);
if (clip.IntersectsWith (rect_row)) {
DataGridPaintRow (g, rowcnt, rect_row, true, grid);
}
- }
-
+ }
+
not_usedarea.Height = cells.Y + cells.Height - rect_row.Y - rect_row.Height;
not_usedarea.Y = rect_row.Y + rect_row.Height;
not_usedarea.Width = rect_row.Width = cells.Width;
- not_usedarea.X = cells.X;
-
- g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (grid.BackgroundColor),
- not_usedarea);
+ not_usedarea.X = cells.X;
+
+ g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), not_usedarea);
}
public override void DataGridPaintRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, DataGrid grid)
if (is_newrow) {
grid.CurrentTableStyle.GridColumnStyles[column].PaintNewRow (g, rect_cell,
- ThemeEngine.Current.ResPool.GetSolidBrush (backcolor),
- ThemeEngine.Current.ResPool.GetSolidBrush (forecolor));
+ ResPool.GetSolidBrush (backcolor),
+ ResPool.GetSolidBrush (forecolor));
} else {
grid.CurrentTableStyle.GridColumnStyles[column].Paint (g, rect_cell, grid.ListManager, row,
- ThemeEngine.Current.ResPool.GetSolidBrush (backcolor),
- ThemeEngine.Current.ResPool.GetSolidBrush (forecolor),
+ ResPool.GetSolidBrush (backcolor),
+ ResPool.GetSolidBrush (forecolor),
grid.RightToLeft == RightToLeft.Yes);
}
not_usedarea.Width = row_rect.X + row_rect.Width - rect_cell.X - rect_cell.Width;
not_usedarea.Y = row_rect.Y;
not_usedarea.Height = row_rect.Height;
- g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (grid.BackgroundColor),
+ g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor),
not_usedarea);
}
}
if (!dtp.ShowUpDown && clip_rectangle.IntersectsWith (dtp.ClientRectangle)) {
// draw the outer border
Rectangle button_bounds = dtp.ClientRectangle;
- this.CPDrawBorder3D (dc, button_bounds, Border3DStyle.Sunken, Border3DSide.All, dtp.BackColor);
+ this.CPDrawBorder3D (dc, button_bounds, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, dtp.BackColor);
// deflate by the border width
if (clip_rectangle.IntersectsWith (dtp.drop_down_arrow_rect)) {
// render the date part
if (clip_rectangle.IntersectsWith (dtp.date_area_rect)) {
// fill the background
- dc.FillRectangle (ResPool.GetSolidBrush (ThemeEngine.Current.ColorWindow), dtp.date_area_rect);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorWindow), dtp.date_area_rect);
// fill the currently highlighted area
if (dtp.hilight_date_area != Rectangle.Empty) {
- dc.FillRectangle (ResPool.GetSolidBrush (ThemeEngine.Current.ColorHilight), dtp.hilight_date_area);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorHighlight), dtp.hilight_date_area);
}
// draw the text part
text_format.LineAlignment = StringAlignment.Center;
text_format.Alignment = StringAlignment.Near;
dc.DrawString (dtp.Text, dtp.Font, ResPool.GetSolidBrush (dtp.ForeColor), Rectangle.Inflate(dtp.date_area_rect, -1, -1), text_format);
+ text_format.Dispose ();
}
}
/* Text */
if (box.Enabled) {
- dc.DrawString (box.Text, box.Font, new SolidBrush (box.ForeColor), 10, 0, text_format);
+ dc.DrawString (box.Text, box.Font, ResPool.GetSolidBrush (box.ForeColor), 10, 0, text_format);
} else {
CPDrawStringDisabled (dc, box.Text, box.Font, box.ForeColor,
new RectangleF (10, 0, width, box.Font.Height), text_format);
}
-
+ text_format.Dispose ();
}
public override Size GroupBoxDefaultSize {
public override void DrawLabel (Graphics dc, Rectangle clip_rectangle, Label label)
{
dc.FillRectangle (ResPool.GetSolidBrush (label.BackColor), clip_rectangle);
-
- CPDrawBorderStyle (dc, label.ClientRectangle, label.BorderStyle);
if (label.Enabled) {
dc.DrawString (label.Text, label.Font, ResPool.GetSolidBrush (label.ForeColor), clip_rectangle, label.string_format);
return new Size (100, 23);
}
}
- #endregion // Label\r
-\r
- #region LinkLabel\r
- public override void DrawLinkLabel (Graphics dc, Rectangle clip_rectangle, LinkLabel label)\r
- {\r
- Color color;\r
-\r
- dc.FillRectangle (ResPool.GetSolidBrush (label.BackColor), clip_rectangle);\r
- CPDrawBorderStyle (dc, label.ClientRectangle, label.BorderStyle);
-\r
+ #endregion // Label
+
+ #region LinkLabel
+ public override void DrawLinkLabel (Graphics dc, Rectangle clip_rectangle, LinkLabel label)
+ {
+ Color color;
+
+ dc.FillRectangle (ResPool.GetSolidBrush (label.BackColor), clip_rectangle);
+
for (int i = 0; i < label.num_pieces; i++) {
if (clip_rectangle.IntersectsWith (label.pieces[i].rect) == false) {
continue;
}
- \r
- color = label.GetLinkColor (label.pieces[i], i);\r
-\r
- if (label.pieces[i].link == null)\r
- dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (Color.Black),\r
- label.pieces[i].rect.X, label.pieces[i].rect.Y);\r
- else\r
- dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (color),\r
+
+ color = label.GetLinkColor (label.pieces[i], i);
+
+ if (label.pieces[i].link == null)
+ dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (Color.Black),
label.pieces[i].rect.X, label.pieces[i].rect.Y);
-
+ else
+ dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (color),
+ label.pieces[i].rect.X, label.pieces[i].rect.Y);
+
if (label.pieces[i].focused) {
CPDrawFocusRectangle (dc, label.pieces[i].rect, label.ForeColor, label.BackColor);
- }\r
+ }
}
- \r
- }\r
- #endregion // LinkLabel\r
+
+ }
+ #endregion // LinkLabel
#region ListBox
// Drawing
- public override void DrawListBoxDecorations (Graphics dc, ListBox ctrl)
- {
- Rectangle cl = ctrl.LBoxInfo.client_rect;
-
- // Draw decorations
- switch (ctrl.BorderStyle) {
- case BorderStyle.Fixed3D: {
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), cl.X, cl.Y, cl.X + cl.Width, cl.Y); //top
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), cl.X + 1, cl.Y + 1, cl.X + cl.Width - 2, cl.Y + 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonFace), cl.X, cl.Y + cl.Height - 2, cl.X + cl.Width, cl.Y + cl.Height - 2); //down
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), cl.X, cl.Y + cl.Height - 1, cl.X + cl.Width, cl.Y + cl.Height - 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), cl.X, cl.Y, cl.X, cl.Y + cl.Height); //left
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), cl.X + 1, cl.Y + 1, cl.X + 1, cl.Y + cl.Height - 2);
- dc.DrawLine (ResPool.GetPen (ColorButtonFace), cl.X + cl.Width - 2, cl.Y, cl.X + cl.Width - 2, cl.Y + cl.Height); //right
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), cl.X + cl.Width - 1, cl.Y + 1 , cl.X + cl.Width - 1, cl.Y + cl.Height - 1);
- break;
- }
- case BorderStyle.FixedSingle:
- dc.DrawRectangle (ResPool.GetPen (ColorWindowFrame), cl.X, cl.Y, cl.Width - 1, cl.Height - 1);
- break;
- case BorderStyle.None:
- default:
- break;
- }
- }
private int DrawListBoxDecorationSize (BorderStyle border_style)
{
}
// Sizing
- public override int DrawListBoxDecorationTop (BorderStyle border_style) { return DrawListBoxDecorationSize (border_style);}
- public override int DrawListBoxDecorationBottom (BorderStyle border_style) { return DrawListBoxDecorationSize (border_style);}
- public override int DrawListBoxDecorationRight (BorderStyle border_style) { return DrawListBoxDecorationSize (border_style);}
- public override int DrawListBoxDecorationLeft (BorderStyle border_style) { return DrawListBoxDecorationSize (border_style);}
-
public override void DrawListBoxItem (ListBox ctrl, DrawItemEventArgs e)
{
Color back_color, fore_color;
StringFormat string_format = ctrl.GetFormatString ();
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
- back_color = ThemeEngine.Current.ColorHilight;
- fore_color = ThemeEngine.Current.ColorHilightText;
+ back_color = ColorHighlight;
+ fore_color = ColorHighlightText;
}
else {
back_color = e.BackColor;
fore_color = e.ForeColor;
}
- e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush
+ e.Graphics.FillRectangle (ResPool.GetSolidBrush
(back_color), e.Bounds);
e.Graphics.DrawString (ctrl.GetItemText (ctrl.Items[e.Index]), e.Font,
- ThemeEngine.Current.ResPool.GetSolidBrush (fore_color),
+ ResPool.GetSolidBrush (fore_color),
e.Bounds.X, e.Bounds.Y, string_format);
if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) {
- ThemeEngine.Current.CPDrawFocusRectangle (e.Graphics, e.Bounds,
+ CPDrawFocusRectangle (e.Graphics, e.Bounds,
fore_color, back_color);
}
}
#region ListView
// Drawing
- public override void DrawListView (Graphics dc, Rectangle clip, ListView control)
+ public override void DrawListViewItems (Graphics dc, Rectangle clip, ListView control)
{
- bool details = (control.View == View.Details);
-
- dc.FillRectangle (ResPool.GetSolidBrush (control.BackColor), clip);
-
- // border is drawn directly in the Paint method
- if (details && control.HeaderStyle != ColumnHeaderStyle.None) {
- dc.FillRectangle (ResPool.GetSolidBrush (SystemColors.Control),
- 0, 0, control.TotalWidth, control.Font.Height + 5);
- if (control.Columns.Count > 0) {
- if (control.HeaderStyle == ColumnHeaderStyle.Clickable) {
- foreach (ColumnHeader col in control.Columns) {
- this.CPDrawButton (dc, col.Rect,
- (col.Pressed ?
- ButtonState.Pushed :
- ButtonState.Normal));
- dc.DrawString (col.Text, ThemeEngine.Current.DefaultFont,
- ResPool.GetSolidBrush
- (this.ColorButtonText),
- //col.Rect,
- col.Rect.X + 3,
- col.Rect.Y + col.Rect.Height/2 + 1,
- col.Format);
- }
- }
- // Non-clickable columns
- else {
- foreach (ColumnHeader col in control.Columns) {
- this.CPDrawButton (dc, col.Rect, ButtonState.Flat);
- dc.DrawString (col.Text, ThemeEngine.Current.DefaultFont,
- ResPool.GetSolidBrush
- (this.ColorButtonText),
- //col.Rect,
- col.Rect.X + 3,
- col.Rect.Y + col.Rect.Height/2 + 1,
- col.Format);
- }
- }
- }
- }
+ bool details = control.View == View.Details;
- // In case of details view draw the items only if
- // columns are non-zero
- if (!details || control.Columns.Count > 0)
- foreach (ListViewItem item in control.Items) {
- if (clip.IntersectsWith (item.EntireRect))
- DrawListViewItem (dc, control, item);
- }
+ dc.FillRectangle (ResPool.GetSolidBrush (control.BackColor), clip);
+ int first = control.FirstVisibleIndex;
+ for (int i = first; i <= control.LastVisibleIndex; i ++) {
+ if (clip.IntersectsWith (control.Items[i].GetBounds (ItemBoundsPortion.Entire)))
+ DrawListViewItem (dc, control, control.Items [i]);
+ }
+
// draw the gridlines
if (details && control.GridLines) {
int top = (control.HeaderStyle == ColumnHeaderStyle.None) ?
// draw vertical gridlines
foreach (ColumnHeader col in control.Columns)
- dc.DrawLine (this.ResPool.GetPen (this.ColorButtonFace),
+ dc.DrawLine (this.ResPool.GetPen (this.ColorControl),
col.Rect.Right, top,
col.Rect.Right, control.TotalHeight);
// draw horizontal gridlines
ListViewItem last_item = null;
foreach (ListViewItem item in control.Items) {
- dc.DrawLine (this.ResPool.GetPen (this.ColorButtonFace),
- item.EntireRect.Left, item.EntireRect.Top,
- control.TotalWidth, item.EntireRect.Top);
+ dc.DrawLine (this.ResPool.GetPen (this.ColorControl),
+ item.GetBounds (ItemBoundsPortion.Entire).Left, item.GetBounds (ItemBoundsPortion.Entire).Top,
+ control.TotalWidth, item.GetBounds (ItemBoundsPortion.Entire).Top);
last_item = item;
}
// draw a line after at the bottom of the last item
if (last_item != null) {
- dc.DrawLine (this.ResPool.GetPen (this.ColorButtonFace),
- last_item.EntireRect.Left,
- last_item.EntireRect.Bottom,
+ dc.DrawLine (this.ResPool.GetPen (this.ColorControl),
+ last_item.GetBounds (ItemBoundsPortion.Entire).Left,
+ last_item.GetBounds (ItemBoundsPortion.Entire).Bottom,
control.TotalWidth,
- last_item.EntireRect.Bottom);
+ last_item.GetBounds (ItemBoundsPortion.Entire).Bottom);
+ }
+ }
+
+ dc.ResetClip ();
+
+ // Draw corner between the two scrollbars
+ if (control.h_scroll.Visible == true && control.h_scroll.Visible == true) {
+ Rectangle rect = new Rectangle ();
+ rect.X = control.h_scroll.Location.X + control.h_scroll.Width;
+ rect.Width = control.v_scroll.Width;
+ rect.Y = control.v_scroll.Location.Y + control.v_scroll.Height;
+ rect.Height = control.h_scroll.Height;
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), rect);
+ }
+
+ }
+
+ public override void DrawListViewHeader (Graphics dc, Rectangle clip, ListView control)
+ {
+ bool details = (control.View == View.Details);
+
+ // border is drawn directly in the Paint method
+ if (details && control.HeaderStyle != ColumnHeaderStyle.None) {
+ dc.FillRectangle (ResPool.GetSolidBrush (control.BackColor),
+ 0, 0, control.TotalWidth, control.Font.Height + 5);
+ if (control.Columns.Count > 0) {
+ foreach (ColumnHeader col in control.Columns) {
+ Rectangle rect = col.Rect;
+ rect.X -= control.h_marker;
+ ButtonState state;
+ if (control.HeaderStyle == ColumnHeaderStyle.Clickable)
+ state = col.Pressed ? ButtonState.Pushed : ButtonState.Normal;
+ else
+ state = ButtonState.Flat;
+ this.CPDrawButton (dc, rect, state);
+ rect.X += 3;
+ rect.Width -= 8;
+ if (rect.Width <= 0)
+ continue;
+ dc.DrawString (col.Text, DefaultFont,
+ ResPool.GetSolidBrush (ColorControlText),
+ rect, col.Format);
+ }
}
}
}
- // draws the ListViewItem of the given index
- private void DrawListViewItem (Graphics dc, ListView control, ListViewItem item)
+ public override void DrawListViewHeaderDragDetails (Graphics dc, ListView view, ColumnHeader col, int target_x)
{
+ Rectangle rect = col.Rect;
+ rect.X -= view.h_marker;
+ Color color = Color.FromArgb (0x7f, ColorControlDark.R, ColorControlDark.G, ColorControlDark.B);
+ dc.FillRectangle (ResPool.GetSolidBrush (color), rect);
+ rect.X += 3;
+ rect.Width -= 8;
+ if (rect.Width <= 0)
+ return;
+ color = Color.FromArgb (0x7f, ColorControlText.R, ColorControlText.G, ColorControlText.B);
+ dc.DrawString (col.Text, DefaultFont, ResPool.GetSolidBrush (color), rect, col.Format);
+ Pen pen = new Pen (ColorHighlight, 2);
+ dc.DrawLine (pen, target_x, 0, target_x, col.Rect.Height);
+ }
+
+ // draws the ListViewItem of the given index
+ protected virtual void DrawListViewItem (Graphics dc, ListView control, ListViewItem item)
+ {
+ int col_offset;
+ if (control.View == View.Details && control.Columns.Count > 0)
+ col_offset = control.Columns [0].Rect.X;
+ else
+ col_offset = 0;
+
+ Rectangle rect_checkrect = item.CheckRectReal;
+ rect_checkrect.X += col_offset;
+ Rectangle rect_iconrect = item.GetBounds (ItemBoundsPortion.Icon);
+ rect_iconrect.X += col_offset;
+ Rectangle full_rect = item.GetBounds (ItemBoundsPortion.Entire);
+ full_rect.X += col_offset;
+ Rectangle text_rect = item.GetBounds (ItemBoundsPortion.Label);
+ text_rect.X += col_offset;
+
if (control.CheckBoxes) {
if (control.StateImageList == null) {
// Make sure we've got at least a line width of 1
- int check_wd = Math.Max (3, item.CheckRect.Width / 6);
- int scale = Math.Max (1, item.CheckRect.Width / 12);
+ int check_wd = Math.Max (3, rect_checkrect.Width / 6);
+ int scale = Math.Max (1, rect_checkrect.Width / 12);
// set the checkbox background
dc.FillRectangle (this.ResPool.GetSolidBrush (this.ColorWindow),
- item.CheckRect);
+ rect_checkrect);
// define a rectangle inside the border area
- Rectangle rect = new Rectangle (item.CheckRect.X + 2,
- item.CheckRect.Y + 2,
- item.CheckRect.Width - 4,
- item.CheckRect.Height - 4);
+ Rectangle rect = new Rectangle (rect_checkrect.X + 2,
+ rect_checkrect.Y + 2,
+ rect_checkrect.Width - 4,
+ rect_checkrect.Height - 4);
Pen pen = new Pen (this.ColorWindowText, 2);
dc.DrawRectangle (pen, rect);
else {
if (item.Checked && control.StateImageList.Images.Count > 1)
control.StateImageList.Draw (dc,
- item.CheckRect.Location, 1);
+ rect_checkrect.Location, 1);
else if (! item.Checked && control.StateImageList.Images.Count > 0)
control.StateImageList.Draw (dc,
- item.CheckRect.Location, 0);
+ rect_checkrect.Location, 0);
}
}
if (item.ImageIndex > -1 &&
control.LargeImageList != null &&
item.ImageIndex < control.LargeImageList.Images.Count)
- control.LargeImageList.Draw (dc, item.IconRect.Location,
+ control.LargeImageList.Draw (dc, rect_iconrect.Location,
item.ImageIndex);
}
else {
if (item.ImageIndex > -1 &&
control.SmallImageList != null &&
item.ImageIndex < control.SmallImageList.Images.Count)
- control.SmallImageList.Draw (dc, item.IconRect.Location,
+ control.SmallImageList.Draw (dc, rect_iconrect.Location,
item.ImageIndex);
}
- // draw the item text
- Rectangle text_rect = item.LabelRect;
+ // draw the item text
// format for the item text
StringFormat format = new StringFormat ();
- format.LineAlignment = StringAlignment.Center;
+ if (control.View == View.SmallIcon)
+ format.LineAlignment = StringAlignment.Near;
+ else
+ format.LineAlignment = StringAlignment.Center;
if (control.View == View.LargeIcon)
format.Alignment = StringAlignment.Center;
else
if (item.Selected) {
if (control.View == View.Details) {
if (control.FullRowSelect) {
- // fill the entire rect excluding the checkbox
- Rectangle full_rect = item.EntireRect;
- full_rect.Location = item.LabelRect.Location;
+ // fill the entire rect excluding the checkbox
+ full_rect.Location = item.GetBounds (ItemBoundsPortion.Label).Location;
dc.FillRectangle (this.ResPool.GetSolidBrush
- (this.ColorHilight), full_rect);
+ (this.ColorHighlight), full_rect);
}
else {
Size text_size = Size.Ceiling (dc.MeasureString (item.Text,
item.Font));
text_rect.Width = text_size.Width;
dc.FillRectangle (this.ResPool.GetSolidBrush
- (this.ColorHilight), text_rect);
+ (this.ColorHighlight), text_rect);
}
}
else {
Point loc = text_rect.Location;
loc.X += (text_rect.Width - text_size.Width) / 2;
text_rect.Width = text_size.Width;*/
- dc.FillRectangle (this.ResPool.GetSolidBrush (this.ColorHilight),
+ dc.FillRectangle (this.ResPool.GetSolidBrush (this.ColorHighlight),
text_rect);
}
}
if (item.Text != null && item.Text.Length > 0) {
if (item.Selected)
dc.DrawString (item.Text, item.Font, this.ResPool.GetSolidBrush
- (this.ColorHilightText), text_rect, format);
+ (this.ColorHighlightText), text_rect, format);
else
dc.DrawString (item.Text, item.Font, this.ResPool.GetSolidBrush
(item.ForeColor), text_rect, format);
if (count > 0) {
ColumnHeader col;
ListViewItem.ListViewSubItem subItem;
- Rectangle sub_item_rect = item.LabelRect;
+ Rectangle sub_item_rect = text_rect;
// set the format for subitems
format.FormatFlags = StringFormatFlags.NoWrap;
- format.Alignment = StringAlignment.Near;
// 0th subitem is the item already drawn
for (int index = 1; index < count; index++) {
subItem = subItems [index];
col = control.Columns [index];
- sub_item_rect.X = col.Rect.Left;
- sub_item_rect.Width = col.Wd;
+ format.Alignment = col.Format.Alignment;
+ sub_item_rect.X = col.Rect.Left + 3;
+ sub_item_rect.Width = col.Wd - 6;
+ sub_item_rect.X -= control.h_marker;
SolidBrush sub_item_back_br = null;
SolidBrush sub_item_fore_br = null;
if (subItem.Text != null && subItem.Text.Length > 0)
dc.DrawString (subItem.Text, sub_item_font,
this.ResPool.GetSolidBrush
- (this.ColorHilightText),
+ (this.ColorHighlightText),
sub_item_rect, format);
}
else {
}
}
}
+
+ if (item.Focused) {
+ if (item.Selected)
+ CPDrawFocusRectangle (dc, text_rect, ColorHighlightText, ColorHighlight);
+ else
+ CPDrawFocusRectangle (dc, text_rect, control.ForeColor, control.BackColor);
+ }
+
+ format.Dispose ();
}
// Sizing
#endregion // ListView
#region Menus
- public override void CalcItemSize (Graphics dc, MenuAPI.MENUITEM item, int y, int x, bool menuBar)
+ public override void CalcItemSize (Graphics dc, MenuItem item, int y, int x, bool menuBar)
{
- item.rect.Y = y;
- item.rect.X = x;
+ item.X = x;
+ item.Y = y;
- if (item.item.Visible == false)
+ if (item.Visible == false) {
+ item.Width = 0;
+ item.Height = 0;
return;
+ }
- if (item.item.Separator == true) {
- item.rect.Height = SEPARATOR_HEIGHT / 2;
- item.rect.Width = -1;
+ if (item.Separator == true) {
+ item.Height = SEPARATOR_HEIGHT / 2;
+ item.Width = -1;
return;
}
- if (item.item.MeasureEventDefined) {
- MeasureItemEventArgs mi = new MeasureItemEventArgs (dc, item.pos);
- item.item.PerformMeasureItem (mi);
- item.rect.Height = mi.ItemHeight;
- item.rect.Width = mi.ItemWidth;
+ if (item.MeasureEventDefined) {
+ MeasureItemEventArgs mi = new MeasureItemEventArgs (dc, item.Index);
+ item.PerformMeasureItem (mi);
+ item.Height = mi.ItemHeight;
+ item.Width = mi.ItemWidth;
return;
} else {
-
SizeF size;
- size = dc.MeasureString (item.item.Text, ThemeEngine.Current.MenuFont);
- item.rect.Width = (int) size.Width;
- item.rect.Height = (int) size.Height;
+ size = dc.MeasureString (item.Text, MenuFont);
+ item.Width = (int) size.Width;
+ item.Height = (int) size.Height;
if (!menuBar) {
-
- if (item.item.Shortcut != Shortcut.None && item.item.ShowShortcut) {
- item.item.XTab = ThemeEngine.Current.MenuCheckSize.Width + MENU_TAB_SPACE + (int) size.Width;
- size = dc.MeasureString (" " + item.item.GetShortCutText (), ThemeEngine.Current.MenuFont);
- item.rect.Width += MENU_TAB_SPACE + (int) size.Width;
+ if (item.Shortcut != Shortcut.None && item.ShowShortcut) {
+ item.XTab = MenuCheckSize.Width + MENU_TAB_SPACE + (int) size.Width;
+ size = dc.MeasureString (" " + item.GetShortCutText (), MenuFont);
+ item.Width += MENU_TAB_SPACE + (int) size.Width;
}
- item.rect.Width += 4 + (ThemeEngine.Current.MenuCheckSize.Width * 2);
- }
- else {
- item.rect.Width += MENU_BAR_ITEMS_SPACE;
- x += item.rect.Width;
+ item.Width += 4 + (MenuCheckSize.Width * 2);
+ } else {
+ item.Width += MENU_BAR_ITEMS_SPACE;
+ x += item.Width;
}
- if (item.rect.Height < ThemeEngine.Current.MenuHeight)
- item.rect.Height = ThemeEngine.Current.MenuHeight;
- }
+ if (item.Height < MenuHeight)
+ item.Height = MenuHeight;
+ }
}
// Updates the menu rect and returns the height
- public override int CalcMenuBarSize (Graphics dc, IntPtr hMenu, int width)
+ public override int CalcMenuBarSize (Graphics dc, Menu menu, int width)
{
int x = 0;
- int i = 0;
int y = 0;
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID (hMenu);
menu.Height = 0;
- MenuAPI.MENUITEM item;
- while (i < menu.items.Count) {
+ foreach (MenuItem item in menu.MenuItems) {
- item = (MenuAPI.MENUITEM) menu.items[i];
CalcItemSize (dc, item, y, x, true);
- i = i + 1;
- if (x + item.rect.Width > width) {
- item.rect.X = 0;
- y += item.rect.Height;
- item.rect.Y = y;
+ if (x + item.Width > width) {
+ item.X = 0;
+ y += item.Height;
+ item.Y = y;
x = 0;
}
- x += item.rect.Width;
- item.item.MenuBar = true;
+ x += item.Width;
+ item.MenuBar = true;
- if (y + item.rect.Height > menu.Height)
- menu.Height = item.rect.Height + y;
+ if (y + item.Height > menu.Height)
+ menu.Height = item.Height + y;
}
menu.Width = width;
return menu.Height;
}
-
- public override void CalcPopupMenuSize (Graphics dc, IntPtr hMenu)
+ public override void CalcPopupMenuSize (Graphics dc, Menu menu)
{
int x = 3;
int start = 0;
int i, n, y, max;
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID (hMenu);
menu.Height = 0;
- while (start < menu.items.Count) {
+ while (start < menu.MenuItems.Count) {
y = 2;
max = 0;
- for (i = start; i < menu.items.Count; i++) {
- MenuAPI.MENUITEM item = (MenuAPI.MENUITEM) menu.items[i];
+ for (i = start; i < menu.MenuItems.Count; i++) {
+ MenuItem item = menu.MenuItems [i];
- if ((i != start) && (item.item.Break || item.item.BarBreak))
+ if ((i != start) && (item.Break || item.BarBreak))
break;
CalcItemSize (dc, item, y, x, false);
- y += item.rect.Height;
+ y += item.Height;
- if (item.rect.Width > max)
- max = item.rect.Width;
+ if (item.Width > max)
+ max = item.Width;
}
- // Reemplace the -1 by the menu width (separators)
- for (n = start; n < i; n++, start++) {
- MenuAPI.MENUITEM item = (MenuAPI.MENUITEM) menu.items[n];
- item.rect.Width = max;
- }
+ // Replace the -1 by the menu width (separators)
+ for (n = start; n < i; n++, start++)
+ menu.MenuItems [n].Width = max;
if (y > menu.Height)
menu.Height = y;
}
// Draws a menu bar in a window
- public override void DrawMenuBar (Graphics dc, IntPtr hMenu, Rectangle rect)
+ public override void DrawMenuBar (Graphics dc, Menu menu, Rectangle rect)
{
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID (hMenu);
- Rectangle item_rect;
-
if (menu.Height == 0)
- ThemeEngine.Current.CalcMenuBarSize (dc, hMenu, rect.Width);
+ CalcMenuBarSize (dc, menu, rect.Width);
+ bool keynav = (menu as MainMenu).tracker.Navigating;
+ HotkeyPrefix hp = always_draw_hotkeys || keynav ? HotkeyPrefix.Show : HotkeyPrefix.Hide;
+ string_format_menu_menubar_text.HotkeyPrefix = hp;
+ string_format_menu_text.HotkeyPrefix = hp;
+
rect.Height = menu.Height;
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (menu.Wnd.BackColor), rect);
+ dc.FillRectangle (ResPool.GetSolidBrush(ColorMenu), rect);
- for (int i = 0; i < menu.items.Count; i++) {
- MenuAPI.MENUITEM it = (MenuAPI.MENUITEM) menu.items[i];
- item_rect = it.rect;
+ for (int i = 0; i < menu.MenuItems.Count; i++) {
+ MenuItem item = menu.MenuItems [i];
+ Rectangle item_rect = item.bounds;
item_rect.X += rect.X;
item_rect.Y += rect.Y;
- it.item.MenuHeight = menu.Height;
- it.item.PerformDrawItem (new DrawItemEventArgs (dc, ThemeEngine.Current.MenuFont,
- item_rect, i, it.item.Status));
-
+ item.MenuHeight = menu.Height;
+ item.PerformDrawItem (new DrawItemEventArgs (dc, MenuFont, item_rect, i, item.Status));
}
}
if (item.Visible == false)
return;
- if (item.MenuBar) {
+ if (item.MenuBar)
string_format = string_format_menu_menubar_text;
- }
- else {
+ else
string_format = string_format_menu_text;
- }
if (item.Separator == true) {
- e.Graphics.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonShadow),
+ e.Graphics.DrawLine (ResPool.GetPen (ColorControlDark),
e.Bounds.X, e.Bounds.Y, e.Bounds.X + e.Bounds.Width, e.Bounds.Y);
- e.Graphics.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonHilight),
+ e.Graphics.DrawLine (ResPool.GetPen (ColorControlLight),
e.Bounds.X, e.Bounds.Y + 1, e.Bounds.X + e.Bounds.Width, e.Bounds.Y + 1);
return;
}
if (!item.MenuBar)
- rect_text.X += ThemeEngine.Current.MenuCheckSize.Width;
+ rect_text.X += MenuCheckSize.Width;
if (item.BarBreak) { /* Draw vertical break bar*/
Rectangle rect = e.Bounds;
rect.Width = 3;
rect.Height = item.MenuHeight - 6;
- e.Graphics.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonShadow),
+ e.Graphics.DrawLine (ResPool.GetPen (ColorControlDark),
rect.X, rect.Y , rect.X, rect.Y + rect.Height);
- e.Graphics.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonHilight),
+ e.Graphics.DrawLine (ResPool.GetPen (ColorControlLight),
rect.X + 1, rect.Y , rect.X +1, rect.Y + rect.Height);
}
Color color_back;
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
- color_text = ThemeEngine.Current.ColorHilightText;
- color_back = ThemeEngine.Current.ColorHilight;
- }
- else {
- color_text = ThemeEngine.Current.ColorMenuText;
- color_back = ThemeEngine.Current.ColorMenu;
+ color_text = ColorHighlightText;
+ color_back = ColorHighlight;
+ } else {
+ color_text = ColorMenuText;
+ color_back = ColorMenu;
}
/* Draw background */
Rectangle rect_back = e.Bounds;
rect_back.X++;
rect_back.Width -=2;
- e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (color_back), rect_back);
+ e.Graphics.FillRectangle (ResPool.GetSolidBrush (color_back), rect_back);
if (item.Enabled) {
e.Graphics.DrawString (item.Text, e.Font,
- ThemeEngine.Current.ResPool.GetSolidBrush (color_text),
+ ResPool.GetSolidBrush (color_text),
rect_text, string_format);
if (!item.MenuBar && item.Shortcut != Shortcut.None && item.ShowShortcut) {
rect.X = item.XTab;
rect.Width -= item.XTab;
- e.Graphics.DrawString (str, e.Font, ThemeEngine.Current.ResPool.GetSolidBrush (color_text),
+ e.Graphics.DrawString (str, e.Font, ResPool.GetSolidBrush (color_text),
rect, string_format_menu_shortcut);
}
- }
- else {
+ } else {
ControlPaint.DrawStringDisabled (e.Graphics, item.Text, e.Font,
Color.Black, rect_text, string_format);
}
/* Draw arrow */
- if (item.MenuBar == false && item.IsPopup) {
+ if (item.MenuBar == false && item.IsPopup || item.MdiList) {
- int cx = ThemeEngine.Current.MenuCheckSize.Width;
- int cy = ThemeEngine.Current.MenuCheckSize.Height;
+ int cx = MenuCheckSize.Width;
+ int cy = MenuCheckSize.Height;
Bitmap bmp = new Bitmap (cx, cy);
Graphics gr = Graphics.FromImage (bmp);
Rectangle rect_arrow = new Rectangle (0, 0, cx, cy);
if (item.MenuBar == false && item.Checked) {
Rectangle area = e.Bounds;
- int cx = ThemeEngine.Current.MenuCheckSize.Width;
- int cy = ThemeEngine.Current.MenuCheckSize.Height;
+ int cx = MenuCheckSize.Width;
+ int cy = MenuCheckSize.Height;
Bitmap bmp = new Bitmap (cx, cy);
Graphics gr = Graphics.FromImage (bmp);
Rectangle rect_arrow = new Rectangle (0, 0, cx, cy);
}
}
- public override void DrawPopupMenu (Graphics dc, IntPtr hMenu, Rectangle cliparea, Rectangle rect)
+ public override void DrawPopupMenu (Graphics dc, Menu menu, Rectangle cliparea, Rectangle rect)
{
- MenuAPI.MENU menu = MenuAPI.GetMenuFromID (hMenu);
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush
- (ThemeEngine.Current.ColorMenu), cliparea);
+ dc.FillRectangle (ResPool.GetSolidBrush
+ (ColorMenu), cliparea);
/* Draw menu borders */
- dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorHilightText),
+ dc.DrawLine (ResPool.GetPen (ColorHighlightText),
rect.X, rect.Y, rect.X + rect.Width, rect.Y);
- dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorHilightText),
+ dc.DrawLine (ResPool.GetPen (ColorHighlightText),
rect.X, rect.Y, rect.X, rect.Y + rect.Height);
- dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonShadow),
+ dc.DrawLine (ResPool.GetPen (ColorControlDark),
rect.X + rect.Width - 1 , rect.Y , rect.X + rect.Width - 1, rect.Y + rect.Height);
- dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonDkShadow),
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark),
rect.X + rect.Width, rect.Y , rect.X + rect.Width, rect.Y + rect.Height);
- dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonShadow),
+ dc.DrawLine (ResPool.GetPen (ColorControlDark),
rect.X , rect.Y + rect.Height - 1 , rect.X + rect.Width - 1, rect.Y + rect.Height -1);
- dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorButtonDkShadow),
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark),
rect.X , rect.Y + rect.Height, rect.X + rect.Width - 1, rect.Y + rect.Height);
- for (int i = 0; i < menu.items.Count; i++)
- if (cliparea.IntersectsWith (((MenuAPI.MENUITEM) menu.items[i]).rect)) {
- MenuAPI.MENUITEM it = (MenuAPI.MENUITEM) menu.items[i];
- it.item.MenuHeight = menu.Height;
- it.item.PerformDrawItem (new DrawItemEventArgs (dc, ThemeEngine.Current.MenuFont,
- it.rect, i, it.item.Status));
+ for (int i = 0; i < menu.MenuItems.Count; i++)
+ if (cliparea.IntersectsWith (menu.MenuItems [i].bounds)) {
+ MenuItem item = menu.MenuItems [i];
+ item.MenuHeight = menu.Height;
+ item.PerformDrawItem (new DrawItemEventArgs (dc, MenuFont,
+ item.bounds, i, item.Status));
}
}
#region MonthCalendar
// draw the month calendar
- public override void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar mc) \r
+ public override void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar mc)
{
Rectangle client_rectangle = mc.ClientRectangle;
Size month_size = mc.SingleMonthSize;
int x_offset = 1;
int y_offset = 1;
// adjust for the position of the specific month
- for (int i=0; i < mc.CalendarDimensions.Height; i++) \r
+ for (int i=0; i < mc.CalendarDimensions.Height; i++)
{
- if (i > 0) \r
+ if (i > 0)
{
y_offset += month_size.Height + calendar_spacing.Height;
}
// now adjust for x position
- for (int j=0; j < mc.CalendarDimensions.Width; j++) \r
+ for (int j=0; j < mc.CalendarDimensions.Width; j++)
{
- if (j > 0) \r
+ if (j > 0)
{
x_offset += month_size.Width + calendar_spacing.Width;
- } \r
- else \r
+ }
+ else
{
x_offset = 1;
}
client_rectangle.Width,
date_cell_size.Height + 2);
// draw the today date if it's set
- if (mc.ShowToday && bottom_rect.IntersectsWith (clip_rectangle)) \r
+ if (mc.ShowToday && bottom_rect.IntersectsWith (clip_rectangle))
{
dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), bottom_rect);
if (mc.ShowToday) {
int today_offset = 5;
- if (mc.ShowTodayCircle) \r
+ if (mc.ShowTodayCircle)
{
Rectangle today_circle_rect = new Rectangle (
client_rectangle.X + 5,
Math.Max(client_rectangle.Width - today_offset, 0),
date_cell_size.Height);
dc.DrawString ("Today: " + DateTime.Now.ToShortDateString(), bold_font, ResPool.GetSolidBrush (mc.ForeColor), today_rect, text_format);
+ text_format.Dispose ();
+ bold_font.Dispose ();
}
}
}
// darws a single part of the month calendar (with one month)
- private void DrawSingleMonth(Graphics dc, Rectangle clip_rectangle, Rectangle rectangle, MonthCalendar mc, int row, int col) \r
+ private void DrawSingleMonth(Graphics dc, Rectangle clip_rectangle, Rectangle rectangle, MonthCalendar mc, int row, int col)
{
// cache local copies of Marshal-by-ref internal members (gets around error CS0197)
Size title_size = (Size)((object)mc.title_size);
dc.DrawString (title_text, mc.Font, ResPool.GetSolidBrush (mc.TitleForeColor), title_rect, text_format);
// draw previous and next buttons if it's time
- if (row == 0 && col == 0) \r
+ if (row == 0 && col == 0)
{
// draw previous button
DrawMonthCalendarButton (
(System.Drawing.Size)((object)mc.button_size),
true);
}
- if (row == 0 && col == mc.CalendarDimensions.Width-1) \r
+ if (row == 0 && col == mc.CalendarDimensions.Width-1)
{
// draw next button
DrawMonthCalendarButton (
dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), day_name_rect);
// draw the day names
DayOfWeek first_day_of_week = mc.GetDayOfWeek(mc.FirstDayOfWeek);
- for (int i=0; i < 7; i++) \r
+ for (int i=0; i < 7; i++)
{
int position = i - (int) first_day_of_week;
- if (position < 0) \r
+ if (position < 0)
{
position = 7 + position;
}
int month_row_count = 0;
bool draw_week_num_divider = false;
DateTime current_date = mc.GetFirstDateInMonthGrid ( new DateTime (this_month.Year, this_month.Month, 1));
- for (int i=0; i < 6; i++) \r
+ for (int i=0; i < 6; i++)
{
// establish if this row is in our clip_area
Rectangle row_rect = new Rectangle (
// only draw the days if we have to
if(month_row_count == i) {
- for (int j=0; j < 7; j++) \r
+ for (int j=0; j < 7; j++)
{
if (draw_row) {
DrawMonthCalendarDate (
rectangle.X + date_cell_size.Width - 1,
rectangle.Y + title_size.Height + date_cell_size.Height + (month_row_count * date_cell_size.Height) - mc.divider_line_offset);
}
+ text_format.Dispose ();
}
// draws the pervious or next button
- private void DrawMonthCalendarButton (Graphics dc, Rectangle rectangle, MonthCalendar mc, Size title_size, int x_offset, Size button_size, bool is_previous) \r
+ private void DrawMonthCalendarButton (Graphics dc, Rectangle rectangle, MonthCalendar mc, Size title_size, int x_offset, Size button_size, bool is_previous)
{
bool is_clicked = false;
Rectangle button_rect;
Rectangle arrow_rect = new Rectangle (rectangle.X, rectangle.Y, 4, 7);
Point[] arrow_path = new Point[3];
// prepare the button
- if (is_previous) \r
+ if (is_previous)
{
is_clicked = mc.is_previous_clicked;
button_rect = new Rectangle (
dc.DrawRectangle (SystemPens.ControlDark, button_rect);
}
else {
- CPDrawBorder3D (dc, button_rect, Border3DStyle.Raised, Border3DSide.All);
+ CPDrawBorder3D (dc, button_rect, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom);
}
// draw the arrow
dc.FillPolygon (SystemBrushes.ControlText, arrow_path);
Rectangle selection_rect = Rectangle.Inflate(rectangle, -3, -3);
dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 90, 180);
// fill the other side as a straight rect
- if (date < mc.SelectionEnd) \r
+ if (date < mc.SelectionEnd)
{
// use rectangle instead of rectangle to go all the way to edge of rect
selection_rect.X = (int) Math.Floor((double)(rectangle.X + rectangle.Width / 2));
dc.DrawRectangle (pen, interior);
}
}
+ text_format.Dispose ();
}
private void DrawTodayCircle (Graphics dc, Rectangle rectangle) {
public override void DrawPictureBox (Graphics dc, Rectangle clip, PictureBox pb) {
Rectangle client = pb.ClientRectangle;
+ // FIXME - instead of drawing the whole picturebox every time
+ // intersect the clip rectangle with the drawn picture and only draw what's needed,
+ // Also, we only need a background fill where no image goes
if (pb.Image != null) {
switch (pb.SizeMode) {
case PictureBoxSizeMode.StretchImage:
break;
case PictureBoxSizeMode.CenterImage:
+ dc.FillRectangle(ResPool.GetSolidBrush(pb.BackColor), clip);
dc.DrawImage (pb.Image, (client.Width / 2) - (pb.Image.Width / 2), (client.Height / 2) - (pb.Image.Height / 2));
break;
default:
+ dc.FillRectangle(ResPool.GetSolidBrush(pb.BackColor), clip);
// Normal, AutoSize
dc.DrawImage(pb.Image, 0, 0, pb.Image.Width, pb.Image.Height);
break;
}
+
+ return;
}
- CPDrawBorderStyle (dc, client, pb.BorderStyle);
+
+ // We only get here if no image is set. At least paint the background
+ dc.FillRectangle(ResPool.GetSolidBrush(pb.BackColor), clip);
}
public override Size PictureBoxDefaultSize {
increment = block_width + space_betweenblocks;
/* Draw border */
- CPDrawBorder3D (dc, ctrl.ClientRectangle, Border3DStyle.SunkenInner, Border3DSide.All & ~Border3DSide.Middle, ColorButtonFace);
+ CPDrawBorder3D (dc, ctrl.ClientRectangle, Border3DStyle.SunkenInner, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom & ~Border3DSide.Middle, ColorControl);
/* Draw Blocks */
block_rect = new Rectangle (client_area.X, client_area.Y, block_width, client_area.Height);
Rectangle client_rectangle;
Rectangle text_rectangle;
Rectangle radiobutton_rectangle;
- SolidBrush sb;
int radiobutton_size = 12;
int radiobutton_space = 4;
}
// Start drawing
+ RadioButton_DrawButton(radio_button, dc, state, radiobutton_rectangle);
+
+ RadioButton_DrawText(radio_button, text_rectangle, dc, text_format);
+
+ RadioButton_DrawFocus(radio_button, dc, text_rectangle);
+ text_format.Dispose ();
+ }
- sb=new SolidBrush(radio_button.BackColor);
+ protected virtual void RadioButton_DrawButton(RadioButton radio_button, Graphics dc, ButtonState state, Rectangle radiobutton_rectangle)
+ {
+ SolidBrush sb = new SolidBrush(radio_button.BackColor);
dc.FillRectangle(sb, radio_button.ClientRectangle);
sb.Dispose();
-
-
if (radio_button.appearance==Appearance.Button) {
if (radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup) {
DrawFlatStyleButton(dc, radio_button.ClientRectangle, radio_button);
ControlPaint.DrawRadioButton (dc, radiobutton_rectangle, state);
}
}
-
+ }
+
+ protected virtual void RadioButton_DrawText(RadioButton radio_button, Rectangle text_rectangle, Graphics dc, StringFormat text_format)
+ {
// offset the text if it's pressed and a button
if (radio_button.Appearance == Appearance.Button) {
if (radio_button.Checked || (radio_button.Capture && radio_button.FlatStyle != FlatStyle.Flat)) {
}
/* Place the text; to be compatible with Windows place it after the radiobutton has been drawn */
- dc.DrawString (radio_button.Text, radio_button.Font, ThemeEngine.Current.ResPool.GetSolidBrush (radio_button.ForeColor), text_rectangle, text_format);
-
+
+ // Windows seems to not wrap text in certain situations, this matches as close as I could get it
+ if ((float)(radio_button.Font.Height * 1.5f) > text_rectangle.Height) {
+ text_format.FormatFlags |= StringFormatFlags.NoWrap;
+ }
+
if (radio_button.Enabled) {
- sb = ResPool.GetSolidBrush(radio_button.ForeColor);
- dc.DrawString(radio_button.Text, radio_button.Font, sb, text_rectangle, text_format);
+ dc.DrawString (radio_button.Text, radio_button.Font, ResPool.GetSolidBrush (radio_button.ForeColor), text_rectangle, text_format);
} else if (radio_button.FlatStyle == FlatStyle.Flat) {
- dc.DrawString(radio_button.Text, radio_button.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorButtonFace)), text_rectangle, text_format);
+ dc.DrawString(radio_button.Text, radio_button.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorControl)), text_rectangle, text_format);
} else {
- CPDrawStringDisabled(dc, radio_button.Text, radio_button.Font, this.ColorButtonText, text_rectangle, text_format);
+ CPDrawStringDisabled(dc, radio_button.Text, radio_button.Font, this.ColorControlText, text_rectangle, text_format);
}
-
+ }
+
+ protected virtual void RadioButton_DrawFocus(RadioButton radio_button, Graphics dc, Rectangle text_rectangle)
+ {
if (radio_button.Focused) {
if (radio_button.FlatStyle != FlatStyle.Flat) {
DrawInnerFocusRectangle (dc, text_rectangle, radio_button.BackColor);
} else {
dc.DrawRectangle (ResPool.GetPen (radio_button.ForeColor), text_rectangle);
}
- }
+ }
}
// renders a radio button with the Flat and Popup FlatStyle
- private void DrawFlatStyleRadioButton (Graphics graphics, Rectangle rectangle, RadioButton radio_button)
+ protected void DrawFlatStyleRadioButton (Graphics graphics, Rectangle rectangle, RadioButton radio_button)
{
int lineWidth;
} else {
// just draw lighter flatstyle outer circle
- graphics.DrawArc (ResPool.GetPen (ControlPaint.Dark (this.ColorButtonFace)), rectangle, 0, 359);
+ graphics.DrawArc (ResPool.GetPen (ControlPaint.Dark (this.ColorControl)), rectangle, 0, 359);
}
}
} else {
// disabled
// fill control background color regardless of actual backcolor
- graphics.FillPie (ResPool.GetSolidBrush (this.ColorButtonFace), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+ graphics.FillPie (ResPool.GetSolidBrush (this.ColorControl), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
// draw the ark as control dark
- graphics.DrawArc (ResPool.GetPen (ControlPaint.Dark(this.ColorButtonFace)), rectangle, 0, 359);
+ graphics.DrawArc (ResPool.GetPen (ControlPaint.Dark(this.ColorControl)), rectangle, 0, 359);
}
// draw the check
SolidBrush buttonBrush;
if (!radio_button.Enabled) {
- buttonBrush = ResPool.GetSolidBrush (ControlPaint.Dark (this.ColorButtonFace));
+ buttonBrush = ResPool.GetSolidBrush (ControlPaint.Dark (this.ColorControl));
} else if (radio_button.FlatStyle == FlatStyle.Popup && radio_button.is_entered && radio_button.Capture) {
- buttonBrush = ResPool.GetSolidBrush (this.ColorButtonText);
+ buttonBrush = ResPool.GetSolidBrush (this.ColorControlText);
} else {
buttonBrush = ResPool.GetSolidBrush (radio_button.ForeColor);
}
/* Background */
switch (bar.thumb_moving) {
case ScrollBar.ThumbMoving.None: {
- Rectangle r = new Rectangle (0,
- scrollbutton_height, bar.ClientRectangle.Width, bar.ClientRectangle.Height - (scrollbutton_height * 2));
- Rectangle intersect = Rectangle.Intersect (clip, r);
-
- if (intersect != Rectangle.Empty) {
- Brush h = ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace);
- dc.FillRectangle (h, intersect);
- }
+ ScrollBar_Vertical_Draw_ThumbMoving_None(scrollbutton_height, bar, clip, dc);
break;
}
case ScrollBar.ThumbMoving.Forward: {
- Rectangle r = new Rectangle (0, scrollbutton_height,
- bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height);
- Rectangle intersect = Rectangle.Intersect (clip, r);
-
- if (intersect != Rectangle.Empty)
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace), intersect);
-
- r.X = 0;
- r.Y = thumb_pos.Y + thumb_pos.Height;
- r.Width = bar.ClientRectangle.Width;
- r.Height = bar.ClientRectangle.Height - (thumb_pos.Y + thumb_pos.Height) - scrollbutton_height;
-
- intersect = Rectangle.Intersect (clip, r);
- if (intersect != Rectangle.Empty)
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63,63,63), Color.Black), intersect);
+ ScrollBar_Vertical_Draw_ThumbMoving_Forward(scrollbutton_height, bar, thumb_pos, clip, dc);
break;
}
case ScrollBar.ThumbMoving.Backwards: {
- Rectangle r = new Rectangle (0, scrollbutton_height,
- bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height);
- Rectangle intersect = Rectangle.Intersect (clip, r);
-
- if (intersect != Rectangle.Empty)
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63,63,63), Color.Black), intersect);
-
- r.X = 0;
- r.Y = thumb_pos.Y + thumb_pos.Height;
- r.Width = bar.ClientRectangle.Width;
- r.Height = bar.ClientRectangle.Height - (thumb_pos.Y + thumb_pos.Height) - scrollbutton_height;
-
- intersect = Rectangle.Intersect (clip, r);
- if (intersect != Rectangle.Empty)
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace), intersect);
+ ScrollBar_Vertical_Draw_ThumbMoving_Backwards(scrollbutton_height, bar, thumb_pos, clip, dc);
break;
}
/* Background */
switch (bar.thumb_moving) {
case ScrollBar.ThumbMoving.None: {
- Rectangle r = new Rectangle (scrollbutton_width,
- 0, bar.ClientRectangle.Width - (scrollbutton_width * 2), bar.ClientRectangle.Height);
- Rectangle intersect = Rectangle.Intersect (clip, r);
-
- if (intersect != Rectangle.Empty)
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace), intersect);
+ ScrollBar_Horizontal_Draw_ThumbMoving_None(scrollbutton_width, bar, clip, dc);
break;
}
case ScrollBar.ThumbMoving.Forward: {
- Rectangle r = new Rectangle (scrollbutton_width, 0,
- thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height);
- Rectangle intersect = Rectangle.Intersect (clip, r);
-
- if (intersect != Rectangle.Empty)
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace), intersect);
-
- r.X = thumb_pos.X + thumb_pos.Width;
- r.Y = 0;
- r.Width = bar.ClientRectangle.Width - (thumb_pos.X + thumb_pos.Width) - scrollbutton_width;
- r.Height = bar.ClientRectangle.Height;
-
- intersect = Rectangle.Intersect (clip, r);
- if (intersect != Rectangle.Empty)
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63,63,63), Color.Black), intersect);
+ ScrollBar_Horizontal_Draw_ThumbMoving_Forward(scrollbutton_width, thumb_pos, bar, clip, dc);
break;
}
case ScrollBar.ThumbMoving.Backwards: {
- Rectangle r = new Rectangle (scrollbutton_width, 0,
- thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height);
- Rectangle intersect = Rectangle.Intersect (clip, r);
-
- if (intersect != Rectangle.Empty)
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63,63,63), Color.Black), intersect);
-
- r.X = thumb_pos.X + thumb_pos.Width;
- r.Y = 0;
- r.Width = bar.ClientRectangle.Width - (thumb_pos.X + thumb_pos.Width) - scrollbutton_width;
- r.Height = bar.ClientRectangle.Height;
-
- intersect = Rectangle.Intersect (clip, r);
- if (intersect != Rectangle.Empty)
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace), intersect);
+ ScrollBar_Horizontal_Draw_ThumbMoving_Backwards(scrollbutton_width, thumb_pos, bar, clip, dc);
break;
}
}
}
/* Thumb */
- if (bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith (thumb_pos))
- DrawScrollButtonPrimitive (dc, thumb_pos, ButtonState.Normal);
+ ScrollBar_DrawThumb(bar, thumb_pos, clip, dc);
+ }
+
+ protected virtual void ScrollBar_DrawThumb(ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc)
+ {
+ if (bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith(thumb_pos))
+ DrawScrollButtonPrimitive(dc, thumb_pos, ButtonState.Normal);
+ }
+
+ protected virtual void ScrollBar_Vertical_Draw_ThumbMoving_None( int scrollbutton_height, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( 0,
+ scrollbutton_height, bar.ClientRectangle.Width, bar.ClientRectangle.Height - ( scrollbutton_height * 2 ) );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ {
+ Brush h = ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White);
+ dc.FillRectangle( h, intersect );
+ }
+ }
+
+ protected virtual void ScrollBar_Vertical_Draw_ThumbMoving_Forward( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( 0, scrollbutton_height,
+ bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White ), intersect );
+
+ r.X = 0;
+ r.Y = thumb_pos.Y + thumb_pos.Height;
+ r.Width = bar.ClientRectangle.Width;
+ r.Height = bar.ClientRectangle.Height - ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+ }
+
+ protected virtual void ScrollBar_Vertical_Draw_ThumbMoving_Backwards( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( 0, scrollbutton_height,
+ bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+
+ r.X = 0;
+ r.Y = thumb_pos.Y + thumb_pos.Height;
+ r.Width = bar.ClientRectangle.Width;
+ r.Height = bar.ClientRectangle.Height - ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White), intersect );
+ }
+
+ protected virtual void ScrollBar_Horizontal_Draw_ThumbMoving_None( int scrollbutton_width, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( scrollbutton_width,
+ 0, bar.ClientRectangle.Width - ( scrollbutton_width * 2 ), bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White), intersect );
+ }
+
+ protected virtual void ScrollBar_Horizontal_Draw_ThumbMoving_Forward( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( scrollbutton_width, 0,
+ thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White), intersect );
+
+ r.X = thumb_pos.X + thumb_pos.Width;
+ r.Y = 0;
+ r.Width = bar.ClientRectangle.Width - ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+ r.Height = bar.ClientRectangle.Height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+ }
+
+ protected virtual void ScrollBar_Horizontal_Draw_ThumbMoving_Backwards( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( scrollbutton_width, 0,
+ thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+
+ r.X = thumb_pos.X + thumb_pos.Width;
+ r.Y = 0;
+ r.Width = bar.ClientRectangle.Width - ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+ r.Height = bar.ClientRectangle.Height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White), intersect );
}
public override int ScrollBarButtonSize {
dc.DrawString (text, sb.Font, ResPool.GetSolidBrush (sb.ForeColor),
new Rectangle(area.X + 2, area.Y + 2, area.Width - 4, area.Height - 4), string_format);
+ string_format.Dispose ();
} else if (sb.ShowPanels) {
SolidBrush br_forecolor = GetControlForeBrush (sb.ForeColor);
int prev_x = area.X + horz_border;
}
if (sb.SizingGrip)
- CPDrawSizeGrip (dc, ColorButtonFace, area);
+ CPDrawSizeGrip (dc, ColorControl, area);
}
- private void DrawStatusBarPanel (Graphics dc, Rectangle area, int index,
+ protected virtual void DrawStatusBarPanel (Graphics dc, Rectangle area, int index,
SolidBrush br_forecolor, StatusBarPanel panel) {
int border_size = 3; // this is actually const, even if the border style is none
Border3DStyle border_style = Border3DStyle.SunkenInner;
if (panel.BorderStyle == StatusBarPanelBorderStyle.Raised)
border_style = Border3DStyle.RaisedOuter;
- CPDrawBorder3D(dc, area, border_style, Border3DSide.All, ColorButtonFace);
+ CPDrawBorder3D(dc, area, border_style, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, panel.Parent.BackColor);
}
if (panel.Style == StatusBarPanelStyle.OwnerDraw) {
area.Bottom - y - border_size);
dc.DrawString (text, panel.Parent.Font, br_forecolor, r, string_format);
+ string_format.Dispose ();
}
public override int StatusBarSizeGripWidth {
Rectangle panel_rect = GetTabPanelRectExt (tab);
if (tab.Appearance == TabAppearance.Normal) {
- CPDrawBorder3D (dc, panel_rect, Border3DStyle.RaisedInner, Border3DSide.Left | Border3DSide.Top, ColorButtonFace);
- CPDrawBorder3D (dc, panel_rect, Border3DStyle.Raised, Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+ CPDrawBorder3D (dc, panel_rect, Border3DStyle.RaisedInner, Border3DSide.Left | Border3DSide.Top, ColorControl);
+ CPDrawBorder3D (dc, panel_rect, Border3DStyle.Raised, Border3DSide.Right | Border3DSide.Bottom, ColorControl);
}
if (tab.Alignment == TabAlignment.Top) {
}
}
- private Rectangle GetTabPanelRectExt (TabControl tab)
+ protected virtual Rectangle GetTabPanelRectExt (TabControl tab)
{
// Offset the tab from the top corner
Rectangle res = new Rectangle (tab.ClientRectangle.X + 2,
return res;
}
- private int DrawTab (Graphics dc, TabPage page, TabControl tab, Rectangle bounds, bool is_selected)
+ protected virtual int DrawTab (Graphics dc, TabPage page, TabControl tab, Rectangle bounds, bool is_selected)
{
- int FlatButtonSpacing = 8;
+ int FlatButtonSpacing = 8;
Rectangle interior;
int res = bounds.Width;
+
+
// we can't fill the background right away because the bounds might be adjusted if the tab is selected
+ StringFormat string_format = new StringFormat ();
if (tab.Appearance == TabAppearance.Buttons || tab.Appearance == TabAppearance.FlatButtons) {
-
dc.FillRectangle (GetControlBackBrush (tab.BackColor), bounds);
// Separators
}
if (is_selected) {
- CPDrawBorder3D (dc, bounds, Border3DStyle.Sunken, Border3DSide.All);
+ CPDrawBorder3D (dc, bounds, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom);
} else if (tab.Appearance != TabAppearance.FlatButtons) {
- CPDrawBorder3D (dc, bounds, Border3DStyle.Raised, Border3DSide.All);
+ CPDrawBorder3D (dc, bounds, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom);
}
interior = new Rectangle (bounds.Left + 2, bounds.Top + 2, bounds.Width - 4, bounds.Height - 4);
- StringFormat string_format = new StringFormat ();
string_format.Alignment = StringAlignment.Center;
string_format.LineAlignment = StringAlignment.Center;
string_format.FormatFlags = StringFormatFlags.NoWrap;
-
- interior.Y++;
- dc.DrawString (page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush (SystemColors.ControlText), interior, string_format);
- interior.Y--;
} else {
Pen light = ResPool.GetPen (ControlPaint.LightLight (tab.BackColor));
interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
- if (page.Text != String.Empty) {
- StringFormat string_format = new StringFormat ();
- string_format.Alignment = StringAlignment.Center;
- string_format.LineAlignment = StringAlignment.Center;
- string_format.FormatFlags = StringFormatFlags.NoWrap;
- interior.Y++;
- dc.DrawString (page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush (SystemColors.ControlText), interior, string_format);
- interior.Y--;
- }
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
break;
interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
- if (page.Text != String.Empty) {
- StringFormat string_format = new StringFormat ();
- string_format.Alignment = StringAlignment.Center;
- string_format.LineAlignment = StringAlignment.Center;
- string_format.FormatFlags = StringFormatFlags.NoWrap;
- interior.Y++;
- dc.DrawString (page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush (SystemColors.ControlText), interior, string_format);
- interior.Y--;
- }
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
break;
interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
- if (page.Text != String.Empty) {
- StringFormat string_format = new StringFormat ();
- // Flip the text around
- string_format.Alignment = StringAlignment.Center;
- string_format.LineAlignment = StringAlignment.Center;
- string_format.FormatFlags = StringFormatFlags.NoWrap;
- string_format.FormatFlags = StringFormatFlags.DirectionVertical;
- int wo = interior.Width / 2;
- int ho = interior.Height / 2;
- dc.TranslateTransform (interior.X + wo, interior.Y + ho);
- dc.RotateTransform (180);
- dc.DrawString (page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush (SystemColors.ControlText), 0, 0, string_format);
- dc.ResetTransform ();
- }
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ string_format.FormatFlags = StringFormatFlags.DirectionVertical;
break;
interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
- if (page.Text != String.Empty) {
- StringFormat string_format = new StringFormat ();
- string_format.Alignment = StringAlignment.Center;
- string_format.LineAlignment = StringAlignment.Center;
- string_format.FormatFlags = StringFormatFlags.NoWrap;
- string_format.FormatFlags = StringFormatFlags.DirectionVertical;
- interior.X++;
- dc.DrawString (page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush (SystemColors.ControlText), interior, string_format);
- interior.X--;
- }
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ string_format.FormatFlags = StringFormatFlags.DirectionVertical;
break;
}
}
- if (page.Focused) {
+ if (tab.DrawMode == TabDrawMode.Normal && page.Text != null) {
+ if (tab.Alignment == TabAlignment.Left) {
+ int wo = interior.Width / 2;
+ int ho = interior.Height / 2;
+ dc.TranslateTransform (interior.X + wo, interior.Y + ho);
+ dc.RotateTransform (180);
+ dc.DrawString (page.Text, page.Font, ResPool.GetSolidBrush (SystemColors.ControlText), 0, 0, string_format);
+ dc.ResetTransform ();
+ } else {
+ dc.DrawString (page.Text, page.Font,
+ ResPool.GetSolidBrush (SystemColors.ControlText),
+ interior, string_format);
+ }
+ } else if (page.Text != null) {
+ DrawItemState state = DrawItemState.None;
+ if (page == tab.SelectedTab)
+ state |= DrawItemState.Selected;
+ DrawItemEventArgs e = new DrawItemEventArgs (dc,
+ tab.Font, bounds, tab.IndexForTabPage (page),
+ state, page.ForeColor, page.BackColor);
+ tab.OnDrawItemInternal (e);
+ return res;
+ }
+
+ if (page.parent.Focused && is_selected) {
CPDrawFocusRectangle (dc, interior, tab.ForeColor, tab.BackColor);
}
Rectangle paint_area = new Rectangle (0, ToolBarGripWidth / 2,
control.Width, control.Height - ToolBarGripWidth / 2);
bool flat = (control.Appearance == ToolBarAppearance.Flat);
- dc.FillRectangle (SystemBrushes.Control, paint_area);
- CPDrawBorderStyle (dc, paint_area, control.BorderStyle);
-
+ dc.FillRectangle (ResPool.GetSolidBrush( DefaultControlBackColor ), paint_area);
if (control.Divider)
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), 0, 0, paint_area.Width, 0);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), 0, 0, paint_area.Width, 0);
foreach (ToolBarButton button in control.Buttons) {
/* Draw the button frame, only if it is not a separator */
if (flat) {
if (button.Pushed || button.Pressed) {
- CPDrawBorder3D (dc, buttonArea, Border3DStyle.SunkenOuter, Border3DSide.All, ColorButtonFace);
+ CPDrawBorder3D (dc, buttonArea, Border3DStyle.SunkenOuter, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, ColorControl);
} else if (button.Hilight) {
- dc.DrawRectangle (ResPool.GetPen (ColorButtonText), buttonArea);
+ dc.DrawRectangle (ResPool.GetPen (ColorControlText), buttonArea);
if (! ddRect.IsEmpty) {
- dc.DrawLine (ResPool.GetPen (ColorButtonText), ddRect.X, ddRect.Y, ddRect.X,
+ dc.DrawLine (ResPool.GetPen (ColorControlText), ddRect.X, ddRect.Y, ddRect.X,
ddRect.Y + ddRect.Height);
buttonArea.Width -= this.ToolBarDropDownWidth;
}
else { // normal toolbar
if (button.Pushed || button.Pressed) {
CPDrawBorder3D (dc, buttonArea, Border3DStyle.SunkenInner,
- Border3DSide.All, ColorButtonFace);
+ Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, ColorControl);
if (! ddRect.IsEmpty) {
CPDrawBorder3D (dc, ddRect, Border3DStyle.SunkenInner,
- Border3DSide.Left, ColorButtonFace);
+ Border3DSide.Left, ColorControl);
buttonArea.Width -= this.ToolBarDropDownWidth;
}
}
else {
CPDrawBorder3D (dc, buttonArea, Border3DStyle.RaisedInner,
- Border3DSide.All, ColorButtonFace);
+ Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, ColorControl);
if (! ddRect.IsEmpty) {
CPDrawBorder3D (dc, ddRect, Border3DStyle.RaisedInner,
- Border3DSide.Left, ColorButtonFace);
+ Border3DSide.Left, ColorControl);
buttonArea.Width -= this.ToolBarDropDownWidth;
}
}
DrawToolBarButton (dc, button, control.Font, format, paint_area, buttonArea,
imgRect, image, txtRect, ddRect, flat);
}
+ format.Dispose ();
}
private void DrawToolBarButton (Graphics dc, ToolBarButton button, Font font, StringFormat format,
case ToolBarButtonStyle.Separator:
// separator is drawn only in the case of flat appearance
if (flat) {
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), buttonArea.X + 1, buttonArea.Y,
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), buttonArea.X + 1, buttonArea.Y,
buttonArea.X + 1, buttonArea.Height);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), buttonArea.X + 1 + (int) ResPool.GetPen (ColorButtonFace).Width,
- buttonArea.Y, buttonArea.X + 1 + (int) ResPool.GetPen (ColorButtonFace).Width, buttonArea.Height);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), buttonArea.X + 1 + (int) ResPool.GetPen (ColorControl).Width,
+ buttonArea.Y, buttonArea.X + 1 + (int) ResPool.GetPen (ColorControl).Width, buttonArea.Height);
/* draw a horizontal separator */
if (button.Wrapper) {
int y = buttonArea.Height + this.ToolBarSeparatorWidth / 2;
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), 0, y, controlArea.Width, y);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), 0, y + 1 + (int) ResPool.GetPen (ColorButtonFace).Width, controlArea.Width,
- y + 1 + (int) ResPool.GetPen (ColorButtonFace).Width);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), 0, y, controlArea.Width, y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), 0, y + 1 + (int) ResPool.GetPen (ColorControl).Width, controlArea.Width,
+ y + 1 + (int) ResPool.GetPen (ColorControl).Width);
}
}
break;
button.Parent.ImageList.Draw (dc, imgRect.X, imgRect.Y, imgRect.Width,
imgRect.Height, button.ImageIndex);
else {
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ColorGrayText), imgRect);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorGrayText), imgRect);
ControlPaint.DrawBorder3D (dc, imgRect, Border3DStyle.SunkenOuter,
Border3DSide.Right | Border3DSide.Bottom);
}
if (button.Enabled)
dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
else
- CPDrawStringDisabled (dc, button.Text, font, ColorButtonHilight, txtRect, format);
+ CPDrawStringDisabled (dc, button.Text, font, ColorControlLight, txtRect, format);
}
else if (button.PartialPush) {
button.Parent.ImageList.Draw (dc, imgRect.X, imgRect.Y, imgRect.Width,
imgRect.Height, button.ImageIndex);
else {
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ColorGrayText), imgRect);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorGrayText), imgRect);
ControlPaint.DrawBorder3D (dc, imgRect, Border3DStyle.SunkenOuter,
Border3DSide.Right | Border3DSide.Bottom);
}
if (button.Enabled)
dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
else
- CPDrawStringDisabled (dc, button.Text, font, ColorButtonHilight,
+ CPDrawStringDisabled (dc, button.Text, font, ColorControlLight,
txtRect, format);
}
button.Parent.ImageList.Draw (dc, imgRect.X, imgRect.Y, imgRect.Width,
imgRect.Height, button.ImageIndex);
else {
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ColorGrayText), imgRect);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorGrayText), imgRect);
CPDrawBorder3D (dc, imgRect, Border3DStyle.SunkenOuter,
- Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+ Border3DSide.Right | Border3DSide.Bottom, ColorControl);
}
}
if (button.Enabled)
dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
else
- CPDrawStringDisabled (dc, button.Text, font, ColorButtonHilight,
+ CPDrawStringDisabled (dc, button.Text, font, ColorControlLight,
txtRect, format);
}
button.Parent.ImageList.Draw (dc, imgRect.X, imgRect.Y, imgRect.Width,
imgRect.Height, button.ImageIndex);
else {
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ColorGrayText), imgRect);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorGrayText), imgRect);
CPDrawBorder3D (dc, imgRect, Border3DStyle.SunkenOuter,
- Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+ Border3DSide.Right | Border3DSide.Bottom, ColorControl);
}
}
if (button.Enabled)
dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
else
- CPDrawStringDisabled (dc, button.Text, font, ColorButtonHilight,
+ CPDrawStringDisabled (dc, button.Text, font, ColorControlLight,
txtRect, format);
}
break;
button.Parent.ImageList.Draw (dc, imgRect.X, imgRect.Y, imgRect.Width, imgRect.Height,
button.ImageIndex);
else {
- dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ColorGrayText), imgRect);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorGrayText), imgRect);
CPDrawBorder3D (dc, imgRect, Border3DStyle.SunkenOuter,
- Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+ Border3DSide.Right | Border3DSide.Bottom, ColorControl);
}
}
if (button.Enabled)
dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
else
- CPDrawStringDisabled (dc, button.Text, font, ColorButtonHilight,
+ CPDrawStringDisabled (dc, button.Text, font, ColorControlLight,
txtRect, format);
break;
}
#region ToolTip
public override void DrawToolTip(Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control) {
- dc.FillRectangle(ResPool.GetSolidBrush(this.ColorInfoWindow), control.client_rect);
+ dc.FillRectangle(ResPool.GetSolidBrush(this.ColorInfo), control.client_rect);
dc.DrawRectangle(ResPool.GetPen(this.ColorWindowFrame), 0, 0, control.Width-1, control.Height-1);
dc.DrawString(control.text, control.Font, ResPool.GetSolidBrush(this.ColorInfoText), control.client_rect, control.string_format);
}
float pixels_betweenticks;
const int space_from_right = 8;
const int space_from_left = 8;
+ const int space_from_bottom = 11;
Rectangle area = tb.ClientRectangle;
switch (tb.TickStyle) {
thumb_area.Width = 4;
/* Draw channel */
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonShadow), channel_startpoint.X, channel_startpoint.Y,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDark), channel_startpoint.X, channel_startpoint.Y,
1, thumb_area.Height);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonDkShadow), channel_startpoint.X + 1, channel_startpoint.Y,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDarkDark), channel_startpoint.X + 1, channel_startpoint.Y,
1, thumb_area.Height);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonHilight), channel_startpoint.X + 3, channel_startpoint.Y,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlLight), channel_startpoint.X + 3, channel_startpoint.Y,
1, thumb_area.Height);
pixel_len = thumb_area.Height - 11;
/* Convert thumb position from mouse position to value*/
if (mouse_value) {
-
- if (value_pos >= channel_startpoint.Y)
- value_pos = (int)(((float) (value_pos - channel_startpoint.Y)) / pixels_betweenticks);
+ if (value_pos < thumb_area.Bottom)
+ value_pos = (int) ((thumb_area.Bottom - value_pos) / pixels_betweenticks);
else
value_pos = 0;
if (value_pos + tb.Minimum > tb.Maximum)
value_pos = tb.Maximum - tb.Minimum;
-
+
tb.Value = value_pos + tb.Minimum;
}
-
- thumb_pos.Y = channel_startpoint.Y + (int) (pixels_betweenticks * (float) value_pos);
+
+ // thumb_pos.Y = channel_startpoint.Y ; // + (int) (pixels_betweenticks * (float) value_pos);
+ thumb_pos.Y = thumb_area.Bottom - space_from_bottom - (int) (pixels_betweenticks * (float) value_pos);
/* Draw thumb fixed 10x22 size */
thumb_pos.Width = 10;
case TickStyle.None: {
thumb_pos.X = channel_startpoint.X - 8;
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X , thumb_pos.Y + 10);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 16, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X + 16, thumb_pos.Y, thumb_pos.X + 16 + 4, thumb_pos.Y + 4);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X , thumb_pos.Y + 10);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 16, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X + 16, thumb_pos.Y, thumb_pos.X + 16 + 4, thumb_pos.Y + 4);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X +1, thumb_pos.Y + 9, thumb_pos.X +15, thumb_pos.Y +9);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 16, thumb_pos.Y + 9, thumb_pos.X +16 + 4, thumb_pos.Y +9 - 4);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X +1, thumb_pos.Y + 9, thumb_pos.X +15, thumb_pos.Y +9);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 16, thumb_pos.Y + 9, thumb_pos.X +16 + 4, thumb_pos.Y +9 - 4);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X +16, thumb_pos.Y +10);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 16, thumb_pos.Y + 10, thumb_pos.X +16 + 5, thumb_pos.Y +10 - 5);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X +16, thumb_pos.Y +10);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 16, thumb_pos.Y + 10, thumb_pos.X +16 + 5, thumb_pos.Y +10 - 5);
dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 16, 8);
dc.FillRectangle (br_thumb, thumb_pos.X + 17, thumb_pos.Y + 2, 1, 6);
case TickStyle.TopLeft: {
thumb_pos.X = channel_startpoint.X - 10;
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X + 4 + 16, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 4);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X + 4 + 16, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 4);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X + 4 + 16 , thumb_pos.Y+ 9);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X, thumb_pos.Y + 5);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 19, thumb_pos.Y + 9, thumb_pos.X +19 , thumb_pos.Y+ 1);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X + 4 + 16 , thumb_pos.Y+ 9);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X, thumb_pos.Y + 5);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 19, thumb_pos.Y + 9, thumb_pos.X +19 , thumb_pos.Y+ 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 4, thumb_pos.Y+ 10, thumb_pos.X + 4 + 16, thumb_pos.Y+ 10);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 4, thumb_pos.Y + 10, thumb_pos.X -1, thumb_pos.Y+ 5);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 20, thumb_pos.Y, thumb_pos.X+ 20, thumb_pos.Y + 10);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 4, thumb_pos.Y+ 10, thumb_pos.X + 4 + 16, thumb_pos.Y+ 10);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 4, thumb_pos.Y + 10, thumb_pos.X -1, thumb_pos.Y+ 5);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 20, thumb_pos.Y, thumb_pos.X+ 20, thumb_pos.Y + 10);
dc.FillRectangle (br_thumb, thumb_pos.X + 4, thumb_pos.Y + 1, 15, 8);
dc.FillRectangle (br_thumb, thumb_pos.X + 3, thumb_pos.Y + 2, 1, 6);
case TickStyle.Both: {
thumb_pos.X = area.X + 10;
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 9);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 19, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 9);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 19, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X+ 19, thumb_pos.Y + 9);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 10, thumb_pos.Y+ 1, thumb_pos.X + 19, thumb_pos.Y + 8);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X+ 19, thumb_pos.Y + 9);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 10, thumb_pos.Y+ 1, thumb_pos.X + 19, thumb_pos.Y + 8);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X+ 20, thumb_pos.Y +10);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 20, thumb_pos.Y, thumb_pos.X + 20, thumb_pos.Y+ 9);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X+ 20, thumb_pos.Y +10);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 20, thumb_pos.Y, thumb_pos.X + 20, thumb_pos.Y+ 9);
dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 18, 8);
thumb_area.Height = 4;
/* Draw channel */
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonShadow), channel_startpoint.X, channel_startpoint.Y,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDark), channel_startpoint.X, channel_startpoint.Y,
thumb_area.Width, 1);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonDkShadow), channel_startpoint.X, channel_startpoint.Y + 1,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDarkDark), channel_startpoint.X, channel_startpoint.Y + 1,
thumb_area.Width, 1);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonHilight), channel_startpoint.X, channel_startpoint.Y +3,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlLight), channel_startpoint.X, channel_startpoint.Y +3,
thumb_area.Width, 1);
pixel_len = thumb_area.Width - 11;
case TickStyle.None: {
thumb_pos.Y = channel_startpoint.Y - 8;
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 16);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y + 16, thumb_pos.X + 4, thumb_pos.Y + 16 + 4);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 16);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y + 16, thumb_pos.X + 4, thumb_pos.Y + 16 + 4);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X +9, thumb_pos.Y +15);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 16, thumb_pos.X +9 - 4, thumb_pos.Y +16 + 4);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X +9, thumb_pos.Y +15);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 16, thumb_pos.X +9 - 4, thumb_pos.Y +16 + 4);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X +10, thumb_pos.Y +16);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 10, thumb_pos.Y + 16, thumb_pos.X +10 - 5, thumb_pos.Y +16 + 5);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X +10, thumb_pos.Y +16);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 10, thumb_pos.Y + 16, thumb_pos.X +10 - 5, thumb_pos.Y +16 + 5);
dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 8, 16);
dc.FillRectangle (br_thumb, thumb_pos.X + 2, thumb_pos.Y + 17, 6, 1);
case TickStyle.TopLeft: {
thumb_pos.Y = channel_startpoint.Y - 10;
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X, thumb_pos.Y + 4 + 16);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X + 4, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X, thumb_pos.Y + 4 + 16);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X + 4, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 9, thumb_pos.Y + 4 + 16);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 19, thumb_pos.X + 1 , thumb_pos.Y +19);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 9, thumb_pos.Y + 4 + 16);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 19, thumb_pos.X + 1 , thumb_pos.Y +19);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 10, thumb_pos.Y + 4 + 16);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y -1);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 10, thumb_pos.Y + 20);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 10, thumb_pos.Y + 4 + 16);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y -1);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 10, thumb_pos.Y + 20);
dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 4, 8, 15);
dc.FillRectangle (br_thumb, thumb_pos.X + 2, thumb_pos.Y + 3, 6, 1);
case TickStyle.Both: {
thumb_pos.Y = area.Y + 10;
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 9, thumb_pos.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 19);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 9, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 19);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X + 9, thumb_pos.Y + 19);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), thumb_pos.X + 1, thumb_pos.Y + 10, thumb_pos.X + 8, thumb_pos.Y + 19);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X + 9, thumb_pos.Y + 19);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 1, thumb_pos.Y + 10, thumb_pos.X + 8, thumb_pos.Y + 19);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X +10, thumb_pos.Y + 20);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 9, thumb_pos.Y + 20);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X +10, thumb_pos.Y + 20);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 9, thumb_pos.Y + 20);
dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 8, 18);
area = tb.ClientRectangle;
if (tb.thumb_pressed == true) {
- br_thumb = (Brush) ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonHilight, ColorButtonFace);
+ br_thumb = (Brush) ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControlLight, ColorControl);
} else {
- br_thumb = ResPool.GetSolidBrush (ColorButtonFace);
+ br_thumb = ResPool.GetSolidBrush (ColorControl);
}
/* Control Background */
if (tb.BackColor == DefaultControlBackColor) {
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonFace), clip_rectangle);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), clip_rectangle);
} else {
dc.FillRectangle (ResPool.GetSolidBrush (tb.BackColor), clip_rectangle);
}
if (tb.Focused) {
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonFace, Color.Black), area.X, area.Y, area.Width - 1, 1);
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonFace, Color.Black), area.X, area.Y + area.Height - 1, area.Width - 1, 1);
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonFace, Color.Black), area.X, area.Y, 1, area.Height - 1);
- dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonFace, Color.Black), area.X + area.Width - 1, area.Y, 1, area.Height - 1);
+ dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControl, Color.Black), area.X, area.Y, area.Width - 1, 1);
+ dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControl, Color.Black), area.X, area.Y + area.Height - 1, area.Width - 1, 1);
+ dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControl, Color.Black), area.X, area.Y, 1, area.Height - 1);
+ dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControl, Color.Black), area.X + area.Width - 1, area.Y, 1, area.Height - 1);
}
if (tb.Orientation == Orientation.Vertical) {
#endregion // VScrollBar
#region TreeView
- public override Size TreeViewDefaultSize {\r
- get {\r
- return new Size (121, 97);\r
- }\r
- }\r
+ public override Size TreeViewDefaultSize {
+ get {
+ return new Size (121, 97);
+ }
+ }
#endregion
}
public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) {
- CPDrawBorder3D(graphics, rectangle, style, sides, ColorButtonFace);
+ CPDrawBorder3D(graphics, rectangle, style, sides, ColorControl);
}
private void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color) {
Pen pen;
if ((state & ButtonState.Inactive)!=0) {
- pen=new Pen(ColorButtonHilight, lineWidth);
- DrawCaptionHelper(graphics, ColorButtonHilight, pen, lineWidth, 1, captionRect, button);
+ pen=new Pen(ColorControlLight, lineWidth);
+ DrawCaptionHelper(graphics, ColorControlLight, pen, lineWidth, 1, captionRect, button);
pen.Dispose();
- pen=new Pen(ColorButtonShadow, lineWidth);
- DrawCaptionHelper(graphics, ColorButtonShadow, pen, lineWidth, 0, captionRect, button);
+ pen=new Pen(ColorControlDark, lineWidth);
+ DrawCaptionHelper(graphics, ColorControlDark, pen, lineWidth, 0, captionRect, button);
pen.Dispose();
return;
} else {
- pen=new Pen(ColorButtonText, lineWidth);
- DrawCaptionHelper(graphics, ColorButtonText, pen, lineWidth, 0, captionRect, button);
+ pen=new Pen(ColorControlText, lineWidth);
+ DrawCaptionHelper(graphics, ColorControlText, pen, lineWidth, 0, captionRect, button);
pen.Dispose();
return;
}
case CaptionButton.Minimize:
case CaptionButton.Restore: {
if ((state & ButtonState.Inactive)!=0) {
- DrawCaptionHelper(graphics, ColorButtonHilight, SystemPens.ControlLightLight, lineWidth, 1, captionRect, button);
+ DrawCaptionHelper(graphics, ColorControlLight, SystemPens.ControlLightLight, lineWidth, 1, captionRect, button);
- DrawCaptionHelper(graphics, ColorButtonShadow, SystemPens.ControlDark, lineWidth, 0, captionRect, button);
+ DrawCaptionHelper(graphics, ColorControlDark, SystemPens.ControlDark, lineWidth, 0, captionRect, button);
return;
} else {
- DrawCaptionHelper(graphics, ColorButtonText, SystemPens.ControlText, lineWidth, 0, captionRect, button);
+ DrawCaptionHelper(graphics, ColorControlText, SystemPens.ControlText, lineWidth, 0, captionRect, button);
return;
}
}
Rectangle rect;
if ((state & ButtonState.Checked)!=0) {
- graphics.FillRectangle(ResPool.GetHatchBrush (HatchStyle.Percent50, ColorButtonLight, ColorButtonHilight),rectangle);
+ graphics.FillRectangle(ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControlLightLight, ColorControlLight),rectangle);
}
if ((state & ButtonState.Flat)!=0) {
- ControlPaint.DrawBorder(graphics, rectangle, ColorButtonShadow, ButtonBorderStyle.Solid);
+ ControlPaint.DrawBorder(graphics, rectangle, ColorControlDark, ButtonBorderStyle.Solid);
} else {
if ((state & (ButtonState.Pushed | ButtonState.Checked))!=0) {
// this needs to render like a pushed button - jba
- // CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+ // CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl);
Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max (rectangle.Width-1, 0), Math.Max (rectangle.Height-1, 0));
- graphics.DrawRectangle (ResPool.GetPen (ControlPaint.Dark (ColorButtonFace)), trace_rectangle);
+ graphics.DrawRectangle (ResPool.GetPen (ControlPaint.Dark (ColorControl)), trace_rectangle);
} else {
- CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+ CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl);
}
}
int X;
int Y;
- graphics.FillRectangle(ResPool.GetSolidBrush (ColorButtonText), rect);
+ graphics.FillRectangle(ResPool.GetSolidBrush (ColorControlText), rect);
graphics.DrawRectangle(pen, rect);
X=rect.X+rect.Width/2;
/* Draw 'arrows' for horizontal lines */
graphics.DrawLine(pen, rect.X+3, Y-1, rect.X+3, Y+1);
graphics.DrawLine(pen, rect.Right-3, Y-1, rect.Right-3, Y+1);
+ pen.Dispose ();
}
Color outerColor = foreColor;
// adjust focus color according to the flatstyle
if (button.FlatStyle == FlatStyle.Popup && !button.is_pressed) {
- outerColor = (backColor == ColorButtonFace) ? ControlPaint.Dark(ColorButtonFace) : ColorButtonText;
+ outerColor = (backColor == ColorControl) ? ControlPaint.Dark(ColorControl) : ColorControlText;
}
// draw the outer rectangle
// make a rectange to trace around border of the button
Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max (rectangle.Width-1, 0), Math.Max (rectangle.Height-1, 0));
+#if NotUntilCairoIsFixed
Color colorBackInverted = Color.FromArgb (Math.Abs (backColor.R-255), Math.Abs (backColor.G-255), Math.Abs (backColor.B-255));
DashStyle oldStyle; // used for caching old penstyle
Pen pen = ResPool.GetPen (colorBackInverted);
-
+
oldStyle = pen.DashStyle;
pen.DashStyle = DashStyle.Dot;
+
graphics.DrawRectangle (pen, trace_rectangle);
pen.DashStyle = oldStyle;
+#else
+ CPDrawFocusRectangle(graphics, trace_rectangle, Color.Wheat, backColor);
+#endif
}
if (primary==true) {
pen=new Pen(Color.Black, 1);
if (enabled==true) {
- sb=ResPool.GetSolidBrush (ColorButtonText);
+ sb=ResPool.GetSolidBrush (ColorControlText);
} else {
- sb=ResPool.GetSolidBrush (ColorButtonFace);
+ sb=ResPool.GetSolidBrush (ColorControl);
}
} else {
pen=new Pen(Color.White, 1);
if (enabled==true) {
- sb=ThemeEngine.Current.ResPool.GetSolidBrush (Color.Black);
+ sb=ResPool.GetSolidBrush (Color.Black);
} else {
- sb=ResPool.GetSolidBrush (ColorButtonFace);
+ sb=ResPool.GetSolidBrush (ColorControl);
}
}
graphics.FillRectangle(sb, rectangle);
lineWidth=Math.Max(2, rectangle.Width/3);
rect=new Rectangle(rectangle.X+lineWidth, rectangle.Y+lineWidth, rectangle.Width-lineWidth*2, rectangle.Height-lineWidth*2);
- graphics.FillEllipse(ResPool.GetSolidBrush (ColorButtonText), rect);
+ graphics.FillEllipse(ResPool.GetSolidBrush (ColorControlText), rect);
return;
}
/* Scroll button: regular button + direction arrow */
public override void CPDrawScrollButton (Graphics dc, Rectangle area, ScrollButton type, ButtonState state) {
- bool enabled = (state == ButtonState.Inactive) ? false: true;
-
DrawScrollButtonPrimitive (dc, area, state);
-
- if (area.Width < 12 || area.Height < 12) /* Cannot see a thing at smaller sizes */
- return;
- /* Paint arrows */
- switch (type) {
- case ScrollButton.Up: {
- int x = area.X + (area.Width / 2) - 4;
- int y = area.Y + 9;
-
- for (int i = 0; i < 3; i++)
- if (enabled)
- dc.DrawLine (ResPool.GetPen (arrow_color), x + i, y - i, x + i + 6 - 2*i, y - i);
- else
- dc.DrawLine (ResPool.GetPen (ColorGrayText), x + i, y - i, x + i + 6 - 2*i, y - i);
-
-
- dc.FillRectangle (enabled ? ResPool.GetSolidBrush (arrow_color) : ResPool.GetSolidBrush (ColorGrayText),
- x + 3, area.Y + 6, 1, 1);
-
- break;
+ // A lot of the following is adapted from the rewind project
+ Rectangle rect = new Rectangle (area.X - 3, area.Y - 3,
+ area.Width + 6, area.Height + 6);
+ int small_diam = rect.Width > rect.Height ? rect.Height : rect.Width;
+ if (rect.Width < rect.Height) {
+ rect.Y += (rect.Height - rect.Width) / 2;
+ rect.Height = small_diam;
+ } else if (rect.Width > rect.Height) {
+ rect.X += (rect.Width - rect.Height) / 2;
+ rect.Width = small_diam;
}
- case ScrollButton.Down: {
- int x = area.X + (area.Width / 2) - 5;
- int y = area.Y + 5;
- for (int i = 4; i != 0; i--)
- if (enabled)
- dc.DrawLine (ResPool.GetPen (arrow_color), x + i, y + i, x + i + 8 - 2*i, y + i);
- else
- dc.DrawLine (ResPool.GetPen (ColorGrayText), x + i, y + i, x + i + 8 - 2*i, y + i);
+ small_diam -= 2;
-
- dc.FillRectangle (enabled ? ResPool.GetSolidBrush (arrow_color) : ResPool.GetSolidBrush (ColorGrayText),
- x + 4, y + 4, 1, 1);
- break;
- }
+ int tri = 290 * small_diam / 1000 - 1;
+ if (tri == 0)
+ tri = 1;
- case ScrollButton.Left: {
- int y = area.Y + (area.Height / 2) - 4;
- int x = area.X + 9;
+ Point [] arrow = new Point [3];
+ for (int i = 0; i < 3; i++)
+ arrow [i] = new Point ();
- for (int i = 0; i < 3; i++)
- if (enabled)
- dc.DrawLine (ResPool.GetPen (arrow_color), x - i, y + i, x - i, y + i + 6 - 2*i);
- else
- dc.DrawLine (ResPool.GetPen (ColorGrayText), x - i, y + i, x - i, y + i + 6 - 2*i);
-
- dc.FillRectangle (enabled ? ResPool.GetSolidBrush (arrow_color) : ResPool.GetSolidBrush (ColorGrayText),
- x - 3, y + 3, 1, 1);
+ switch(type) {
+ default:
+ case ScrollButton.Down:
+ arrow [2].X = rect.Left + 470 * small_diam / 1000 + 2;
+ arrow [2].Y = rect.Top + 687 * small_diam / 1000 + 1;
+ arrow [0].X = arrow [2].X - tri;
+ arrow [1].X = arrow [2].X + tri;
+ arrow [0].Y = arrow [1].Y = arrow [2].Y - tri;
break;
- }
- case ScrollButton.Right: {
- int y = area.Y + (area.Height / 2) - 5;
- int x = area.X + 5;
-
- for (int i = 4; i != 0; i--)
- if (enabled)
- dc.DrawLine (ResPool.GetPen (arrow_color), x + i, y + i, x + i, y + i + 8 - 2*i);
- else
- dc.DrawLine (ResPool.GetPen (ColorGrayText), x + i, y + i, x + i, y + i + 8 - 2*i);
+ case ScrollButton.Up:
+ arrow [2].X = rect.Left + 470 * small_diam / 1000 + 2;
+ arrow [2].Y = rect.Bottom - (687 * small_diam / 1000 + 1);
+ arrow [0].X = arrow [2].X - tri;
+ arrow [1].X = arrow [2].X + tri;
+ arrow [0].Y = arrow [1].Y = arrow [2].Y + tri;
+ break;
- dc.FillRectangle (enabled ? ResPool.GetSolidBrush (arrow_color) : ResPool.GetSolidBrush (ColorGrayText),
- x + 4, y + 4, 1, 1);
+ case ScrollButton.Left:
+ arrow [2].X = rect.Right - (687 * small_diam / 1000 + 1);
+ arrow [2].Y = rect.Top + 470 * small_diam / 1000 + 2;
+ arrow [0].Y = arrow [2].Y - tri;
+ arrow [1].Y = arrow [2].Y + tri;
+ arrow [0].X = arrow [1].X = arrow [2].X + tri;
+ break;
+ case ScrollButton.Right:
+ arrow [2].X = rect.Left + 687 * small_diam / 1000 + 1;
+ arrow [2].Y = rect.Top + 470 * small_diam / 1000 + 2;
+ arrow [0].Y = arrow [2].Y - tri;
+ arrow [1].Y = arrow [2].Y + tri;
+ arrow [0].X = arrow [1].X = arrow [2].X - tri;
break;
}
- default:
- break;
+ /* Draw the arrow */
+ if ((state & ButtonState.Inactive)!=0) {
+ dc.FillPolygon (SystemBrushes.ControlLightLight, arrow, FillMode.Winding);
+ for (int i = 0; i < 3; i++) {
+ arrow [i].X--;
+ arrow [i].Y--;
+ }
+
+ dc.FillPolygon (SystemBrushes.ControlDark, arrow, FillMode.Winding);
+ } else {
+ dc.FillPolygon (SystemBrushes.ControlText, arrow, FillMode.Winding);
}
}
-
public override void CPDrawSelectionFrame (Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect,
Color backColor) {
public override void CPDrawSizeGrip (Graphics dc, Color backColor, Rectangle bounds) {
Point pt = new Point (bounds.Right - 2, bounds.Bottom - 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonFace), pt.X - 12, pt.Y, pt.X, pt.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonFace), pt.X, pt.Y, pt.X, pt.Y - 13);
+ dc.DrawLine (ResPool.GetPen (ColorControl), pt.X - 12, pt.Y, pt.X, pt.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControl), pt.X, pt.Y, pt.X, pt.Y - 13);
// diagonals
for (int i = 0; i < 11; i += 4) {
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), pt.X - i, pt.Y, pt.X + 1, pt.Y - i - 2);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), pt.X - i - 1, pt.Y, pt.X + 1, pt.Y - i - 2);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), pt.X - i, pt.Y, pt.X + 1, pt.Y - i - 2);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), pt.X - i - 1, pt.Y, pt.X + 1, pt.Y - i - 2);
}
for (int i = 3; i < 13; i += 4)
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), pt.X - i, pt.Y, pt.X + 1, pt.Y - i - 1);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), pt.X - i, pt.Y, pt.X + 1, pt.Y - i - 1);
}
public override void CPDrawStringDisabled (Graphics graphics, string s, Font font, Color color, RectangleF layoutRectangle,
StringFormat format) {
- layoutRectangle.Offset(1.0f, 1.0f);
- graphics.DrawString(s, font, ResPool.GetSolidBrush (ControlPaint.Light(color, 95)), layoutRectangle, format);
- layoutRectangle.Offset(-1.0f, -1.0f);
- graphics.DrawString(s, font, ResPool.GetSolidBrush (ControlPaint.Light(color, 50)), layoutRectangle, format);
+ graphics.DrawString(s, font, ResPool.GetSolidBrush (ColorGrayText), layoutRectangle, format);
}
still look like MS's scaled caption buttons. (as opposed to scaling a bitmap)
*/
- private static void DrawCaptionHelper(Graphics graphics, Color color, Pen pen, int lineWidth, int shift, Rectangle captionRect, CaptionButton button) {
+ private void DrawCaptionHelper(Graphics graphics, Color color, Pen pen, int lineWidth, int shift, Rectangle captionRect, CaptionButton button) {
switch(button) {
case CaptionButton.Close: {
pen.StartCap=LineCap.Triangle;
sf.LineAlignment=StringAlignment.Center;
- graphics.DrawString("?", font, ThemeEngine.Current.ResPool.GetSolidBrush (color), captionRect.X+captionRect.Width/2+shift, captionRect.Y+captionRect.Height/2+shift+lineWidth/2, sf);
+ graphics.DrawString("?", font, ResPool.GetSolidBrush (color), captionRect.X+captionRect.Width/2+shift, captionRect.Y+captionRect.Height/2+shift+lineWidth/2, sf);
sf.Dispose();
font.Dispose();
// JBA 31 oct 2004 - I don't think that button style should be rendered like this
// /* Goes first, affects the background */
// if ((State & DrawFrameControlStates.Checked)!=0) {
-// HatchBrush hatchBrush=new HatchBrush(HatchStyle.Percent50, ColorButtonLight, ColorButtonHilight);
+// HatchBrush hatchBrush=new HatchBrush(HatchStyle.Percent50, ColorControlLightLight, ColorControlLight);
// graphics.FillRectangle(hatchBrush,rectangle);
// hatchBrush.Dispose();
// }
- // Clear the background
- graphics.FillRectangle (SystemBrushes.Control, rectangle);
-
if ((State & DrawFrameControlStates.Pushed)!=0 || (State & DrawFrameControlStates.Checked)!=0) {
- graphics.DrawRectangle (ResPool.GetPen (ControlPaint.Dark (ColorButtonFace)), trace_rectangle);
+ graphics.DrawRectangle (ResPool.GetPen (ControlPaint.Dark (ColorControl)), trace_rectangle);
} else if ((State & DrawFrameControlStates.Flat)!=0) {
- ControlPaint.DrawBorder(graphics, rectangle, ColorButtonShadow, ButtonBorderStyle.Solid);
+ ControlPaint.DrawBorder(graphics, rectangle, ColorControlDark, ButtonBorderStyle.Solid);
} else if ((State & DrawFrameControlStates.Inactive)!=0) {
/* Same as normal, it would seem */
- CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+ CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl);
} else {
- CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+ CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl);
}
} else if ((State & DrawFrameControlStates.ButtonRadio)!=0) {
- Pen penFatDark = new Pen(ColorButtonShadow, 1);
- Pen penFatLight = new Pen(ColorButtonLight, 1);
+ Pen penFatDark = new Pen(ColorControlDark, 1);
+ Pen penFatLight = new Pen(ColorControlLightLight, 1);
int lineWidth;
graphics.FillPie (ResPool.GetSolidBrush (this.ColorWindow), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
/* Draw the sunken frame */
if ((State & DrawFrameControlStates.Flat)!=0) {
- ControlPaint.DrawBorder(graphics, rectangle, ColorButtonShadow, ButtonBorderStyle.Solid);
+ ControlPaint.DrawBorder(graphics, rectangle, ColorControlDark, ButtonBorderStyle.Solid);
} else {
- CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+ CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl);
}
/* Make sure we've got at least a line width of 1 */
/* Generic scroll button */
public void DrawScrollButtonPrimitive (Graphics dc, Rectangle area, ButtonState state) {
if ((state & ButtonState.Pushed) == ButtonState.Pushed) {
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonFace), area.X + 1,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), area.X + 1,
area.Y + 1, area.Width - 2 , area.Height - 2);
- dc.DrawRectangle (ResPool.GetPen (ColorButtonShadow), area.X,
+ dc.DrawRectangle (ResPool.GetPen (ColorControlDark), area.X,
area.Y, area.Width, area.Height);
return;
}
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonFace), area.X, area.Y, area.Width, 1);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonFace), area.X, area.Y, 1, area.Height);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), area.X, area.Y, area.Width, 1);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), area.X, area.Y, 1, area.Height);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonHilight), area.X + 1, area.Y + 1, area.Width - 1, 1);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonHilight), area.X + 1, area.Y + 2, 1,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlLight), area.X + 1, area.Y + 1, area.Width - 1, 1);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlLight), area.X + 1, area.Y + 2, 1,
area.Height - 4);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonShadow), area.X + 1, area.Y + area.Height - 2,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDark), area.X + 1, area.Y + area.Height - 2,
area.Width - 2, 1);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonDkShadow), area.X, area.Y + area.Height -1,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDarkDark), area.X, area.Y + area.Height -1,
area.Width , 1);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonShadow), area.X + area.Width - 2,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDark), area.X + area.Width - 2,
area.Y + 1, 1, area.Height -3);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonDkShadow), area.X + area.Width -1,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDarkDark), area.X + area.Width -1,
area.Y, 1, area.Height - 1);
- dc.FillRectangle (ResPool.GetSolidBrush (ColorButtonFace), area.X + 2,
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), area.X + 2,
area.Y + 2, area.Width - 4, area.Height - 4);
}
public override void CPDrawBorderStyle (Graphics dc, Rectangle area, BorderStyle border_style) {
switch (border_style){
case BorderStyle.Fixed3D:
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), area.X, area.Y, area.X +area.Width, area.Y);
- dc.DrawLine (ResPool.GetPen (ColorButtonShadow), area.X, area.Y, area.X, area.Y + area.Height);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), area.X , area.Y + area.Height - 1, area.X + area.Width ,
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), area.X, area.Y, area.X +area.Width, area.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), area.X, area.Y, area.X, area.Y + area.Height);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), area.X , area.Y + area.Height - 1, area.X + area.Width ,
area.Y + area.Height - 1);
- dc.DrawLine (ResPool.GetPen (ColorButtonHilight), area.X + area.Width -1 , area.Y, area.X + area.Width -1,
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), area.X + area.Width -1 , area.Y, area.X + area.Width -1,
area.Y + area.Height);
dc.DrawLine (ResPool.GetPen (ColorActiveBorder), area.X + 1, area.Bottom - 2, area.Right - 2, area.Bottom - 2);
dc.DrawLine (ResPool.GetPen (ColorActiveBorder), area.Right - 2, area.Top + 1, area.Right - 2, area.Bottom - 2);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), area.X + 1, area.Top + 1, area.X + 1, area.Bottom - 3);
- dc.DrawLine (ResPool.GetPen (ColorButtonDkShadow), area.X + 1, area.Top + 1, area.Right - 3, area.Top + 1);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), area.X + 1, area.Top + 1, area.X + 1, area.Bottom - 3);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), area.X + 1, area.Top + 1, area.Right - 3, area.Top + 1);
break;
case BorderStyle.FixedSingle:
dc.DrawRectangle (ResPool.GetPen (ColorWindowFrame), area.X, area.Y, area.Width - 1, area.Height - 1);