Devexpress Checkbutton Blueline border - how to remove - c#

I am currently working on a devexpress project and I am using the checkbutton tool. I have it doing everything I want except for a very annoying sick looking blueline that shows up on appearance.hover and appearance.pressed.
If anything at all I would expect a color that goes with the theme but a constant blueline no matter what skin is selected is annoying and feels like an old html design.
I have tried setting the bordercolor and all but still.
Below is my code of what I have tried by far from form.Designer.cs;
this.cBtnFilter.AllowFocus = false;
this.cBtnFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cBtnFilter.AppearanceDisabled.Options.UseBackColor = true;
this.cBtnFilter.AppearanceHovered.BorderColor = System.Drawing.Color.White;
this.cBtnFilter.AppearanceHovered.Options.UseBackColor = true;
this.cBtnFilter.AppearanceHovered.Options.UseBorderColor = true;
this.cBtnFilter.AppearancePressed.BorderColor = System.Drawing.Color.White;
this.cBtnFilter.AppearancePressed.Options.UseBackColor = true;
this.cBtnFilter.AppearancePressed.Options.UseBorderColor = true;
this.cBtnFilter.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.False;
this.cBtnFilter.ImageOptions.Location = DevExpress.XtraEditors.ImageLocation.MiddleCenter;
this.cBtnFilter.ImageOptions.SvgImage = global::form.Properties.Resources.icon_filter;
this.cBtnFilter.ImageOptions.SvgImageSize = new System.Drawing.Size(40, 40);
this.cBtnFilter.Location = new System.Drawing.Point(355, 40);
this.cBtnFilter.LookAndFeel.SkinName = "The Bezier";
this.cBtnFilter.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.UltraFlat;
this.cBtnFilter.LookAndFeel.UseDefaultLookAndFeel = false;
this.cBtnFilter.Name = "cBtnFilter";
this.cBtnFilter.PaintStyle = DevExpress.XtraEditors.Controls.PaintStyles.Light;
this.cBtnFilter.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.cBtnFilter.Size = new System.Drawing.Size(50, 50);
toolTipTitleItem4.Text = "Show active Only";
superToolTip4.Items.Add(toolTipTitleItem4);
this.cBtnFilter.SuperTip = superToolTip4;
this.cBtnFilter.TabIndex = 39;
this.cBtnFilter.Click += new System.EventHandler(this.Filter_Click);
The attached image is an example of when it is selected and when it is hovered respectively.
At the least if I could completely remove the blue line or change it to the theme color. It would be great.
Am using Devexpress Version 20.2.4

how I solved this is by using the simple button instead and making it act like a toggle button.
this method handles the toggle for me
public Boolean buttonState = false;
private void ToggleButton()
{
if (buttonState)
{
simpleButton.Appearance.BackColor = Color.Red;
buttonState = false;
}
else
{
simpleButton.Appearance.BackColor = Color.White;
buttonState = true;
}
}
this is the button
private void simpleButton_Click(object sender, EventArgs e)
{
ToggleButton();
}
here is the button in Designer.cs
this.simpleButton1.AllowFocus = false;
this.simpleButton1.AppearanceHovered.BackColor = System.Drawing.Color.Teal;
this.simpleButton1.AppearanceHovered.Options.UseBackColor = true;
this.simpleButton1.Location = new System.Drawing.Point(524, 214);
this.simpleButton1.LookAndFeel.SkinName = "The Bezier";
this.simpleButton1.LookAndFeel.UseDefaultLookAndFeel = false;
this.simpleButton1.Name = "simpleButton1";
this.simpleButton1.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.simpleButton1.Size = new System.Drawing.Size(157, 150);
this.simpleButton1.TabIndex = 2;
this.simpleButton1.Text = "simpleButton";
this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click);
Its quite straightforward. In case anyone has a better way or has need for this, knock yourself(ves) out.
Hopefully in the future, Devexpress will not force blue borders on us.

