I have a DataGridView
with right to left align (because the language of the program is Persian), but some specific columns like clmn_Email
should be left to right and the column of a register DateTime
also should be left to right.
DateTime
in RTL align is shown like
ب.ظ1397/07/07 08:32:14
but it should be displayed like
1397/07/07 08:32:14 ب.ظ
Anyway, I go to the Collection
and then to defaultCellStyle
and change the alignment to "middle left", but it doesn't work at all and nothing changed.
Can anyone help me? (I didn't find a question like this. If it's repetitious, please send me the link of the question).
Problem Solved. If DataGridView is Right to Left, for setting a column alignment Left to Right should go to properties >collection > DefultCellStyle> set Alignment = middleRight
(i except this option set the alignment Right to Left but it works reverse !!). for that problem of displaying datetime i do this :
public static string ReversePersianDateTime(PersianDateTime pdt)
{
return pdt.DayName + " " + pdt.Hour + ":" + pdt.Minute + ":" + pdt.Second + " " + pdt.Year + "/" + pdt.Month + "/" + pdt.Day;
}
To solve this problem, add the LTR control character to the beginning of the original data. char.Parse ("\\ u200E") + original data ("ب.ظ 1397/07/07 08:32:14")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.