private void tbx_sourcecode_TextChanged(object sender, EventArgs e) { txtSourceCodeModified = tbx_sourcecode.Text; if (txtSourceCode == txtSourceCodeModified) { of.IsModifid = false; } else { of.IsModifid = true; } if (tbx_sourcecode.Text != "") { SetTxtColor(tbx_sourcecode.Text); string[] s = tbx_sourcecode.Text.Split('\n'); int n = 0; int index = this.tbx_sourcecode.SelectionStart; for (int i = 0; i < s.Length; i++) { if (s[i].StartsWith("/*") || s[i].EndsWith("*/") || s[i].StartsWith("*")) { n = tbx_sourcecode.GetFirstCharIndexFromLine(i); tbx_sourcecode.Select(n, s[i].Length); tbx_sourcecode.SelectionColor = Color.SlateGray; this.tbx_sourcecode.Select(index, 0); } } } MyPictureBox.Invalidate(); }
private void tbx_sourcecode_Resize(object sender, EventArgs e) { MyPictureBox.Invalidate(); }
void TaskleriListele() { int rtBoyut = 5; int satirY = 0; int yerlestirY = 5; int sayac = -1; OleDbDataAdapter odat = new OleDbDataAdapter("SELECT Id, Story FROM Stories", baglanti); DataSet ds = new DataSet(); odat.Fill(ds); for (int z = 0; z < ds.Tables[0].Rows.Count; z++) { ComboboxItem item = new ComboboxItem(); komut.CommandText = "SELECT Id, TaskName, TaskCategoryId, TaskStoryId FROM Tasks WHERE TaskStoryId=" + ds.Tables[0].Rows[z][0].ToString(); DataTable tablom = new DataTable(); OleDbDataAdapter verilericek = new OleDbDataAdapter(komut); verilericek.Fill(tablom); for (int i = 0; i < tablom.Rows.Count; i++) { item.Text = tablom.Rows[i][1].ToString(); item.Value = tablom.Rows[i][0].ToString(); string tsid = tablom.Rows[i][3].ToString(); cbTasks.Items.Add(new { Text = tablom.Rows[i][1].ToString(), Value = tablom.Rows[i][0].ToString() }); cbTasks.DisplayMember = "Text"; cbStroy.ValueMember = "Value"; cbTasks.SelectedIndex = 0; MyPictureBox pictureBoxx = new MyPictureBox(); pictureBoxx.StoryId = tablom.Rows[i][3].ToString(); pictureBoxx.CategoryId = tablom.Rows[i][2].ToString(); pictureBoxx.Image = TaskResimAl(); int bolum = 0; bolum = objepanel2 / 2; if (tablom.Rows[i][2].ToString() == "1") { if (objepanel2 % 2 == 0) { yerlestirY = (bolum * 35) + ((bolum + 1) * 5); } else { } } pictureBoxx.Location = new System.Drawing.Point(rtBoyut, yerlestirY); pictureBoxx.Name = item.Text.Replace(" ", "_"); //"pictureBox" + i.ToString(); pictureBoxx.Size = new System.Drawing.Size(51, 35); pictureBoxx.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; pictureBoxx.TabIndex = 3; pictureBoxx.TabStop = false; pictureBoxx.Paint += new PaintEventHandler((sender, e) => { e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; string text = pictureBoxx.Name.Replace("_", " "); SizeF textSize = e.Graphics.MeasureString(text, Font); PointF locationToDraw = new PointF(); locationToDraw.X = (pictureBoxx.Width / 2) - (textSize.Width / 2); locationToDraw.Y = (pictureBoxx.Height / 2) - (textSize.Height / 2); e.Graphics.DrawString(text, Font, Brushes.Black, locationToDraw); }); pictureBoxx.Invalidate(); pictureBoxx.MouseDown += new System.Windows.Forms.MouseEventHandler((sender, e) => { dragsource = pictureBoxx; pictureBoxx.DoDragDrop(pictureBoxx.Image, DragDropEffects.All); }); MyRichTextBox FoundStory = panel1.Controls.Find("rTBox" + tsid, true).FirstOrDefault() as MyRichTextBox; if (tablom.Rows[i][2].ToString() == "1") { panel2.Controls.Add(pictureBoxx); pictureBoxx.Location = TaskYerlestir(1, satirY, pictureBoxx.Name); objepanel2++; FoundStory.Cat1Count++; } if (tablom.Rows[i][2].ToString() == "2") { panel3.Controls.Add(pictureBoxx); pictureBoxx.Location = TaskYerlestir(2, satirY, pictureBoxx.Name); objepanel3++; FoundStory.Cat2Count++; } if (tablom.Rows[i][2].ToString() == "3") { panel4.Controls.Add(pictureBoxx); pictureBoxx.Location = TaskYerlestir(3, satirY, pictureBoxx.Name); objepanel4++; FoundStory.Cat3Count++; } sayac = -1; } satirY += 90; objepanel2 = 0; objepanel3 = 0; objepanel4 = 0; } }