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;
Related
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.
I set this to make the scrollbar invisble to my tablelayoutpanel:
tableLayoutPanel1.AutoScroll = false;
tableLayoutPanel1.HorizontalScroll.Visible = false;
tableLayoutPanel1.HorizontalScroll.Maximum = 0;
tableLayoutPanel1.VerticalScroll.Maximum = 0;
tableLayoutPanel1.VerticalScroll.Visible = false;
tableLayoutPanel1.AutoScroll = true;
How Can I set to button click scrolling to right and left?
I tried this:
int change = tableLayoutPanel1.HorizontalScroll.Value + tableLayoutPanel1.HorizontalScroll.SmallChange * 40; tableLayoutPanel1.AutoScrollPosition = new Point(change, 0);
but it's scrolled only once time.
Do it this way instead:
int change = tableLayoutPanel1.HorizontalScroll.SmallChange * 40;
tableLayoutPanel1.AutoScrollPosition = new Point(Math.Abs(tableLayoutPanel1.AutoScrollPosition.X) + change , 0);
We need Math.Abs() since the values returned by AutoScrollPosition are negative.
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.
Hello I am having a hard time understanding how to get my column chart to be centered over the X-Axis label. IN the chart pic below you will see that I have columns based on 1/2 increments. For my positive series the data starts on the left and ends at the x-axis label. On my negative series the data starts at the x-axis label and continues to the right. How do I get these columns centered over the x-axis label. I don't understand why one series is displayed one way and the other series is displayed a different way.
Screen shot here:
http://i.imgur.com/QuAXUxr.png
Code is below
chartAreaDistributionHalfHour.Name = "ChartAreaDistributionHalfHour";
chartAreaDistributionHalfHour.AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray;
chartAreaDistributionHalfHour.AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray;
chartAreaDistributionHalfHour.AxisX.IntervalAutoMode = System.Windows.Forms.DataVisualization.Charting.IntervalAutoMode.VariableCount;
chartAreaDistributionHalfHour.AxisY.IntervalAutoMode = System.Windows.Forms.DataVisualization.Charting.IntervalAutoMode.VariableCount;
chartAreaDistributionHalfHour.AxisX.LabelAutoFitMaxFontSize = 7;
chartAreaDistributionHalfHour.AxisY.LabelAutoFitMaxFontSize = 7;
chartAreaDistributionHalfHour.AxisX.Title = "Distribution (Half-Hourly)";
chartAreaDistributionHalfHour.AxisY.Title = "Profit/Loss ($)";
chartAreaDistributionHalfHour.AxisY.IsMarginVisible = false;
seriesDistributionHalfHour.ChartArea = "ChartAreaDistributionHalfHour";
seriesDistributionHalfHour.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
seriesDistributionHalfHour.Color = System.Drawing.Color.Green;
seriesDistributionHalfHour.Enabled = true;
seriesDistributionHalfHour.Name = "distributionHalfHour";
seriesDistributionHalfHourNegative.ChartArea = "ChartAreaDistributionHalfHour";
seriesDistributionHalfHourNegative.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
seriesDistributionHalfHourNegative.Color = System.Drawing.Color.Red;
seriesDistributionHalfHourNegative.Enabled = true;
seriesDistributionHalfHourNegative.Name = "netLossDistributionHalfHour";
seriesDistributionHalfHourZeroLine.ChartArea = "ChartAreaDistributionHalfHour";
seriesDistributionHalfHourZeroLine.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
seriesDistributionHalfHourZeroLine.BorderDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash;
seriesDistributionHalfHourZeroLine.Color = System.Drawing.Color.Black;
seriesDistributionHalfHourZeroLine.Enabled = true;
seriesDistributionHalfHourZeroLine.Name = "netDistributionHalfHourZeroLine";
this.chartDistributionHalfHourGraph.Location = new System.Drawing.Point(17, 49);
this.chartDistributionHalfHourGraph.Name = "chartDistributionHalfHourGraph";
this.chartDistributionHalfHourGraph.BorderlineColor = System.Drawing.Color.Black;
this.chartDistributionHalfHourGraph.BorderlineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Solid;
this.chartDistributionHalfHourGraph.Cursor = System.Windows.Forms.Cursors.Cross;
this.chartDistributionHalfHourGraph.Visible = false;
this.chartDistributionHalfHourGraph.Size = new System.Drawing.Size(1443, 694);
this.chartDistributionHalfHourGraph.TabIndex = 7;
this.chartDistributionHalfHourGraph.Text = "chart2";
this.chartDistributionHalfHourGraph.ChartAreas.Add(chartAreaDistributionHalfHour);
this.chartDistributionHalfHourGraph.Series.Add(seriesDistributionHalfHour);
this.chartDistributionHalfHourGraph.Series.Add(seriesDistributionHalfHourNegative);
this.chartDistributionHalfHourGraph.Series.Add(seriesDistributionHalfHourZeroLine);
I have a few tablelayoutpanels in my program in order to lay out different controls in rows. Until recently these were all working correctly, but after a change in server this is no longer the case. A potential cause is a change in screen resolution as I noticed similar problems on other computers running my program.
An example of this problem is shown below
Before the data rows are loaded (from database), the sizing is incorrect. A measurement using the VS designer shows that the size in figure 2 is correct. Interestingly, if I add a blank row to this table then the resizing doesn't happen.
public JobOpMainTable()
{
DoubleBuffered = true;
AutoSize = true;
AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
DoubleBuffered = true;
BackColor = Color.White;
CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
headers();
}
private void headers()
{
string[] names = { "Operation", "Est Lab Hrs", "Est UM Hrs", "Act Lab Hrs", "Act UM Hrs" };
for (int i = 0; i < names.Length; i++) header(names[i], i);
}
private void header(string name, int col)
{
Panel pan = new Panel();
pan.Width = widths[col];
pan.Height = 25;
pan.BackColor = Color.Black;
pan.Dock = DockStyle.Fill;
pan.Margin = new System.Windows.Forms.Padding(0);
TextBox txt = new TextBox();
txt.Font = new System.Drawing.Font("Microsoft sans serif", 8, FontStyle.Bold);
txt.Text = name;
txt.ReadOnly = true;
txt.BackColor = Color.Black;
txt.ForeColor = Color.White;
txt.Dock = DockStyle.Fill;
txt.BorderStyle = System.Windows.Forms.BorderStyle.None
pan.Controls.Add(txt);
Controls.Add(pan, col, 0);
}
private int newRow()
{
int row = Controls.Count / 5;
for (int i = 0; i <= 4; i++)
{
TextBox txt = new TextBox();
txt.Width = widths[i];
txt.BackColor = Color.White;
txt.BorderStyle = System.Windows.Forms.BorderStyle.None;
txt.ReadOnly = true;
txt.Dock = DockStyle.Fill;
txt.Margin = new Padding(0);
txt.Enter += new EventHandler(enterCell);
txt.Leave += new EventHandler(leaveCell);
Controls.Add(txt, i, row);
}
return row;
}
Above is the code I believe is relevant to the problem. The resizing occurs the first time newRow() is called when loading in data: each new box makes the column wider. Again though, the odd thing is this doesn't occur if I add a row from the constructor