|
I would say group boxes are a special case, since they draw properly
even with overlapped controls.
Groupboxes are not actual controls - there isn't a groupbox control
in the Win32 control library. A groupbox is a special case of
a static control, and I would expect you won't see too many problems
overlapping controls on static controls since static controls don't
interact with the user.
As far as overlapping controls go, I'd worry more about this:
"Another consequence of having overlapping controls is that the
user of the application may be confused, because clicking the mouse
in the common area may not activate the control that the user intended
to activate."
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for your feedback, Mark. I had a hard time figuring out how group boxes fit into these design limitations. The problems I have are not with user interactions (since there are none) but with redraw artefacts that occur sometimes, e.g. when moving another application window over my window.
Lessons learned: Do not overlap siblings or use WS_EX_TRANSPARENT, instead use client-parent hierarchies. Even HTML/DOM is more consistent and logical to use.
|
|
|
|
|
Moak wrote: Lessons learned: Do not overlap siblings or use WS_EX_TRANSPARENT
Yeah....transparent stuff I've found especially inconsistent with Win32
controls...one of the main reasons I've personally stopped using Win32/GDI/GDI+
for UI altogether.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
This is the Function declaration :
int MyClass::Send (MY_STRUCT *cStruct,
void *Para1, void *Para2,
void *Para3, void *Para4, void *Para5, void *Para6)
{
......
}
But when this function is executed ,why Para1...Para6 do not appear in the function?
MY_STRUCT Querries
Send(&Querries)
Thanks
|
|
|
|
|
what do you mean, "do not appear"?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
i mean why the number of parameters in the declaration and exectution is diffrent? any way, cause i don't understand why type for Para1, ...Para6 is void?
Thanks
|
|
|
|
|
I think i understand what you mean. First, what you have shown as declaration seems to be more like the definition of the method. I think what causes you confusement is that at the definition you see that the method takes 7 parameters and where it is called, only one is specified. I supose that the DECLARATION of the method either gives default values of the parameters, or there is another version of this function with only one parameter. So something like:
class MyClass
{
...
int Send(MY_STRUCT *cStruct, void *Para1=NULL, void *Para2=NULL, void *Para3=NULL,
void *Para4=NULL, void *Para5=NULL, void *Para6=NULL);
...
}
or
class MyClass
{
...
int Send(MY_STRUCT *cStruct, void *Para1, void *Para2, void *Para3,
void *Para4, void *Para5, void *Para6);
int Send(MY_STRUCT *cStruct);
...
}
For the void thing, the type of those parameters is not void but void*, void pointer. This basicly means it is a non-typized pointer.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
modified on Sunday, December 28, 2008 6:45 AM
|
|
|
|
|
what the purpose of using void pointer?
|
|
|
|
|
See CPallini's post[^]. Void pointers are "generic", if you make an "int pointer" (int *) you expect it to contain the address of an integer, if you make a "double pointer" (double *), you expect it to point at a double in memory, and so on, a void pointer can point to anything and it is "up to the context" what is done with it.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Your code with this on the header file
int Send (MY_STRUCT *cStruct,
void *Para1=NULL, void *Para2=NULL,
void *Para3=NULL, void *Para4=NULL, void *Para5=NULL, void *Para6=NULL);
or like this.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
See [^].
A void pointer (void * ) can point to anything (usually additional info about the pointed memory data type is given by a well-know argument, in your case maybe the first one).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
what the different between string and char?
does 'char' mean character? why we have 'unsigned char' type?
Thanks
|
|
|
|
|
|
Generally, with string we mean a sequence (i.e. one or more) of characters.
In C language, char is a data type (corrensponding to a 8-bit signed integer , i.e. ranging from -128 to 127 , while an unsigned char is a 8-bit unsigned integer , i.e. ranging from 0 to 255 ), a string is, by convention, a sequence of char s zero terminated, for instance:
char c1 = 'A';
char c2 = 13;
char c3 = -20;
unsigned char uc1 = 10;
unsigned char uc2 = 'A';
unsigned char uc3 = 250;
char s1[]= { 'H', 'e', 'l', 'l', 'o', '\0'};
char s2[]= "Hello";
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
There is a lot of samples for RGN's for bitmaps but I need to create a RGN for Text with a font and size.
How can I do it?
thanks in advance
|
|
|
|
|
Can you more explain,please?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I want to display text on the screen in such a way so the user will see only the text (Not the window).
The RGN is made to disable coloring outside of specific places in the window.
The effect of it is so you can make windows in a shape you design as so
http://www.codeproject.com/KB/GDI/coolrgn.aspx[^].
How do I do the same effect on text?
|
|
|
|
|
Do you mean you wish to create a region with the shape of text? If so, try this, am not sure if it works but it is worth a try:
1. Create your font and select into a DC (a memory DC should work)
2. Use BeginPath to begin defining a path
3. Use TextOut or DrawText or such to display the text
4. Use CreateFromPath[^] to create a region.
It is possible that it only works with vector-based fonts.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Thanks for helping
The function don't work with all fonts so I did this
SetRgn(CString str)
{
CRect r;GetClientRect(&r);
CMemoryDC dc(GetDC(),r);
CFont font;font.CreatePointFont(120,L"Arial",0,true);
COLORREF bgColor=dc.GetBkColor();
dc.FillSolidRect(r,bgColor);
dc.SelectFont(font);
dc.TextOut(0,0,str);
CRgn rgn,tRgn;rgn.CreateRectRgn(0,0,0,0);
for (int x=r.left;x<r.right;x++)>
{
for (int y=r.top;y<r.bottom;y++)>
{
if(!(!tRgn))tRgn.DeleteObject();
COLORREF c=dc.GetPixel(x,y);
if(c!=bgColor)
{
tRgn.CreateRectRgn(x,y,x+1,y+1);
rgn.CombineRgn(rgn,tRgn,RGN_OR);
}
}
}
SetWindowRgn(rgn);
}
|
|
|
|
|
I supose it really only works for vector-fonts since a raster-font probably has nothing to put into a path...Anyways, isn't that solution a bit slow?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
I did a test in debug mode with breakpoints...(not the best way to check)
1000*1000=1,000,000 loop
It was only 5 sec.
a normal textout will not export so much as so.
Update...
CSize sizeText;dc.GetTextExtent(str,str.GetLength(),&sizeText);
for (int x=r.left;x<sizetext.cx;x++)>
{
for (int y=r.top;y<sizetext.cy;y++)>
....
modified on Monday, December 29, 2008 9:34 AM
|
|
|
|
|
On some files fclose is taking long time to close the file.Can someone please tell that in which condtion it can take time to close and how it is internaly implemented?
Thanks in advacnce.
Regards,
Vishal
|
|
|
|
|
Try calling flush() to flush all writes to the file before calling fclose().
This may reveal that the cause of the slowness is the buffered writes.
|
|
|
|
|
Thanks Richard.
I have tried fflush before fclose.fflush returns immidately but fclose is taking time.time for closing the files get increased with increase in file size. with 100MB it is 30 sec.With 200MB,it is 1 min and 300MB it is 2min and so on.It is happening with one type of files(.dat files) only.I tried by closing some other file at same path with same code and this file is closed immidately.I have tried everything but I am not able to find the reason.Please give some other sugestion,I can try.
Thanks
Vishal
modified on Sunday, December 28, 2008 4:18 AM
|
|
|
|
|
Hi,
is there anything special about your file? e.g. is it on another PC, in a special folder, ...?
does it need some post-processing, like compression, encryption, ...?
|
|
|
|
|