Как отсортировать слова с числами в ComboBox или ListBox
Переворачиваем тексты на форме. Пример на VB.NET доступен
public void DrawFlippedText(Graphics gr, Font the_font, Brush the_brush,
int x, int y, string txt, bool flip_x, bool flip_y)
{
// Save the current graphics state.
GraphicsState state = gr.Save();
// Set up the transformation.
int scale_x = (flip_x ? -1 : 1);
int scale_y = (flip_y ? -1 : 1);
gr.ResetTransform();
gr.ScaleTransform(scale_x, scale_y);
// Figure out where to draw.
SizeF txt_size = gr.MeasureString(txt, the_font);
if (flip_x)
{
x = (int)(-x - txt_size.Width);
}
if (flip_y)
{
y = (int)(-y - txt_size.Height);
}
// Draw.
gr.DrawString(txt, the_font, the_brush, x, y);
// Restore the original graphics state.
gr.Restore(state);
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
using (Font the_font = new Font("Comic Sans MS", 20))
{
DrawFlippedText(e.Graphics, the_font, Brushes.Red, 10, 10, "Flip X", true, false);
DrawFlippedText(e.Graphics, the_font, Brushes.Green, 10, 100, "Flip Y", false, true);
DrawFlippedText(e.Graphics, the_font, Brushes.Blue, 10, 200, "Flip XY", true, true);
// Optional: Draw boxes around the strings.
SizeF txt_size;
txt_size = e.Graphics.MeasureString("Flip X", the_font);
e.Graphics.DrawRectangle(Pens.Red, 10, 10, txt_size.Width, txt_size.Height);
txt_size = e.Graphics.MeasureString("Flip Y", the_font);
e.Graphics.DrawRectangle(Pens.Red, 10, 100, txt_size.Width, txt_size.Height);
txt_size = e.Graphics.MeasureString("Flip XX", the_font);
e.Graphics.DrawRectangle(Pens.Red, 10, 200, txt_size.Width, txt_size.Height);
}
}
Транслитер - перевод русских символов в латиницу, как в Punto Switcher
Снежинки на Рабочем столе - desktopsnow.zip
Описание примера на
Фигуры в полярных координатах - polar.zip
Для окна О программе - надписи, которые сходятся и расходятся - credits_cs.zip
Анимация спрайтов - spriteanimation.zip
Интерактивные кнопки - livebuttons.zip
Рисуем снежинки - snowcrystal.zip