what does do "transparent" property of that control?
it can be set to true or false but I don't see any effect.
The derived CStatic that Ali did works pretty well:
"dunhill" <firstname.lastname@example.org> wrote in message
> what does do "transparent" property of that control?
> it can be set to true or false but I don't see any effect.
how did you do that? I've tried this with TRANSPARENT true ...OnDraw and CStatic VC 6.0 Only
Sat. July 24, 2004 11:20 PM PT
I am deriving my own control from MFC's CStatic. I want to get OnDraw
message, inderived control. I properly set the SS_OWNERDRAW to get
WM_DRAWITEM message. But my code does not reach to the DrawItem Function.
The same code/ class/ control works perfectly in Visual Studio .Net 2003 but
not in VC 6.0.
Anybody knows what is wrong? Ultimately I just grab WM_PAINT and put the
same code in this message handler.
OnPaint (that is handling WM_PAINT) is the way to go for CStatics. The added
benefit is that you don't need to set any flag f...CStatic control image repaint problem
I have an image loaded in a CStatic control. Once I load the image and
change my focus to some other application and then change my focus
back to the application having the CStatic control, I notice the image
is no more seen. Please let me know how to resolve this problem.
Do you draw the image in the OnPaint handler, or use an SS_BITMAP style-static and do a
SetBitmap (this causes the built-in OnPaint handler to paint the image). Any other
solution will not work.
On 26 May 2004 14:04:03 -0700, email@example.com (Rajesh) wrote:
>I have an image loaded in a C...Retrieve WfProcess id from a running oncreate WF Rule
I want to store the id of launched WF Process and WF Process Instance when
it has been launched right from the workflow. I need this to track
notifications scheduled for multiple deadlines.
...How to use CStatic smoothly?
This is a multi-part message in MIME format.
I have gotten a problem during I used CStatic class.When I try to use =
the method which called WM_PAINT from the other function to try to =
redraw the client area to design a extra-class(its based on CStatic),I =
had sent a message ,but it doesn't seem work well,it's useless,is there =
anything I have to set before I use this call or I just needto add a =
function which can...how to create a scrollable CStatic control
Hi all. I have the following problem: I would like to have some scrolling
abilities within a CStatic control. When CWnd::ShowScrollbar() is called the
scroll bar that appears is some kind of not active and it invokes no window
messages. Please help. Thank you in advance.
...Window Size of CStatic Control
Using the dialog editor I created a static text object 100 wide and 10 deep.
Then I attached it to a CStatic member of my CDialog class using
DDX_Control(). Now, when I call GetClientRect() from my CStatic member, the
windo rectangle is 150 wide and 15 deep. What controls the conversion?
> Using the dialog editor I created a static text object 100 wide and 10 deep.
> Then I attached it to a CStatic member of my CDialog class using
> DDX_Control(). Now, when I call GetClientRect() from my CStatic member, the
> windo rectangle is 150 wide and 15 deep. What control...How to position dynamic CStatic control
I have a sub-classed Edit Control. Within this sub-classed edit control, I
would like to optionally display an asterisk in the upper right corner
(outside the actual edit control). I am using a dynamically create CStatic,
but it does not display. I think the issue is the CRect for the position.
Here is my code for creating the CStatic:
************* snip snip *****************
// -- Get Screen Co-ordinates --
// -- Create Asterisk Static control --
asterRect.top = windowRect.top;
asterRect.bottom = windowRect.bottom...Derived class from CStatic and dialogs
I have a class derived from CStatic and am trying to get it to display in a
dialog-based app. The class works fine as I have tested it a window-based
app and everything works fine. In the dialog-based app however, the call
to Create() crashes the app.
I have thus fallen back to trying to get a CStatic instance onto the dialog
instead, with the same results. The code I'm using to create the object is
pStatic->Create("", WS_VISIBLE|WS_CHILD, rect, this, IDC_MYSTATIC);
Where pStatic is declared as a class member in the header file and rect is
an instance of C...CStatic derived dialog and auto-resize
I would like to add auto-resizing feature to my Cstatic derived control. I
mean when I load a bitmap I would like to adjust size
I tried to SendMessage WM_SIZE but it doesn't work.
>I would like to add auto-resizing feature to my Cstatic derived control. I
>mean when I load a bitmap I would like to adjust size
>I tried to SendMessage WM_SIZE but it doesn't work.
You can resize a window by using the SetWindowPos or MoveWindow APIs.
MVP VC++ FAQ: http://www.mvps.org/vcfaq
...CWnd & CStatic Based Windows, How to detect mouse leaving the win
I am creating a new window class based on CWnd. I am placing it on the View
(CFormView). How can I get the notification or any other indication that
the cursor/mouse is not on this window?
I also tried the same to create a new window based on CStatic but I was not
able to detect when the mouse leaves the window.
> I am creating a new window class based on CWnd. I am placing it on the
> (CFormView). How can I get the notification or any other indication
> the cursor/mouse is not on this window?
> I also tried the same t...Tab causes CStatic-derived object to repaint!!
I derived a class named CGroupBox from CStatic. I am using it the following
1. I created a dialog (and its corresponding CDialog-derived class) using
the resource editor
2. In the dialog, I created a group box.
3. I mapped the group box component to a CGroupBox member of the dialog's
class using the Class Wizard.
I did this so that I could override OnPaint() and give the group box a
custom look. When the dialog comes up, the focus is set to an edit control.
As soon as I hit the TAB key to switch to the next edit control, the group
box's label gets repainted--only the label,...Transparent CStatic
I have derived a CStatic control in order to add transparency and font
control. In a first step I have override OnPaint Method to
make the control transparent :
CPaintDC dc(this); // device context for painting
// Where to draw text
// Get the caption
// Get the font
CFont *pFont, *pOldFont;
pFont = GetFont();
pOldFont = dc.SelectObject(pFont);
// Map "Static Styles" to "Text Styles"
#define MAP_STYLE(src, dest) if(dwStyle & (src)) dwText...CStatic #3
I've assigned an variable of rype CString to the CStatic control (text
label). When I do this:
m_strText = "aaaaa";
CStatic text doesn't change. Why?
"Miki Peric" <firstname.lastname@example.org> wrote in message
> I've assigned an variable of rype CString to the CStatic control (text
> label). When I do this:
> m_strText = "aaaaa";
> CStatic text doesn't change. Why?
Don't use UpdateData(). Remembering...create a CStatic dynamically and move it
I would like to be able to create a CStatic object, to put it on a CDialog
and to move it.
But I have no idea how to do this.
"Vince" <email@example.com> wrote in message
> I would like to be able to create a CStatic object, to put it on a CDialog
> and to move it.
> But I have no idea how to do this.
Make it a member of the CDialog, call its Create and MoveWindow functions
during the lifetime of the dialog's HWND.
Jeff Partch [VC++ MVP]
Jeff Partch [MVP] wrote:
> "Vince...OnCreate in CStatic
i made a class from CStatic and i added OnCreate function to this new class
but this function never runs. why? (new class is connected with static
>i made a class from CStatic and i added OnCreate function to this new class
>but this function never runs. why? (new class is connected with static
I guess you're using your class for a control in a dialog?
In that situation, your class is attached to the control after the
control has been created - therefore you never get to handle the
I think is the other way around. Windo...CStatic style problem
I have created my own CStatic derived class to allow changing text
attributes (color, bold, italic, etc.). Could anybody help me telling how to
get original (set in dialog template) CStatic style? For example I would
like to know the alignment of caption set in dialog template. I tried:
[in class MyStatic: public CStatic]
DWORD style = GetStyle();
textAlignment = DT_RIGHT;
else if (styl&SS_CENTER==SS_CENTER)
textAlignment = DT_CENTER;
I have subclassed a few CStatic ctrls so i can quickly change their font, BG
and FG colors etc... I have also handled the CFormView's CtlColor message
and painted the form white and text blue.
The problem that im having is the subclassed objects are painting themselves
the colors i specify, then the CFormView::OnCtlColor is painting them again.
This isnt too much of a problem as i can simply exclude the subclassed items
from the painting using:
HBRUSH CSmartMXEditLangView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT
// create white brush:
...How to let a CStatic control accept WM_CHAR ?
Since the CStatic control fully covers my main window, it's the only
one which can get focus.
While I need to handle WM_CHAR in its parent/main window, I just found
that the static cannot get the WM_CHAR message.
Is there a way to do what I want?
Maybe you could show some code to explain more. I can't figure out why a
static would want to get a WM_CHAR message. Are you trying to get this in
other controls on top of this one? How or what are you using the CStatic
"Meal" <firstname.lastname@example.org> wrote in message
news:4033eb4f-52ae-4b84-b983-22c8...Problems getting CStatic to refresh
I'm having problems trying to update the contents a CStatic control
that exists in a SDI application. Whenever I try to update the control,
the new text appears to sit on top of the existing text. It seems that
the control does not get refreshed after the call to SetWindowText(). I
have tried calling CStatic::Invalidate() and CStatic::RedrawWindow()
directly but nothing seems to work.
My only solution is to call CView::Invalidate() every couple of
seconds, but this causes a very anoying flicker. Here is the call to
CStatic::Create(). Maybe I'm missing something? Any help would be...Detect when text is out of CStatic
How can I know when I am supposed to displauy a vertical scrollbar to my
I know how to do it for horizontal but not for vertical...
::GetTextExtentPoint32(pDCMem->GetSafeHdc(), s2, s2.GetLength(), &sz);
IF (sz.cx > pRect->Width())
In the vertical case do I need to count the number of lines displayed
and to do somthing like
int nLines = some value; // Number of lines of text in my CStatic
for (int i =0, i < nLines; i++)
::GetTextExtentPoint32(pDCMem->GetSafeHdc(), s2, s2.GetLength(), &sz);
m_sz += sz;
m_sz.cy > pRect->Width()
...Problem dynamically creating CStatic Label: (FAIL afxwin1.inl line
With a standard label, I cannot find any simple way to change the color.
Options seem to be (1) make CMyLabel from scratch, or (2) subclass CStatic
I've downloaded some code that does it:
I've created my own Test container MFC app, and lifted the core code out of
My code (1) dynamically creates a CStatic, then (2)feeds it to the lifted
code which will subclass it.
But (1) is failing here:
I am using the API CStatic::SetIcon to associate the icon with the static
control. I have placed this control on CDialog, (Dialog background is
gradient painted). I want this CStatic control to be transparent (so that the
background of CStatic would be gradient, which is of Dialogs background
color). However, icon image is transparent. How could I do this ?
Any help would be highly appreciated.
Can you paste the code that you have? That should help in identifying
On Apr 22, 11:34 am, Paresh <Par...@discussions.microsoft.com> wrote:
I have an icon resource defined in the resource editor with 2 device
I want to use the 48x48 context in my about box since it is much larger in
size. If I add a CStatic (Picture Box) to the dialog and set it to display
the icon resource, it resizes it to use the 32x32. How do I can it to use
the 48x48 instead?
Nevermind, found the solution. I just created a variable for my CStatic
control such m_ctrlIcon and used the following code in OnInitDialog:
// The following code grabs the window block ...How to add a VScroll to a CStatic Object
I create a CStatic object and write some text to the object
but the text is too long to display in the work area
but I don't konw how to add a vscroll to a CStatic object
who can help me?
I would say instead of a CStatic, use a CEdit control with the ReadOnly flag
set. Because static controls by default aren't scrollable, so even if you
add a scrollbar to it, you will have to manage the entire thing yourself
(drawing, scrolling....), more trouble than it's worth.
"Smallfrogs" <email@example.com> wrote in message