如何将我的应用程序扩展到新的视网膜4.5 1136x640分辨率?(How to scale my app to new retina 4.5 1136x640 resolution?)
如何将我的应用扩展到新的视网膜4.5分辨率(1136x640)?
我有基于xib和storyboard(非xib)的应用程序,但无法找到有关如何自动扩展到新分辨率的任何信息。
请给我关于developer.apple.com上的任何链接或stackoverflow上的主题或任何其他帮助。
谢谢!
How do I scale my app to new retina 4.5 resolution (1136x640)?
I have existing xibs and storyboard (non-xib) based applications, and can't find any information about how to auto-scale to new resolution.
Please, give me any links on developer.apple.com or themes on stackoverflow or any other help.
Thanks!
原文:https://stackoverflow.com/questions/12610887
最满意答案
首先,您要在
DataGridView
自动生成列吗? 如果是这样,请编码:IList<HistoryItem> history = _currentCustomer.HistoryItems; dgvCustomerHistory.AutoGenerateColumns = true; dgvCustomerHistory.DataSource = history;
如果没有,那就像:
IList<HistoryItem> history = _currentCustomer.HistoryItems; dgvCustomerHistory.AutoGenerateColumns = false; DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn(); column.HeaderText = "Communication Type"; column.DataPropertyName = "TypeOfCommunication"; // Name of property dgvCustomerHistory.Columns.Add(column); dgvCustomerHistory.DataSource = history;
我想你只需要为
CommunicationTypeConverter
添加一些更多的覆盖。 您只处理ConvertFrom
方法,您需要处理ConvertTo
方法和CanConvert
方法。public class CommunicationTypeConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); } public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(string) || base.CanConvertTo(context, destinationType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { switch ((string)value) { case "OUTGOING_EMAIL": return CommunicationType.OutgoingEmail; default: return CommunicationType.OutgoingCall; } } return base.ConvertFrom(context, culture, value); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { if (value is CommunicationType) { switch ((CommunicationType)value) { case CommunicationType.OutgoingEmail: return "OUTGOING_EMAIL"; default: return "OUTGOING_CALL"; } } } return base.ConvertTo(context, culture, value, destinationType); } }
然后,您可以返回图像/图标而不是字符串。 只需确保更新相应的
Convert
和CanConvert
部分。To start, do you want to auto generate the columns in the
DataGridView
? If so, code it like:IList<HistoryItem> history = _currentCustomer.HistoryItems; dgvCustomerHistory.AutoGenerateColumns = true; dgvCustomerHistory.DataSource = history;
if not, do it like:
IList<HistoryItem> history = _currentCustomer.HistoryItems; dgvCustomerHistory.AutoGenerateColumns = false; DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn(); column.HeaderText = "Communication Type"; column.DataPropertyName = "TypeOfCommunication"; // Name of property dgvCustomerHistory.Columns.Add(column); dgvCustomerHistory.DataSource = history;
I think you just need to add some more overrides to the
CommunicationTypeConverter
. You only were handling theConvertFrom
method, you need to handle theConvertTo
method and theCanConvert
methods.public class CommunicationTypeConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); } public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(string) || base.CanConvertTo(context, destinationType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { switch ((string)value) { case "OUTGOING_EMAIL": return CommunicationType.OutgoingEmail; default: return CommunicationType.OutgoingCall; } } return base.ConvertFrom(context, culture, value); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { if (value is CommunicationType) { switch ((CommunicationType)value) { case CommunicationType.OutgoingEmail: return "OUTGOING_EMAIL"; default: return "OUTGOING_CALL"; } } } return base.ConvertTo(context, culture, value, destinationType); } }
You can then return images/icons instead of strings. Just make sure you update both the appropriate
Convert
andCanConvert
sections.
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
List类不实现支持列表更改通知的IBindingList接口。 请尝试使用BindingList类: 提供支持数据绑定的通用集合。 要观察类中属性的更改,该类需要实现INotifyPropertyChanged接口: 通知客户端属性值已更改。 The List class does not implement the IBindingList interface which supports list change notifications. Try using the BindingList clas ...
-
使用BindingList并设置列的DataPropertyName -Property。 尝试以下: ... private void BindGrid() { gvFilesOnServer.AutoGenerateColumns = false; //create the column programatically DataGridViewCell cell = new DataGridViewTextBoxCell(); DataGridViewTextBoxCo ...
-
很奇怪,你说If I remove all columns from myGV it does display data... 我转载了你的问题,原因是你的LINQ查询没有执行。 在使用结果作为DataGridView DataSource之前,您必须调用ToList()或类似的方法: myGV.DataSource = Logs.logList.OrderBy(x => x.Time).ToList(); 当然,如果您的静态列没有与DataSource的属性匹配的DataPropertyName ,那么 ...
-
如何在DataGridView中显示Browsable(false)属性(How to display a Browsable(false) Property in DataGridView)[2022-04-06]
此处不会自动生成列。 它已生成但单元格的值为null,因为该属性不可浏览。 有多种解决方案可以解决这个问题,包括: 使用CellFormatting事件并为单元格提供值。 使用相同的属性名称在具有相同属性名称的模型或匿名对象中形成结果。 使用MetaDataType属性并为类提供新的元数据。 使用CellFormatting 您可以使用CellFormatting并在行后面找到DataBound项,并直接从模型中使用property的值: void dataGridView1_CellFormatting( ... -
您可能需要遍历列表并构建一个字符串 OR [Part Number] LIKE [ x ] 否则,如果您不需要通配符,则可以使用IN而不是LIKE : "[Part Number] IN ( 'x', 'y', 'z')" You may have to loop through your list and build up a string of OR [Part Number] LIKE [ x ] Otherwise if you don't need the wildcards you c ...
-
根据单元格值过滤datagridview中的对象列表(Filtering list of objects in datagridview based on cell value)[2022-08-08]
我想你知道如何使用列的DataPropertyName属性提取属性名称,以及如何从单元格的Value属性中获取值。 在答案中,我将重点介绍如何对具有属性名称和值的List进行动态过滤,就像使用.Where(x=>x.PropertyName == Value) 。 为此,您可以选择几个选项,包括: 动态Linq库 在运行时动态创建Expression 使用包含每个属性所需条件的Dictionary 只需使用if / else 我将分享有关上述解决方案的更多详细信息,您可以选择其中任何一种。 注意: 如 ... -
首先,您要在DataGridView自动生成列吗? 如果是这样,请编码: IList
history = _currentCustomer.HistoryItems; dgvCustomerHistory.AutoGenerateColumns = true; dgvCustomerHistory.DataSource = history; 如果没有,那就像: IList history = _currentCustomer.HistoryItems ... -
让您的网格视图自动生成列,然后只删除它们。 您也可以在代码中构建它,尽管在您习惯之前这对您来说可能更容易。 所以这样的事情: dataGridView1.AutoGenerateColumns = true; dataGridView1.DataSource = extraParamters; dataGridView1.Columns.Remove("accId"); dataGridView1.Columns.Remove("custId"); dataGridView1.Columns["I ...