Click here to Skip to main content
15,914,222 members
Home / Discussions / C#
   

C#

 
QuestionExport to Excel Pin
HimaBindu Vejella12-Feb-07 23:44
HimaBindu Vejella12-Feb-07 23:44 
QuestionHow to fill combo & listbox in popup windows form. Pin
utksThedeveloper12-Feb-07 23:17
utksThedeveloper12-Feb-07 23:17 
AnswerRe: How to fill combo & listbox in popup windows form. Pin
Christian Graus12-Feb-07 23:19
protectorChristian Graus12-Feb-07 23:19 
GeneralRe: How to fill combo & listbox in popup windows form. Pin
utksThedeveloper12-Feb-07 23:27
utksThedeveloper12-Feb-07 23:27 
GeneralRe: How to fill combo & listbox in popup windows form. Pin
KraGiE7913-Feb-07 1:27
KraGiE7913-Feb-07 1:27 
QuestionCapturing Text using Global mouse event Pin
CSharpBeginer12-Feb-07 22:57
CSharpBeginer12-Feb-07 22:57 
AnswerRe: Capturing Text using Global mouse event Pin
Christian Graus12-Feb-07 23:08
protectorChristian Graus12-Feb-07 23:08 
QuestionOverride background in TextBox? Pin
Gywox12-Feb-07 22:44
Gywox12-Feb-07 22:44 
Hi Everyone,
I have some problem with override of background in an TextBox.
The text don't merge with background, lock at code below.
Many thanks in advance.
/Gywox

<br />
using System;<br />
using System.Drawing;<br />
using System.Drawing.Drawing2D;<br />
using System.Globalization;<br />
<br />
namespace System.Windows.Forms<br />
{<br />
   public class TextBoxDate : TextBox<br />
   {<br />
      private DateTime date;<br />
      private CultureInfo culture = CultureInfo.CurrentCulture;<br />
      private bool validDate = false;<br />
      private Brush backgroundBrush = new SolidBrush(SystemColors.Control);<br />
<br />
      public TextBoxDate()<br />
      {<br />
         //this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);<br />
         this.SetStyle(ControlStyles.UserPaint, true);<br />
         this.backgroundBrush = new HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(255, 128, 128), this.BackColor);<br />
      }<br />
<br />
      public CultureInfo Culture<br />
      {<br />
         get<br />
         {<br />
            return this.culture;<br />
         }<br />
         set<br />
         {<br />
            this.culture = value;<br />
         }<br />
      }<br />
<br />
      public DateTime DateTime<br />
      {<br />
         get<br />
         {<br />
            return new DateTime(this.date.Year, this.date.Month, this.date.Day, this.culture.Calendar);<br />
         }<br />
      }<br />
<br />
      protected override void OnTextChanged(EventArgs e)<br />
      {<br />
         base.OnTextChanged(e);<br />
         Parse();<br />
      }<br />
<br />
      protected override void OnLeave(EventArgs e)<br />
      {<br />
         base.OnLeave(e);<br />
         if (this.Text != string.Empty && this.validDate)<br />
         {<br />
            this.Text = this.DateTime.ToString(this.culture.DateTimeFormat.ShortDatePattern, this.culture);<br />
         }<br />
      }<br />
<br />
      protected override void OnPaintBackground(PaintEventArgs pevent)<br />
      {<br />
         base.OnPaintBackground(pevent);<br />
         if (this.Text != string.Empty)<br />
         {<br />
            if (!this.validDate)<br />
            {<br />
               pevent.Graphics.FillRectangle(this.backgroundBrush, this.ClientRectangle);<br />
            }<br />
         }<br />
      }<br />
<br />
      private void Parse()<br />
      {<br />
         DateTime resultDate;<br />
<br />
         this.validDate = false;<br />
         if (DateTime.TryParse(this.Text, this.culture, DateTimeStyles.AllowWhiteSpaces, out resultDate))<br />
         {<br />
            this.date = resultDate;<br />
            this.validDate = true;<br />
         }<br />
         this.Invalidate();<br />
      }<br />
   }<br />
}

AnswerRe: Override background in TextBox? Pin
Christian Graus12-Feb-07 23:11
protectorChristian Graus12-Feb-07 23:11 
Questionhow to list network computer name, Ip in C# Pin
Sanjib Raj12-Feb-07 22:41
Sanjib Raj12-Feb-07 22:41 
AnswerRe: how to list network computer name, Ip in C# Pin
Michael Sync13-Feb-07 0:02
Michael Sync13-Feb-07 0:02 
QuestionHow to preserve Globally Connection Object? Pin
vaibhavnvag12-Feb-07 22:23
vaibhavnvag12-Feb-07 22:23 
AnswerRe: How to preserve Globally Connection Object? Pin
bertvan12-Feb-07 22:51
bertvan12-Feb-07 22:51 
AnswerRe: How to preserve Globally Connection Object? Pin
Niiiissssshhhhhuuuuu13-Feb-07 1:51
Niiiissssshhhhhuuuuu13-Feb-07 1:51 
AnswerRe: How to preserve Globally Connection Object? Pin
Pete O'Hanlon13-Feb-07 2:55
mvePete O'Hanlon13-Feb-07 2:55 
QuestionHow to create Report Using Dynamic SQL Pin
jaganil12-Feb-07 22:22
jaganil12-Feb-07 22:22 
AnswerRe: How to create Report Using Dynamic SQL Pin
Colin Angus Mackay12-Feb-07 22:43
Colin Angus Mackay12-Feb-07 22:43 
GeneralRe: How to create Report Using Dynamic SQL Pin
jaganil12-Feb-07 22:57
jaganil12-Feb-07 22:57 
GeneralRe: How to create Report Using Dynamic SQL Pin
Christian Graus12-Feb-07 23:14
protectorChristian Graus12-Feb-07 23:14 
QuestionHeight of Combobox Pin
joebaas12-Feb-07 22:19
joebaas12-Feb-07 22:19 
AnswerRe: Height of Combobox Pin
il_masacratore14-Feb-07 2:36
il_masacratore14-Feb-07 2:36 
GeneralRe: Height of Combobox Pin
joebaas14-Feb-07 20:47
joebaas14-Feb-07 20:47 
QuestionDistribute load to second app [modified] Pin
Matglas12-Feb-07 21:37
Matglas12-Feb-07 21:37 
AnswerRe: Distribute load to second app Pin
miestas12-Feb-07 22:01
miestas12-Feb-07 22:01 
GeneralRe: Distribute load to second app Pin
Matglas12-Feb-07 23:11
Matglas12-Feb-07 23:11 

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.