}
/* 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);
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);
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)) {
#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);
- Rectangle client_area_nohdrs;
- DrawListViewHeader (dc, clip, control);
-
- if (details && control.HeaderStyle != ColumnHeaderStyle.None && control.Columns.Count > 0) {
- client_area_nohdrs = control.client_area;
- client_area_nohdrs.Y += control.Columns[0].Ht;
- client_area_nohdrs.Height -= control.Columns[0].Ht;
- dc.SetClip (client_area_nohdrs);
- } else
- dc.SetClip (control.client_area);
-
+ bool details = control.View == View.Details;
+
dc.FillRectangle (ResPool.GetSolidBrush (control.BackColor), clip);
-
- // In case of details view draw the items only if
- // columns are non-zero
- if (!details || control.Columns.Count > 0) {
- 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]);
- }
+ 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
}
- private void DrawListViewHeader (Graphics dc, Rectangle clip, ListView control)
+ public override void DrawListViewHeader (Graphics dc, Rectangle clip, ListView control)
{
bool details = (control.View == View.Details);
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);
}
}
+ 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
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);
increment = block_width + space_betweenblocks;
/* Draw border */
- CPDrawBorder3D (dc, ctrl.ClientRectangle, Border3DStyle.SunkenInner, Border3DSide.All & ~Border3DSide.Middle, ColorControl);
+ 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);
protected virtual void RadioButton_DrawText(RadioButton radio_button, Rectangle text_rectangle, Graphics dc, StringFormat text_format)
{
- SolidBrush sb;
-
// 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, 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.ColorControl)), text_rectangle, text_format);
} else {
Border3DStyle border_style = Border3DStyle.SunkenInner;
if (panel.BorderStyle == StatusBarPanelBorderStyle.Raised)
border_style = Border3DStyle.RaisedOuter;
- CPDrawBorder3D(dc, area, border_style, Border3DSide.All, panel.Parent.BackColor);
+ CPDrawBorder3D(dc, area, border_style, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, panel.Parent.BackColor);
}
if (panel.Style == StatusBarPanelStyle.OwnerDraw) {
}
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);
return res;
}
- if (page.Focused) {
+ if (page.parent.Focused && is_selected) {
CPDrawFocusRectangle (dc, interior, tab.ForeColor, tab.BackColor);
}
/* 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, ColorControl);
+ CPDrawBorder3D (dc, buttonArea, Border3DStyle.SunkenOuter, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, ColorControl);
} else if (button.Hilight) {
dc.DrawRectangle (ResPool.GetPen (ColorControlText), buttonArea);
if (! ddRect.IsEmpty) {
else { // normal toolbar
if (button.Pushed || button.Pressed) {
CPDrawBorder3D (dc, buttonArea, Border3DStyle.SunkenInner,
- Border3DSide.All, ColorControl);
+ Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, ColorControl);
if (! ddRect.IsEmpty) {
CPDrawBorder3D (dc, ddRect, Border3DStyle.SunkenInner,
Border3DSide.Left, ColorControl);
}
else {
CPDrawBorder3D (dc, buttonArea, Border3DStyle.RaisedInner,
- Border3DSide.All, ColorControl);
+ Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, ColorControl);
if (! ddRect.IsEmpty) {
CPDrawBorder3D (dc, ddRect, Border3DStyle.RaisedInner,
Border3DSide.Left, ColorControl);
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) {
/* 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;