Click here to Skip to main content
15,910,009 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using Microsoft Agent with C# for win7 or win10 ? Pin
Richard MacCutchan24-Oct-19 21:54
mveRichard MacCutchan24-Oct-19 21:54 
GeneralRe: Using Microsoft Agent with C# for win7 or win10 ? Pin
Member 245846727-Oct-19 21:04
Member 245846727-Oct-19 21:04 
GeneralRe: Using Microsoft Agent with C# for win7 or win10 ? Pin
Richard MacCutchan27-Oct-19 22:10
mveRichard MacCutchan27-Oct-19 22:10 
Questioni want count rows per same date in new one row. c# with sqlserver Pin
Mostafa Mohamed23-Oct-19 22:06
Mostafa Mohamed23-Oct-19 22:06 
AnswerRe: i want count rows per same date in new one row. c# with sqlserver Pin
OriginalGriff23-Oct-19 22:22
mveOriginalGriff23-Oct-19 22:22 
QuestionHow do I bind TreeView Selected Item? Pin
User 1459901922-Oct-19 19:52
User 1459901922-Oct-19 19:52 
AnswerRe: How do I bind TreeView Selected Item? Pin
Mc_Topaz24-Oct-19 21:00
Mc_Topaz24-Oct-19 21:00 
QuestionWhy does the Form_Paint event run continuously and only draw once ? Pin
Member 245846722-Oct-19 15:53
Member 245846722-Oct-19 15:53 
I have the following code, I put a label in Form_Paint to track the number jump, I see the label jumping continuously but e.Graphics.DrawString(...) only looks once, does anyone know why ?
C#
public partial class Form1 : Form
    {        
        public Form1()
        {
            InitializeComponent();
            //progressBar1.Visible = false;
            progressBar1.Minimum = 0;
            progressBar1.Maximum = 100;

            this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);

        }
        int iNum = 0;        
        private void btnDrawText_Click(object sender, EventArgs e) //PaintEventArgs e
        {            
            progressBar1.Value = 0;
            progressBar1.Visible = true;
            this.timer1.Interval = 100;
            this.timer1.Enabled = true;            

        }
        private void ShadowedTextPaint(PaintEventArgs e, int num)
        {
            using (Font font1 = new Font("Times New Roman", 250, FontStyle.Bold, GraphicsUnit.Pixel))
            {
                PointF pointF1 = new PointF(310, 270);
                e.Graphics.DrawString(num.ToString(), font1, Brushes.LightGreen, pointF1);                
                lblNum.Text = num.ToString();
            }            

        }
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            ShadowedTextPaint(e, iNum);
        }
        private void timer1_Tick(object sender, EventArgs e)
        {            
            if (progressBar1.Value < 100)
            {                
                Random rd = new Random();
                iNum = rd.Next(0, 999);                
                progressBar1.Value++;
            }
            else
            {                
                this.timer1.Enabled = false;
                progressBar1.Visible = false;                
            }

        }
  }

AnswerRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Dave Kreskowiak22-Oct-19 17:56
mveDave Kreskowiak22-Oct-19 17:56 
GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Member 245846723-Oct-19 22:09
Member 245846723-Oct-19 22:09 
GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Dave Kreskowiak24-Oct-19 4:33
mveDave Kreskowiak24-Oct-19 4:33 
GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Member 245846724-Oct-19 16:59
Member 245846724-Oct-19 16:59 
GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Dave Kreskowiak24-Oct-19 18:04
mveDave Kreskowiak24-Oct-19 18:04 
GeneralC # Pin
Member 1461982622-Oct-19 0:45
Member 1461982622-Oct-19 0:45 
GeneralRe: C # Pin
OriginalGriff22-Oct-19 0:57
mveOriginalGriff22-Oct-19 0:57 
QuestionRe: C # Pin
ZurdoDev22-Oct-19 2:59
professionalZurdoDev22-Oct-19 2:59 
AnswerRe: C # Pin
OriginalGriff22-Oct-19 3:32
mveOriginalGriff22-Oct-19 3:32 
GeneralRe: C # Pin
ZurdoDev22-Oct-19 4:04
professionalZurdoDev22-Oct-19 4:04 
GeneralRe: C # Pin
Dave Kreskowiak22-Oct-19 6:07
mveDave Kreskowiak22-Oct-19 6:07 
GeneralRe: C # Pin
Luc Pattyn22-Oct-19 10:23
sitebuilderLuc Pattyn22-Oct-19 10:23 
GeneralRe: C # Pin
Richard Deeming23-Oct-19 1:25
mveRichard Deeming23-Oct-19 1:25 
GeneralRe: C # Pin
Luc Pattyn23-Oct-19 2:56
sitebuilderLuc Pattyn23-Oct-19 2:56 
QuestionLDAP query to ActiveDirectory being whimsical (search by custom attribute broken) Pin
Super Lloyd21-Oct-19 21:30
Super Lloyd21-Oct-19 21:30 
SuggestionRe: LDAP query to ActiveDirectory being whimsical (search by custom attribute broken) Pin
Richard MacCutchan21-Oct-19 22:41
mveRichard MacCutchan21-Oct-19 22:41 
GeneralRe: LDAP query to ActiveDirectory being whimsical (search by custom attribute broken) Pin
Super Lloyd22-Oct-19 1:07
Super Lloyd22-Oct-19 1:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.