I have migrated my application to DevExpress 15.2.I am getting my DevExpress.XtraEditors.CheckedComboBoxEdit items are displaying in bold.I have set following properties.Please let me know if I missed any property.I tried with Font property but selected Item is only changing not all the Items.
this.cmbTemplates.Location = new System.Drawing.Point(503, 618);
this.cmbTemplates.Name = "cmbTemplates";
this.cmbTemplates.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.cmbTemplates.Properties.SelectAllItemCaption = "Select All";
this.cmbTemplates.Size = new System.Drawing.Size(259, 20);
this.cmbTemplates.TabIndex = 93;
Try this :
cmbTemplates.Properties.AppearanceDropDown.Font = new
Font(cmbTemplates.Properties.AppearanceDropDown.Font, FontStyle.Regular);
Related
I am trying to make a TextBox locked by using OpenXML SDK. I've tried this method but the TextBox NoTextEdit is not working.
public DocumentFormat.OpenXml.Presentation.Shape GenerateShape(string StrText)
{
DocumentFormat.OpenXml.Presentation.Shape shape1 = new DocumentFormat.OpenXml.Presentation.Shape();
DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties nonVisualShapeProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties();
DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties nonVisualDrawingProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)3U, Name = "ID",Hidden=true ,Description="Do not Remove" ,MCAttributes=null };
DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties nonVisualShapeDrawingProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties();
Drawing.ShapeLocks shapeLocks1 = new Drawing.ShapeLocks() { NoTextEdit = true, NoGrouping = true,NoMove=true,NoSelection=true,NoEditPoints=true ,NoAdjustHandles=true ,NoRotation=true,NoChangeArrowheads=true,NoChangeAspect=true,NoChangeShapeType=true,NoResize=true};
nonVisualShapeDrawingProperties1.Append(shapeLocks1);
ApplicationNonVisualDrawingProperties applicationNonVisualDrawingProperties1 = new ApplicationNonVisualDrawingProperties();
PlaceholderShape placeholderShape1 = new PlaceholderShape() { Type = PlaceholderValues.SubTitle, Index = (UInt32Value)1U };
applicationNonVisualDrawingProperties1.Append(placeholderShape1);
nonVisualShapeProperties1.Append(nonVisualDrawingProperties1);
nonVisualShapeProperties1.Append(nonVisualShapeDrawingProperties1);
nonVisualShapeProperties1.Append(applicationNonVisualDrawingProperties1);
DocumentFormat.OpenXml.Presentation.ShapeProperties shapeProperties1 = new DocumentFormat.OpenXml.Presentation.ShapeProperties();
DocumentFormat.OpenXml.Presentation.TextBody textBody1 = new DocumentFormat.OpenXml.Presentation.TextBody();
Drawing.BodyProperties bodyProperties1 = new Drawing.BodyProperties();
Drawing.ListStyle listStyle1 = new Drawing.ListStyle();
Drawing.TextShape shp = new Drawing.TextShape();
Drawing.Paragraph paragraph1 = new Drawing.Paragraph();
Drawing.EndParagraphRunProperties endParagraphRunProperties1 = new Drawing.EndParagraphRunProperties() { Language = "en-US" ,Dirty=false };
paragraph1.Append(GenerateRun(StrText));
paragraph1.Append(endParagraphRunProperties1);
textBody1.Append(bodyProperties1);
textBody1.Append(listStyle1);
textBody1.Append(paragraph1);
shape1.Append(nonVisualShapeProperties1);
shape1.Append(shapeProperties1);
shape1.Append(textBody1);
return shape1;
}
public Drawing.Run GenerateRun(string StrText)
{
Drawing.Run run1 = new Drawing.Run();
Drawing.RunProperties runProperties1 = new Drawing.RunProperties() { Language = "en-US", Dirty = false };
runProperties1.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
Drawing.Text text1 = new Drawing.Text();
text1.Text = StrText;
Drawing.SolidFill solidFill2 = new Drawing.SolidFill();
Drawing.SchemeColor schemeColor = new Drawing.SchemeColor();
string y = System.Drawing.Color.Transparent.ToArgb().ToString("X");
Drawing.RgbColorModelHex rgbColorModelHex2 = new Drawing.RgbColorModelHex() { Val = "FFFFFF" };//Set Font-Color to Blue (Hex "0070C0").
solidFill2.Append(rgbColorModelHex2);
runProperties1.Append(solidFill2);
Color color = new Color() { Val = "365F91", ThemeColor = ThemeColorValues.Accent1, ThemeShade = "BF" };
run1.Append(runProperties1);
run1.Append(text1);
return run1;
}
Everything works fine except editing. Still the user can edit the TextBox values by double clicking it. How can I avoid this ?
Is there any permanent solution to prevent editing ? Please help me to find a better solution.
Thanks in advance
By researching and communications with the MVP team I've pointed out that there is no way to Protect the TextBox from editing.
As Cindy Meister mentioned in the comments,
Are you able to do it in the PowerPoint application user interface? If not, then Open XML cannot do it... If yes, you can.
If you do not want to text to be changed , Just change it as image then lock that by using NoSelection=true/1 and NoMove=true/1 properties. If you enable these properties the user can't either delete nor change it's position.
For your ref: https://answers.microsoft.com/en-us/msoffice/forum/msoffice_powerpoint-mso_windows8-mso_2016/shape-lock-is-not-working/c1705b55-d2aa-4adb-b538-574ed2fc8eca?tm=1579265435636&page=1&rtAction=1579495439869
im really new to c# and Xamarin Forms but can someone please explain to me why I'm getting an error in the last line of code below ?
Visual Studio is indicating a curly red underline on the word Children on the last line of this code indicating that there is some syntax error but I don't see why that is an error since I'm just accessing a member of the class ....
var content = new ContentPage();
content.Title = "Appuler";
Label CompanyName = new Label();
CompanyName.HorizontalTextAlignment = TextAlignment.Center;
CompanyName.Text = "Test";
Button NextPage = new Button();
NextPage.Text = "Next Page";
NextPage.Font = Font.SystemFontOfSize(NamedSize.Large);
NextPage.BorderWidth = 1;
NextPage.HorizontalOptions = LayoutOptions.Center;
NextPage.VerticalOptions = LayoutOptions.CenterAndExpand;
content.Content = new StackLayout();
content.Content.VerticalOptions = LayoutOptions.CenterAndExpand;
content.Content.Children.Add(CompanyName);
Refactor the last few lines to the following
var layout = new StackLayout();
layout.VerticalOptions = LayoutOptions.CenterAndExpand;
layout.Children.Add(CompanyName);
content.Content = layout;
ContentPage.Content does not have that Children property as it is a View. StackLayout, however does have a Children property that can be accessed.
populate the layout control's accessible properties and then assign it to the Content property of the ContentPage.
I am pragmatically creating TabPage with DataGridView. The TabPage's are appearing correctly, but they are missing the DataGridView. Anyone able to discern why they DGV's are not appearing with the tabs? The LoadDataGridToTab is in the correct form. It is being called from another Form though. Should?
public void LoadDataGridToTab(Main main, string category)
{
try
{
//Set Cell Style
var dataGridViewCellStyle = new DataGridViewCellStyle
{
Alignment = DataGridViewContentAlignment.MiddleLeft,
BackColor = SystemColors.Control,
Font = new Font("Microsoft Sans Serif", 8.25F,
FontStyle.Regular, GraphicsUnit.Point, 0),
ForeColor = SystemColors.WindowText,
SelectionBackColor = SystemColors.Highlight,
SelectionForeColor = SystemColors.HighlightText,
WrapMode = DataGridViewTriState.True
};
//Make the Grid
var grid = new DataGridView
{
Name = "dgv_" + category,
Text = category,
Visible = true,
Dock = DockStyle.Fill,
AllowUserToAddRows = false,
AllowUserToDeleteRows = false,
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill,
ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize,
ColumnHeadersDefaultCellStyle = dataGridViewCellStyle,
DataSource = Auction.CacheAuctionsDataSet.Tables[category]
};
//Binding
//var source = new BindingSource();
//source.DataSource = CacheAuctionsDataSet.Tables[category];
//Made the Tab
var tmpTabPage = new TabPage(category)
{
Name = "tabctrl_" + category,
Text = category,
Visible = true
};
//Add the Grid to the Tab
tmpTabPage.Controls.Add(grid);
tmpTabPage.Refresh();
//Add the Tab to the Control
tabctrl_Auctions.Controls.Add(tmpTabPage);
tabctrl_Auctions.Refresh();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
You need to use the Invoke method.
An example is found here https://stackoverflow.com/a/253150/2633161
I'm new to Visual Studio and fixing a small bug in an application.
The combo box which exist is editable with DropDown eventhough it is has databinding. Because If I deleted a value, it would not save the change, I made it into a DropDownList; however, now I do not have the option of using null.
I have searched around and have been reading that I can insert an item before databinding.
I have the bits and peices of the codes from different functions for this combo box. Not sure where to exactly make the change.
if someone could point me in the right direction, that'd be great.
private System.Windows.Forms.ComboBox cmbSecCSR;
//----------------
this.cmbSecCSR = new System.Windows.Forms.ComboBox();
//---------------------
// cmbSecCSR
//
this.cmbSecCSR.AccessibleRole = System.Windows.Forms.AccessibleRole.TitleBar;
this.cmbSecCSR.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.cmbSecCSR.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.cmbSecCSR.DataSource = this.csrBindingSource2;
this.cmbSecCSR.DisplayMember = "Name";
this.cmbSecCSR.FormattingEnabled = true;
this.cmbSecCSR.Location = new System.Drawing.Point(112, 26);
this.cmbSecCSR.Margin = new System.Windows.Forms.Padding(0);
this.cmbSecCSR.MaxDropDownItems = 10;
this.cmbSecCSR.Name = "cmbSecCSR";
this.cmbSecCSR.Size = new System.Drawing.Size(184, 21);
this.cmbSecCSR.TabIndex = 2;
this.cmbSecCSR.ValueMember = "Username";
this.cmbSecCSR.TextChanged += new System.EventHandler(this.comboBox_TextChanged);
this.cmbSecCSR.Enter += new System.EventHandler(this.cmbBox_Entered);
//
// csrBindingSource2
//
this.csrBindingSource2.DataMember = "CSR";
this.csrBindingSource2.DataSource = this.productionDS;
//-------------------------
//loadUnboundData();
cmbSecCSR.DataBindings.Add("SelectedValue", productionMasterBindingSource, "CSR2", true, DataSourceUpdateMode.OnPropertyChanged);
My Problem is similar to this: http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/fa277629-a65b-4799-9400-364f6f771739/
which is why I decided to change it to DropDownList;however, I don't know how to add the NULL Value in the DropDownList as it is bounded.
I'm having problems with BindingContext in a .NET application. I need to populate 6 comboboxes with the same datasource but the first 3 comboboxes must be indepedent from the last 3 comboboxes.
I coded the following:
combo_Bancos_cheque.DataSource = bancos;
combo_Bancos_cheque.DisplayMember = "Nombre";
combo_Bancos_cheque.ValueMember = "IDBanco";
combo_ctas_cheque.DataSource = bancos;
combo_ctas_cheque.DisplayMember = "NoCuenta";
combo_clabe_cheque.DataSource = bancos;
combo_clabe_cheque.DisplayMember = "CLABE";
combo_Bancos_dep.BindingContext = new BindingContext();
combo_Bancos_dep.DataSource = bancos;
combo_Bancos_dep.DisplayMember = "Nombre";
combo_Bancos_dep.ValueMember = "IDBanco";
combo_ctas_dep.DataSource = bancos;
combo_ctas_dep.DisplayMember = "NoCuenta";
combo_clabe_dep.DataSource = bancos;
combo_clabe_dep.DisplayMember = "CLABE";
The first 3 comboboxes work fine, when combo_Bancos_cheque changes combo_ctas_cheque and combo_clabe_cheque also change which is the expected behaviour. Then I create a new BindingContext to unbind 4,5 & 6 combobox which also use the same datasource.
The problem here is: when combo_Bancos_cheque value changes, combo_ctas_dep & combo_clabe_dep also change but I don't want this, I need these comboboxes to change only when combo_Bancos_dep changes.
I'm new to BindingContexts, what am I missing?
This is a quick guess, but don't you need to point combo boxes 5 and 6 to the same binding context as combo 4 (combo_Bancos_dep) ?
What if you create the new binding context into a variable, and then set it to CBs 4,5, and 6 ?
EDIT:
I just checked to confirm, and the above is correct. You were really close, you just needed to set your new BindingContext to combo_ctas_dep and combo_clabe_dep.
Here is what you posted with the change:
combo_Bancos_cheque.DataSource = bancos;
combo_Bancos_cheque.DisplayMember = "Nombre";
combo_Bancos_cheque.ValueMember = "IDBanco";
combo_ctas_cheque.DataSource = bancos;
combo_ctas_cheque.DisplayMember = "NoCuenta";
combo_clabe_cheque.DataSource = bancos;
combo_clabe_cheque.DisplayMember = "CLABE";
BindingContext oBC = new System.Windows.Forms.BindingContext();
combo_Bancos_dep.BindingContext = oBC;
combo_Bancos_dep.DataSource = bancos;
combo_Bancos_dep.DisplayMember = "Nombre";
combo_Bancos_dep.ValueMember = "IDBanco";
combo_ctas_dep.BindingContext = oBC;
combo_ctas_dep.DataSource = bancos;
combo_ctas_dep.DisplayMember = "NoCuenta";
combo_clabe_dep.BindingContext = oBC;
combo_clabe_dep.DataSource = bancos;
combo_clabe_dep.DisplayMember = "CLABE";
From what I can infer, I believe the behavior is expected - you are binding the same source to the comboboxes.
I believe this statement:
combo_Bancos_dep.BindingContext = new BindingContext();
does not do what you wish it to do - that is bind to a new source.
If "bancos" is a DataTable, you can remove the above line and just do a Copy on "bancos" to create a new DataTable and use that to bind your other combos:
DataTable copyOfbancos = bancos.Copy();
combo_Bancos_dep.DataSource = copyOfbancos;
combo_Bancos_dep.DisplayMember = "Nombre";
combo_Bancos_dep.ValueMember = "IDBanco";