Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
E

eyalbi007

@eyalbi007
About
Posts
51
Topics
26
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Mouse move (hover) over an Image with Graphics drawings
    E eyalbi007

    Hi All, I have an image on which I'm drawing elements ("masks") using a Graphics object (g.DrawCurve, g.FillRectangle, g.DrawPolygon etc.). Now, when hovering with the mouse over the image, I need to know whether I'm hovering over a mask (a part that was drawn using the Graphics object). I couldn't find a way to get a Graphic's drawing pixels... any ideas? Thanks!

    C# graphics question

  • Passing array by reference from C# to c++/cli
    E eyalbi007

    Yes, all I was missing is the % operator. Thanks!

    C# csharp c++ data-structures

  • Passing array by reference from C# to c++/cli
    E eyalbi007

    Hi, I'm trying to write a function in a c++/cli dll that will receive an empty array from C# (float[] a), use gcnew to allocate the array and then I need to use the array in C#. I tried regular transfer but after the function returns the array is still null in C#. Current trial is: C#:

    float[] a;
    InitArray(a);

    c++/cli:

    void CLIClass::InitArray(array^ a)
    {
    a = gcnew array(100);
    for(int i=0; i<100; i++)
    a[i] = 10.0F;
    }

    I do not wish to return the array as a return value (the function should actually return 3 arrays). Thanks!

    C# csharp c++ data-structures

  • Displaying an image generated in c++/CLI DLL
    E eyalbi007

    Hi All, I have a routine that calls a C++/CLI DLL from C# in order to generate an image. After the generation, I have (in the DLL) a pointer to 'unsigned short' array and the image dimensions. Now I'd like to somehow use this pointer to display the image in a C# form (using PictureBox ot ony other suitable component), but I have no idea how... Thanks for the help, Eyal.

    C# csharp c++ data-structures help

  • Preventing DataGridView column from auto-resizing when double-clicking the column header divider
    E eyalbi007

    ...

    C# question

  • Preventing DataGridView column from auto-resizing when double-clicking the column header divider
    E eyalbi007

    Hi all, I have a DataGridView where the user can change the columns widths (by dragging the column header divider). However, I'd like to disable the functionality that double-clicking the column header divider auto-resizes the column with. I tried using the ColumnDividerDoubleClick event to handle this event manually, but the column width still automatically resizes. Ideas? Thanks! Eyal.

    C# question

  • "Search row" in DataGridView
    E eyalbi007

    Hi Guys, I wish for the first line of my DataGridView to be a search line, meaning that all the other rows are filtered according to the value the user inserts to the corresponding column top cell. For example, if the user enters "a*" at the first row's first cell, only rows with the first cell beginning with the letter "a" are shown. Of course, when sorting, this line should be disregarded. Any suggestions of how to implement such functionality? Thanks! Eyal.

    C# tutorial algorithms question learning

  • DataGridView SelectionChanged event
    E eyalbi007

    Thank for the reply. The problem is not that I'm changing the selection - in this case the problem is easy to solve. The problem is that the event is fired when the form is initially opened and rows are automatically added. Then, when the first row is (automatically) selected, the event is fired. Eyal.

    C# question

  • DataGridView SelectionChanged event
    E eyalbi007

    Hi, A quote from MSDN about this event: "This event occurs whenever cells are selected or the selection is canceled, whether programmatically or by user action". My question: How can I get the exact same functionality, but only as a result of user action (I do not wish this even to occur when the selection has programmatically changed). Thanks, Eyal.

    C# question

  • Sending email and keeping a copy on the server
    E eyalbi007

    Thank you. So how can I send message that will be saved in the "sent items" folder? In worst case I'll add myself as recipient (regular or CC or BCC), but it's a bit dirty... Eyal.

    C# csharp sysadmin question

  • Sending email and keeping a copy on the server
    E eyalbi007

    Hi, My application automatically sends email messages using System.Net.Mail.MailMessage and System.Net.Mail.SmtpClient. However, the sent emails are not kept on the mail server. Is there a way of doing so? Thanks, Eyal.

    C# csharp sysadmin question

  • DataGridView line index cells
    E eyalbi007

    Thanks a lot, you are totally right! I found the problem: The column's AutoSizeMode property was set to DataGridViewAutoSizeColumnMode.AllCells, which dragged heavy calculations every time one of the column's cells value was changed. I changed it to DataGridViewAutoSizeColumnMode.None and now everything works smooth. In order to have the auto-size functionality, I've set the column's Resizable property to DataGridViewTriState.False, and added calls of AutoResizeColumn(ColumnIndex) where it's needed. Again, thanks a lot. Eyal.

    C# database question

  • DataGridView line index cells
    E eyalbi007

    Hi, First of all, thanks. Your solution saves the iterating part. However, the problem with using these events is that it's called every time the row is painted (for example, when scrolling). This slows down the response time since every time a row becomes visible (due to scrolling) the value of the index cell is set all over again. Even if I add "if" statement (in order to update the index cell only when required), scrolling after sorting becomes very slow since the index cell of the hidden rows wasn't updated yet. Any suggestions? Eyal.

    C# database question

  • DataGridView line index cells
    E eyalbi007

    1. Since the relevant DataGridView cells display Strings, there is an automatic conversion from (iRowIter + 1), which is int, to Cells[0].Value which is String Object in this case. It's the same as

    Cells[0].Value = Convert.ToString(iRowIter + 1)

    2. My analysis is correct. I tried the following code:

    Cells[0].Value = "1"

    and it worked amazingly fast.

    C# database question

  • DataGridView line index cells
    E eyalbi007

    Hi, I'm trying to add line index cell to my DataGridView by iterating over the rows. However, when the list has many rows (hundreds), this loop takes very long time due to CPU consuming. The "heavy" part is converting the "int" to "String". The code:

    for (int iRowIter = 0; iRowIter < this.Rows.Count; iRowIter++)
    this.Rows[iRowIter].Cells[0].Value = iRowIter + 1;

    Any suggestions? Thanks!

    C# database question

  • Coloring ProgressBar
    E eyalbi007

    Here's the code (that indeed does nothing). What I was hopint it'll do is paint the prorgesss bar in different color than green (the Windows default color), by pressing button2. button1 simply advances the bar.

        \[DllImport("user32.dll", CharSet = CharSet.Auto)\]
        private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
    
        public const Int32 PBM\_SETBKCOLOR = 0x2001;
        public const Int32 PBM\_SETBARCOLOR = 0x0409;
    
        public void SetProgressBackColor(Color c)
        {/// set the back color of the bar
            int a = c.R;
            int b = c.G;
            int d = c.B;
            int tot = ColorTranslator.ToOle(Color.FromArgb(a, b, d));
            IntPtr j = this.progressBar1.Handle;
            SendMessage(j, PBM\_SETBKCOLOR, 0, tot);
        }
    
        public void SetProgressForeColor(Color c)
        {/// set the forecolor of the bar
            int a = c.R;
            int b = c.G;
            int d = c.B;
            int tot = ColorTranslator.ToOle(Color.FromArgb(a, b, d));
            IntPtr j = this.progressBar1.Handle;
            SendMessage(j, PBM\_SETBKCOLOR, 0, tot);
        }
    
        private void button1\_Click(object sender, EventArgs e)
        {
            this.progressBar1.Minimum = 1;
            this.progressBar1.Maximum = 10000;
            this.progressBar1.Step = 1;
            this.progressBar1.Value = 1;
            for (int i = progressBar1.Minimum; i <= progressBar1.Maximum; i++)
            {
                progressBar1.PerformStep();
            }
        }
    
        private void button2\_Click(object sender, EventArgs e)
        {
            SetProgressBackColor(System.Drawing.Color.BlueViolet);
            SetProgressForeColor(System.Drawing.Color.Red);
        }
    
    C# question

  • Coloring ProgressBar
    E eyalbi007

    Well, still not working...

    C# question

  • Coloring ProgressBar
    E eyalbi007

    Give me a break, it's just a code I copied fom the web... :doh:

    C# question

  • Coloring ProgressBar
    E eyalbi007

    Hi All, I'm trying to chenge the color of my ProgressBar without building a new component from scratch. I tried inheriting from System.Windows.Forms.ProgressBar and use the code below (which I found in several forums), but it's not working (if relevant, I'm working on vista 64). Any ideas?

    class MyProgressBar : ProgressBar
    {
    [DllImport("User32.Dll")]
    public static extern int SendMessage(int hwnd, int wMsg, int wParam, int lParam);

    public const int PBM_SETBKCOLOR = 0x2001;
    public const int PBM_SETBARCOLOR = 0x409;

    public void SetProgressBackColor(Color c)
    {/// set the back color of the bar
    int a = Convert.ToInt32(c.R.ToString());
    int b = Convert.ToInt32(c.G.ToString());
    int d = Convert.ToInt32(c.B.ToString());
    int tot = Convert.ToInt32(ColorTranslator.ToOle(Color.FromArgb(a, b, d)).ToString());
    int j = this.Handle.ToInt32();
    SendMessage(j, PBM_SETBKCOLOR, 0, tot);
    }

    public void SetProgressForeColor(Color c)
    {/// set the forecolor of the bar
    int a = Convert.ToInt32(c.R.ToString());
    int b = Convert.ToInt32(c.G.ToString());
    int d = Convert.ToInt32(c.B.ToString());
    int tot = Convert.ToInt32(ColorTranslator.ToOle(Color.FromArgb(a, b, d)).ToString());
    int j = this.Handle.ToInt32();
    SendMessage(j, PBM_SETBARCOLOR, 0, tot);
    }
    }

    Thanks!

    C# question

  • DataGridViewComboBoxCell closes immediately [modified]
    E eyalbi007

    Hi Guys, I'm experiencing the following problem with DataGridViewComboBoxCell: When clicking the arrow that opens the combo box for the first time, everything is fine. However, when clicking it again (as long as the cell is still in focus) the list drops (opens) and closes immediately. The only way to change its value is to select another component so it loses focus, and then click it once again. Does anyone has an idea how to solve it? Thanks, Eyal.

    modified on Tuesday, March 10, 2009 6:19 AM

    C# help tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups