|
I used in constructor of my panel next string:
SetStyle(ControlStyles.DoubleBuffer|ControlStyles.AllPaintingInWmPaint|ControlStyles.UserPaint,true);
And i Still see flicking...
And Another one question - how to make real double buffering...
For Example i draw very difficult figure on the screen, when i finished, another window covers it, anw on OnPaint message i need to redraw, i would like to get the same image( i've already drawn) on the screen... Something like reserve buffer, that doesnt't change, until i didn't change any data...
|
|
|
|
|
Every time your window gets changed in size, dispose and then recreate a bitmap the size of the screen. Draw your stuff to this bitmap when you do this. In your paint message, just draw the image unscaled to the screen.
Double buffering means to have two bitmaps like this, and to draw to one while the other is displayed.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I can't understand, do you know any links about this theme???
Because i got problems with it :
1) Flicking;
2) When i change the size of window it repaints only the old (small) part of window
3) Sometimes my control (Panel), where i draw repaint, then clears with background color...
|
|
|
|
|
If you look up double buffering on google, I'm sure there are plenty of C++ articles that explain the concept. It's really simple, you should draw the image direct to the Graphics object in your Paint handler, and you should have the image already drawn and ready to go.
When you resize your window, it's up to you to set up the drawing code to draw to the new size. Doing what I said will take care of this.
Don't use a panel, just draw the bitmap onto the window.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes i know this method, but it what image ("you should have the image already drawn ")i should draw?
I read that only controls can CreateGraphics...
Will it be the right way, if i dynamicly create a panel, but will not show it on the screen, draw on it, then copy image from it to my form???
|
|
|
|
|
Here is some pseudocode.
class MyForm
{
private Bitmap myBitmap;
MyForm()
{
InitialiseBitmap();
}
OnSizeChanged()
{
InitialiseBitmap();
Invalidate();
}
OnPaint()
{
e.gr.DrawImageUnscaled(myBitmap, 0, 0);
}
InitialiseBitmap()
{
if (myBitmap != null)
{
myBitmap.Dispose();
myBitmap = null;
}
myBitmap = new Bitmap(the size of your drawing window);
using (Graphics gr = Graphics.FromBitmap(myBitmap))
{
draw some stuff on the bitmap
}
}
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I want to make the start of OXY system coordinates not on the left-top, but left-bottom... Is it possible?
|
|
|
|
|
I'm not sure if there is a transform which does this. Either way, do you want this to work while drawing on a bitmap, for your entire Windows app, or what ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I just want to have point in the left bottom corner when i draw it on the screen with coordinates (1,1) .... So Y scale is inversed....
|
|
|
|
|
Yes, I know
This[^] article is as good as it gets. Otherwise, if you're doing drawing only, you can always invert the image at the end.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi:
Can you please guide how to use SecureSockets in C#? Is there a latent support out natively in the framework or should we necessarily go for a third party or open source library?
Perhaps if you could guide me with some SecureFTP stuff too, it would be great. But it is not still a standard right?
Deepak Kumar Vasudevan
Personal Web: http://vdeepakkumar.netfirms.com/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
http://www.mentalis.org/soft/projects/ssocket/[^]
.............................
There's nothing like the sound of incoming rifle and mortar rounds to cure the blues. No matter how down you are, you take an active and immediate interest in life.
Fiat justitia, et ruat cælum
|
|
|
|
|
Hello Friends,
I want to inherit from Label control and draw the Text of the lable myself. This is because of the standard Lable control doesn't have any property to justify text within it. How can I use System.Drawing.StringFormat and DrawString method to gain this goal.I want to justify both left and right edges of text ! Like the following sample :
Sample Text
Sample Text
Sample Text
Always there is another way !
|
|
|
|
|
What about the TextAlign property?
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
try this:
StringFormat sf = new StringFormat()
sf.Alignment = StringAlignment.Near;
sf.LineAlignment = StringAlignment.Center; drawParams.Graphics.DrawRectangle(Pens.WhiteSmoke,col.Rec);
drawParams.Graphics.DrawString("Test",yourFondHere,Brushes.Black,yourRectangleHere,sf);
GanDad
|
|
|
|
|
It has been worked.Thank U very much !
Always there is another way !
|
|
|
|
|
Why another way? Haven't you seen the TextAlign property?
---
b { font-weight: normal; }
|
|
|
|
|
Thanx NassosReyzidis.It has been worked !
Always there is another way !
|
|
|
|
|
Happy to help man, don't mention it
GanDad
|
|
|
|
|
it's work really nice thank you so much for this code
|
|
|
|
|
Hi! Im trying to create a program where i need to filter out a group's salary deduction amout based on their monthly taxes. Although i can't seem to find the right code that declares a month's last day since not all months have the same ending day (31, 30 and 28 for feb). Can someone please give me the concept behind this code? I was thinking of doing an if...else or switch...case statement but it occured to me, what if it was a leap year...? Thanx so much for your help!
thanx
|
|
|
|
|
|
woah that was quick! thanx so much that did the job
thanx
|
|
|
|
|
Hi All,
I have converted the TypeLibrary to assembly using TypeLibConverter class's ConvertTypeLibToAssembly mehod.
But i want the GUID of the Type Library. How to get GUID from TypeLibrary ??
Thanks
TusharM
|
|
|
|
|
If .net isnt installed, my app wont run.
Can i get it to display a message saying that the user needs to install it?
(I'm doubtful that you can but, you never know...)
|
|
|
|