Wątek przeniesiony 2017-04-15 14:10 z C/C++ przez kq.

Znika text po minimalizacji okna

0

Witam!

Przy wypisaniu tekstu na oknie znika po jego minimalizacji co należy zrobić aby tak nie było?

        public void DrawString(string text, float x, float y, string font, int size)
        {
            Graphics formGraphics = CreateGraphics();
            string drawString = text;
            Font drawFont = new Font(font, size);
            SolidBrush drawBrush = new SolidBrush(Color.White);
            StringFormat drawFormat = new StringFormat();
            formGraphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
            drawFont.Dispose();
            drawBrush.Dispose();
            formGraphics.Dispose();
        }
0

Użyłem kontrolkę label

        private void DrawString(string text, int x, int y, string font, int size)
        {
            label1.BackColor = Color.Transparent;
            label1.Location = new Point(x, y);
            label1.Size = new Size(0, size);
            label1.Font = new Font("Arial", size);
            label1.ForeColor = Color.White;
            label1.Name = text;
            label1.Text = text;
        }
0

A tutaj zrobione z tablicą

        private void DrawString(string text, int x, int y, string font, int size, int i)
        {
            var labels = new[] {label1, label2, label3};
            labels[i].Name = text;
            labels[i].Text = text;
            labels[i].AutoSize = true;
            labels[i].TabIndex = 5;
            labels[i].BackColor = Color.Transparent;
            labels[i].Location = new Point(x, y);
            labels[i].Size = new Size(0, size);
            labels[i].Font = new Font(font, size);
            labels[i].ForeColor = Color.White;
        }

1 użytkowników online, w tym zalogowanych: 0, gości: 1