Related

Cursor = Cursors.None for popup in code

Im trying to set the cursor to none in code for a popup but I cant get it to work. The cursor is still shown when it is over the popup. What am I doing wrong?
public void SubWindow_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
TextBlock popupText = new TextBlock();
popupText.Text = "Complete" ;
popupText.Background = Brushes.Transparent;
popupText.Foreground = Brushes.White;
popupText.Width = 130;
popupText.FontSize = 30;
popupText.IsHitTestVisible = false;
popupText.Cursor = Cursors.None;
Popup Popup = new Popup();
Popup.AllowsTransparency = true;
Popup.PlacementRectangle = new Rect(1086, 16, 0, 0);
Popup.IsHitTestVisible = false;
Popup.Cursor = Cursors.None;
Popup_Text.Child = popupText;
Popup.IsOpen = true;
}
Don't set the IsHitTestVisible property of the TextBlock to false:
TextBlock popupText = new TextBlock();
popupText.Text = "Complete";
popupText.Background = Brushes.Transparent;
popupText.Foreground = Brushes.White;
popupText.Width = 130;
popupText.Height = 130;
popupText.FontSize = 30;
//popupText.IsHitTestVisible = false;
popupText.Cursor = Cursors.None;
Popup Popup = new Popup();
//Popup.AllowsTransparency = true;
Popup.PlacementRectangle = new Rect(1086, 16, 0, 0);
Popup.IsHitTestVisible = false;
Popup.Cursor = Cursors.None;
Popup.Child = popupText;
Popup.IsOpen = true;
Also note that your app can only change the cursor when the cursor is actually over one of your app's elements. The "background" of a transparent Popup does not belong to your application so Cursors.None will only apply when you move the mouse pointer over the actual text in the TextBlock.

Editable datagrid in windows mobile compact framework c#

So I am trying to add editable column to datagrid. I followed msdn sample at http://msdn.microsoft.com/en-us/library/ms838165.aspx
which works, up to a point when I'm trying to type in data to the textbox, which kinda defies the whole point. I tried to set focus() property to the textbox, yet no results.
I'm using compact framework 3.5.
150 lines of code can be found here, if someone is willing to try it - http://pastebin.com/08bz8scH
Can you please tell what am i doing wrong? Here is important code sample:
private void dataGrid1_CurrentCellChanged(object sender, EventArgs e)
{
if (!inUpdateMode)
{
if (inEditMode && !dataGrid1.CurrentCell.Equals(editCell))
{
// Update edited cell
inUpdateMode = true;
dataGrid1.Visible = false;
DataGridCell currentCell = dataGrid1.CurrentCell;
dataGrid1[editCell.RowNumber, editCell.ColumnNumber] =
txtEdit.Text;
dataGrid1.CurrentCell = currentCell;
dataGrid1.Visible = true;
inUpdateMode = false;
txtEdit.Visible = false;
inEditMode = false;
bool ff = dataGrid1.TableStyles.IsReadOnly;
}
// Enter edit mode
editCell = dataGrid1.CurrentCell;
txtEdit.Text = ""; //(string)dataGrid1[editCell.RowNumber,editCell.ColumnNumber];
System.Drawing.Rectangle cellPos = dataGrid1.GetCellBounds(editCell.RowNumber,
editCell.ColumnNumber);
txtEdit.Left = cellPos.Left ;
txtEdit.Top = cellPos.Top + dataGrid1.Top ;
txtEdit.Width = cellPos.Width ;
txtEdit.Height = cellPos.Height ;
txtEdit.Visible = true;
txtEdit.Focus();
inEditMode = true;
}
}

Rectangle is showing after clicking on text or checkbox

