illumi
illumi

Reputation: 458

PartPainted in vb.net

What is the equivalent procedure or function or code of PartPainted (c#) in vb.net? Here is a sample snippet of the code in c# but when I convert it to vb.net code, the PartPainted is not known function.

if (PartPainted(paintParts, DataGridViewPaintParts.ContentForeground))

Upvotes: 0

Views: 197

Answers (1)

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239824

The looks eerily similar to the code from the sample Build a Custom NumericUpDown Cell and Column for the DataGridView Control article:

// If the cell is in editing mode, there is nothing else to paint
if (!cellEdited)
{
    if (PartPainted(paintParts, DataGridViewPaintParts.ContentForeground))
    {
        // Paint a NumericUpDown control
        // Take the borders into account

If that's so, it's not a framework/built in function - it's just another method in the same class:

/// <summary>
/// Little utility function called by the Paint function to see if a particular part needs to be painted. 
/// </summary>
private static bool PartPainted(DataGridViewPaintParts paintParts, DataGridViewPaintParts paintPart)
{
    return (paintParts & paintPart) != 0;
}

Which should be trivial to convert to VB.

Upvotes: 3

Related Questions