Click here to Skip to main content
15,867,568 members
Home / Discussions / C#
   

C#

 
GeneralRe: 18 Errors Needs to be Fixed Pin
Michael Afolayan30-Jan-23 23:23
Michael Afolayan30-Jan-23 23:23 
GeneralRe: 18 Errors Needs to be Fixed Pin
Richard MacCutchan30-Jan-23 23:09
mveRichard MacCutchan30-Jan-23 23:09 
GeneralRe: 18 Errors Needs to be Fixed Pin
Calin Negru1-Feb-23 1:00
Calin Negru1-Feb-23 1:00 
AnswerRe: 18 Errors Needs to be Fixed Pin
OriginalGriff30-Jan-23 22:09
mveOriginalGriff30-Jan-23 22:09 
GeneralRe: 18 Errors Needs to be Fixed Pin
Michael Afolayan30-Jan-23 23:15
Michael Afolayan30-Jan-23 23:15 
GeneralRe: 18 Errors Needs to be Fixed Pin
OriginalGriff31-Jan-23 2:06
mveOriginalGriff31-Jan-23 2:06 
GeneralRe: 18 Errors Needs to be Fixed Pin
CHill601-Feb-23 3:58
mveCHill601-Feb-23 3:58 
QuestionWhat's up with displaying transparent pixel? Closed Pin
mo149229-Jan-23 0:13
mo149229-Jan-23 0:13 
Still don't know why this happens but it doesn't matter. I found that setting my control
to DoubleBuffered = true, the display time goes to 0.
Sorry for the post.


Can some tell me why displaying the transparent pixel takes so much time?
See bottom of sample for time comparison.


public class CellColor
{
public Rectangle Rect;
public Color Color;
public CellColor(Rectangle rect, Color clr)
{
Rect = rect;
Color = clr;
}
}

// At form load time, this array is loaded with pixel data from a 32 x 32 Icon.
// About half of the pixels in the sample icon are transparent (A=0,R=255,G=255,B=255).
private CellColor[,]? _CellBounds;

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
DrawCells(e.Graphics);
}

private void DrawCells(Graphics gr)
{
int iWd = this._CellBounds!.GetUpperBound(0) + 1;
int iHt = this._CellBounds.GetUpperBound(1) + 1;

Stopwatch sw = new();
sw.Start();

for (int iRow = 0; iRow < iHt; iRow++)
{
for (int iCol = 0; iCol < iWd; iCol++)
{
CellColor cc = this._CellBounds[iRow, iCol];

using(SolidBrush br = new(cc.Color))
{
gr.FillRectangle(br, cc.Rect);
}
}
}
sw.Stop();

// Displaying the data without pixel modification takes about 60 milliseconds.
// When loading _CellBounds, if I replace the transparent pixel with a real color like Color.White,
// this loop takes 4 milliseconds.
DebugClass.WriteLine(string.Format("{0}", sw.ElapsedMilliseconds));

}

-- modified 29-Jan-23 8:08am.
AnswerRe: What's up with displaying transparent pixel? Closed Pin
lmoelleb30-Jan-23 1:52
lmoelleb30-Jan-23 1:52 
QuestionWhy is my AlphaPanel approach to disable the entire GUI so slow? Pin
arnold_w25-Jan-23 4:45
arnold_w25-Jan-23 4:45 
AnswerRe: Why is my AlphaPanel approach to disable the entire GUI so slow? Pin
Gerry Schmitz25-Jan-23 6:09
mveGerry Schmitz25-Jan-23 6:09 
GeneralRe: Why is my AlphaPanel approach to disable the entire GUI so slow? Pin
arnold_w27-Jan-23 0:23
arnold_w27-Jan-23 0:23 
GeneralRe: Why is my AlphaPanel approach to disable the entire GUI so slow? Pin
Gerry Schmitz27-Jan-23 6:24
mveGerry Schmitz27-Jan-23 6:24 
GeneralRe: Why is my AlphaPanel approach to disable the entire GUI so slow? Pin
Member 1590788429-Jan-23 8:05
Member 1590788429-Jan-23 8:05 
QuestionAn appraisal application with c# Pin
Emmanuel Bullem23-Jan-23 22:46
Emmanuel Bullem23-Jan-23 22:46 
AnswerRe: An appraisal application with c# Pin
OriginalGriff23-Jan-23 22:53
mveOriginalGriff23-Jan-23 22:53 
AnswerRe: An appraisal application with c# Pin
Pete O'Hanlon24-Jan-23 2:04
subeditorPete O'Hanlon24-Jan-23 2:04 
RantRe: An appraisal application with c# Pin
Eddy Vluggen24-Jan-23 13:54
professionalEddy Vluggen24-Jan-23 13:54 
Questionan appraisal application with c# Pin
Emmanuel Bullem23-Jan-23 21:50
Emmanuel Bullem23-Jan-23 21:50 
AnswerRe: an appraisal application with c# Pin
OriginalGriff23-Jan-23 22:53
mveOriginalGriff23-Jan-23 22:53 
QuestionIs possible to use the same background process for all forms? Pin
Member 1405587922-Jan-23 10:29
Member 1405587922-Jan-23 10:29 
AnswerRe: Is possible to use the same background process for all forms? Pin
Dave Kreskowiak22-Jan-23 13:15
mveDave Kreskowiak22-Jan-23 13:15 
AnswerRe: Is possible to use the same background process for all forms? Pin
Gerry Schmitz22-Jan-23 18:34
mveGerry Schmitz22-Jan-23 18:34 
AnswerRe: Is possible to use the same background process for all forms? Pin
OriginalGriff22-Jan-23 18:49
mveOriginalGriff22-Jan-23 18:49 
AnswerRe: Is possible to use the same background process for all forms? Pin
jschell24-Jan-23 10:27
jschell24-Jan-23 10:27 

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.