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
M

Montasser Ben Ouhida

@Montasser Ben Ouhida
About
Posts
6
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Insert Duplicate into Hashset
    M Montasser Ben Ouhida

    Hi, You can use the HashSet as: Hashset(Key(Type1), Value (List(Type2)))

    Dictionary> dicElements;

    C# question

  • html editor
    M Montasser Ben Ouhida

    Hi all, I found an article contains an other solution: Zeta HTML Edit Control[^] enjoy :)

    C# csharp html wpf winforms question

  • Display images in Gridview
    M Montasser Ben Ouhida

    Hi, You can implement the cell paint event. I think that you have a data table like this: (Val1, Val2, PicturePath, ...). You can find bellow an example of code that shows in a data grid view a grid contact: ---------------------------------------------------------------- |Picture | First Name | Last Name | Phone number | ---------------------------------------------------------------- |    ;)   |     Mr. X       |   X1            |  00112233       | ---------------------------------------------------------------- |    ;)   |     Mr. X       |   X1            |  00112233       | ----------------------------------------------------------------

    // Subscribe to the event cell painting
    myDataGridView += new DataGridViewCellPaintingEventHandler(myDataGridView_CellPainting);

    // Implement the event
    void myDataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
    {
    // Test if you are drawing the picture cell. Note that the RowIndex == 0 is the row header
    if (e.RowIndex > 0 && e.ColumnIndex == 0)
    {
    try
    {
    string strPath = myDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
    // To optimize you program, you can store the loadeds picture in a dictionary like this:
    Bitmap objPicture = null;
    if(dicPictures.ContainsKey(strPath))
    {
    objPicture = dicPictures[strPath];
    }
    else
    {
    objPicture = Bitmap.FromFile(strPath);
    dicPictures.Add(strPath, objPicture);
    }

             e.Graphics.DrawImage(objPicture, e.CellBounds);
           }
           catch (Exception Error)
           { 
              // Error Log or Managing
           } 
       }
    

    }

    C# help

  • Email button in Datagridview
    M Montasser Ben Ouhida

    Hi, To start writing mail, the correct instruction is:

    Process.Start("mailto:name@company.com");

    then you must change you code as:

    Process.Start("mailto:" + this.dgvPresenters[e.ColumnIndex,e.RowIndex].Value.ToString());

    C# css database com

  • html editor
    M Montasser Ben Ouhida

    Hi, My idea is converting an RTF document to HTML because the rich text control offers the RTF output result. 1)You can use this article to create an advanced rich text box: RicherTextBox 2)To convert the RTF result, you can use the

    "SautinSoft.RtfToHtml"

    . For the trial version you can convert over 30000 words :^)

    private string GetHtmlText(string strRtfText)
    {
    if (string.IsNullOrEmpty(strRtfText)) return "";

            string result = "";
    
            #region Version SautinSoft
    
            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
            //this property is necessary only for registered version
            //r.Serial = "XXXXXXXXXXXXX";
    
            //specify some options
            r.OutputFormat = SautinSoft.RtfToHtml.eOutputFormat.HTML\_5;// SautinSoft.eOutputFormat.XHTML\_10;
            r.Encoding = SautinSoft.RtfToHtml.eEncoding.UTF\_8;// SautinSoft.eEncoding.UTF\_8;
    
            //specify image options
            r.ImageStyle.ImageFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\\\TempFiles";      //this folder must exist
            r.ImageStyle.ImageSubFolder = "webs";   //this folder will be created by the component
            r.ImageStyle.ImageFileName = "picture"; //template name for images
            r.ImageStyle.IncludeImageInHtml = true;//false - save images on HDD, true - save images inside HTML
    
    
            result = r.ConvertString(strRtfText);
    
            #endregion
    
            return result;
        }
    
    C# csharp html wpf winforms question

  • Drawing Text on Panel
    M Montasser Ben Ouhida

    Hi

    Dan_K

    , To draw object under any control, you must implement the event "OnPaint". You can use this code:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace WindowsApplication1
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();

            panel.Paint += new PaintEventHandler(panel\_Paint);
        }
    
        private void void panel\_Paint(object sender, PaintEventArgs e)
        {
                             
    
            e.Graphics.DrawString("Problem drawing text on Panel", panel.Font, Brushes.Black, 50, 50);
    
        }
    }
    

    }

    C# graphics help 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