I have a window application that has some checkboxes. These checkboxes has a image and appearance is set to button.
My problem is when I click on checkbox, a rectangle appears around the checkbox as shown below. I am not getting what property should I set for avoiding this rectangle.
this.chkboxReportSelect.Appearance = System.Windows.Forms.Appearance.Button;
this.chkboxReportSelect.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(221)))), ((int)(((byte)(228)))));
this.chkboxReportSelect.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(221)))), ((int)(((byte)(228)))));
this.chkboxReportSelect.FlatAppearance.BorderSize = 0;
this.chkboxReportSelect.FlatAppearance.CheckedBackColor = System.Drawing.Color.Transparent;
this.chkboxReportSelect.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
this.chkboxReportSelect.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
this.chkboxReportSelect.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.chkboxReportSelect.Image = global::M3.AKFRW.UI.Properties.Resources.checkmark;
this.chkboxReportSelect.Location = new System.Drawing.Point(3, 3);
this.chkboxReportSelect.Name = "chkboxReportSelect";
this.chkboxReportSelect.Size = new System.Drawing.Size(124, 24);
this.chkboxReportSelect.TabIndex = 27;
this.chkboxReportSelect.Text = "Select Report ";
this.chkboxReportSelect.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.chkboxReportSelect.UseCompatibleTextRendering = true;
this.chkboxReportSelect.UseVisualStyleBackColor = false;
I assue you are using FlatStyle. Rectangle you see is the FlatStyle's border, you can get rid of it by setting BorderSize of FlatAppearance to 0
checkbox.FlatAppearance.BorderSize = 0;

Customize double click for text box

private void newThumbNail(int docType, string fileName)
{
thmbNail[thmbNailCnt] = new GroupBox();
thmbNail[thmbNailCnt].Parent = panel1;
thmbNail[thmbNailCnt].Visible = true;
thmbNail[thmbNailCnt].Location = new Point(2, 5 + ((thmbNailCnt * 50) + 2));
thmbNail[thmbNailCnt].Size = new Size(222, 50);
picBox[thmbNailCnt] = new PictureBox();
picBox[thmbNailCnt].Parent = thmbNail[thmbNailCnt];
picBox[thmbNailCnt].Visible = true;
picBox[thmbNailCnt].Location = new Point(6, 13);
picBox[thmbNailCnt].Size = new Size(31, 31);
switch (docType)
{
case 1: picBox[thmbNailCnt].Image = wordImg;
break;
case 2: picBox[thmbNailCnt].Image = pptImg;
break;
case 3: picBox[thmbNailCnt].Image = excelImg;
break;
case 4: picBox[thmbNailCnt].Image = pdfImg;
break;
}
texBox[thmbNailCnt] = new TextBox();
texBox[thmbNailCnt].Parent = thmbNail[thmbNailCnt];
texBox[thmbNailCnt].Visible = true;
texBox[thmbNailCnt].Location = new Point(53, 24);
texBox[thmbNailCnt].Size = new Size(163, 20);
texBox[thmbNailCnt].Text = fileName;
texBox[thmbNailCnt].Enabled = false;
texBox[thmbNailCnt].BackColor = Color.Silver;
texBox[thmbNailCnt].ForeColor = Color.Black;
texBox[thmbNailCnt].DoubleClick += new System.EventHandler(changeText);
thmbNailFN[thmbNailCnt] = fileName;
data[thmbNailCnt, 0] = fileName;
data[thmbNailCnt, 1] = docType.ToString();
thmbNail[thmbNailCnt].Controls.Add(picBox[thmbNailCnt]);
thmbNail[thmbNailCnt].Controls.Add(texBox[thmbNailCnt]);
thmbNailCnt++;
}
private void changeText(object sender, EventArgs e)
{
this.Enabled = true;
}
The private void newThumbNail, adds a group box with picture box and text box as its elements. I have customize a double click event for the text Box, unfortunately it does not executes. Why is that so?
Your event won't fire because the TextBox is disabled. However I think the the solution might be a redesign of your interface since it is not expected behaviour for a control to be enabled when double-clicked. The whole point of disabling a control is to prevent a user from interacting with it.
Perhaps setting it to readonly might be a better option? That way it will still fire events.
The DoubleClick event will not fire on the TextBox if it is not enabled. So, it will not work because you are doing this:
texBox[thmbNailCnt].Enabled = false;
I presume you meant to do the following in the double click handler (instead of using this)
(sender as TextBox).Enabled = true;
You must be trying to make the textbox enable itself with a double click?
If so, then you can't use the Enabled property because the click events will not fire while your textbox is disabled.
Instead, you can use the ReadOnly property which will prevent the user from making any changes to the text:
texBox[thmbNailCnt].ReadOnly = true;
and
private void changeText(object sender, EventArgs e)
{
(sender as TextBox).ReadOnly = false;
}
This will not give it the dimmed out look it has when it is disabled. You could make some aditional changes to get it looking the same though if you wanted.

Why do my X-Axes labels disappear when I zoom using MS Chart Controls?

I'm using MS Chart Controls. The line chart is a normal time based chart. The problem is when I click the chart and select some time it zooms in, the scrollbar appears, and the x-axes labels disappears. How can I prevent this from happening? If I cannot fix it automatically, is there code I can add to a button that will fix the labels?
private void Chart0Configuration()
{
chart1.ChartAreas[0].Visible = false;
chart1.ChartAreas[0].AlignmentOrientation = AreaAlignmentOrientations.Vertical;
chart1.ChartAreas[0].AlignmentStyle = AreaAlignmentStyles.All;
chart1.ChartAreas[0].Position.Auto = false;
chart1.ChartAreas[0].Position.X = 2;
chart1.ChartAreas[0].Position.Y = 10;
chart1.ChartAreas[0].Position.Width = 98;
//chart1.ChartAreas[0].Position.Height = *****variable
//chart1.ChartAreas[0].AxisY.MajorTickMark.Enabled = false;
//chart1.ChartAreas[0].AxisY.MinorTickMark.Enabled = false;
//chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false;
//chart1.ChartAreas[0].AxisX.MajorTickMark.Enabled = true;
//chart1.ChartAreas[0].AxisX.MinorTickMark.Enabled = true;
//chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = true;
//chart1.ChartAreas[0].AxisX.MajorTickMark.Interval = 10;
chart1.ChartAreas[0].AxisX.Interval = 0;
chart1.ChartAreas[0].AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;
chart1.ChartAreas[0].AxisX.LabelStyle.Enabled = true;
//chart1.ChartAreas[0].AxisX.LabelStyle.Format = "hh:mm:ss";
chart1.ChartAreas[0].AxisY.LabelStyle.IsEndLabelVisible = true;
chart1.ChartAreas[0].InnerPlotPosition.Auto = false;
chart1.ChartAreas[0].InnerPlotPosition.X = 3;
chart1.ChartAreas[0].InnerPlotPosition.Y = 10;
chart1.ChartAreas[0].InnerPlotPosition.Width = 88;
chart1.ChartAreas[0].InnerPlotPosition.Height = 80;
chart1.ChartAreas[0].CursorX.IsUserEnabled = true;
chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
//chart1.ChartAreas[0].CursorX.AutoScroll = true;
chart1.ChartAreas[0].CursorX.Position = 0;
chart1.ChartAreas[0].CursorX.Interval = 0;
chart1.ChartAreas[0].AxisX.ScrollBar.Size = 5;
chart1.ChartAreas[0].AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll;
chart1.ChartAreas[0].AxisX.ScrollBar.IsPositionedInside = true;
chart1.ChartAreas[0].AxisX.ScrollBar.BackColor = Color.LightGray;
chart1.ChartAreas[0].AxisX.ScrollBar.ButtonColor = Color.Gray;
chart1.ChartAreas[0].AxisX.ScrollBar.LineColor = Color.Black;
chart1.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
}
I inadvertently found the answer when looking at the intervals. They stay visible now that I've add the following line of code.
chart1.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Days;

Categories