cstatic #4Hi,
what does do "transparent" property of that control?
it can be set to true or false but I don't see any effect.
thanks
The derived CStatic that Ali did works pretty well:
http://www.codeproject.com/staticctrl/TransparentStaticCtrl.asp
Tom
"dunhill" <dd@yahoo.com> wrote in message
news:%23QR0yqRpGHA.4188@TK2MSFTNGP04.phx.gbl...
> Hi,
> what does do "transparent" property of that control?
> it can be set to true or false but I don't see any effect.
> thanks
>
how did you do that? I've tried this with TRANSPARENT true ...
OnDraw and CStatic VC 6.0 OnlySat. 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.
Thanks.
Lord2702,
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 problemI 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.
Thank you.
Rajesh
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.
joe
On 26 May 2004 14:04:03 -0700, rajesh79@hotmail.com (Rajesh) wrote:
>I have an image loaded in a C...
Retrieve WfProcess id from a running oncreate WF RuleHi,
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.
Any suggestions?
Thanks,
Akop Akopyan
...
How to use CStatic smoothly?This is a multi-part message in MIME format.
------=_NextPart_000_0017_01C52501.44102170
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
=CA=F7=D2=B6
Hey,All:
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 controlHi 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.
Nik.
...
Window Size of CStatic ControlUsing 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?
AVee wrote:
> 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 controlI 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 *****************
CRect windowRect;
CRect asterRect;
// -- Get Screen Co-ordinates --
GetWindowRect(windowRect);
// -- Create Asterisk Static control --
asterRect.top = windowRect.top;
asterRect.bottom = windowRect.bottom...
Derived class from CStatic and dialogsI 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
the following:
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-resizeHi,
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
dynamically.
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
>dynamically.
>I tried to SendMessage WM_SIZE but it doesn't work.
You can resize a window by using the SetWindowPos or MoveWindow APIs.
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
...
CWnd & CStatic Based Windows, How to detect mouse leaving the winHello,
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.
Regards,
Eitan
> 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 t...
Tab causes CStatic-derived object to repaint!!Hi,
I derived a class named CGroupBox from CStatic. I am using it the following
way:
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 CStaticI 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 :
void CStaticTest::OnPaint()
{
CPaintDC dc(this); // device context for painting
// Where to draw text
CRect client_rect;
GetClientRect(client_rect);
// Get the caption
CString szText;
GetWindowText(szText);
// 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";
UpdateData();
CStatic text doesn't change. Why?
I'ts UpdateData(FALSE);
"Miki Peric" <blah@ccc.com> wrote in message
news:OmqSCKZPEHA.3264@tk2msftngp13.phx.gbl...
>
> I've assigned an variable of rype CString to the CStatic control (text
> label). When I do this:
>
> m_strText = "aaaaa";
> UpdateData();
>
> CStatic text doesn't change. Why?
>
>
Don't use UpdateData(). Remembering...
create a CStatic dynamically and move it Hello,
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" <biproc2004@yahoo.fr> wrote in message
news:41bb141f$0$22304$626a14ce@news.free.fr...
> Hello,
>
> 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 CStatici 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
resourse)
winnicki
>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
>resourse)
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
WM_CREATE message.
Dave
I think is the other way around. Windo...
CStatic style problemHi!
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]
void MyStatic::OnDraw()
{
...
...
...
DWORD textAlignment;
DWORD style = GetStyle();
if (style&SS_RIGHT==SS_RIGHT)
textAlignment = DT_RIGHT;
else if (styl&SS_CENTER==SS_CENTER)
textAlignment = DT_CENTER;
dc.Dra...
subclassing CStaticHi,
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
nCtlColor)
{
// create white brush:
m_DlgBrush.DeleteObject();
...
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?
Thanks guys.
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
for?
Tom
"Meal" <meedeex@gmail.com> wrote in message
news:4033eb4f-52ae-4b84-b983-22c8...
Problems getting CStatic to refreshHi,
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 CStaticHow can I know when I am supposed to displauy a vertical scrollbar to my
CStatic ?
I know how to do it for horizontal but not for vertical...
::GetTextExtentPoint32(pDCMem->GetSafeHdc(), s2, s2.GetLength(), &sz);
IF (sz.cx > pRect->Width())
{
DO SOMETHING
}
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 lineWith a standard label, I cannot find any simple way to change the color.
Amazing!
Options seem to be (1) make CMyLabel from scratch, or (2) subclass CStatic
I've downloaded some code that does it:
http://www.codeguru.com/cpp/controls/staticctrl/article.php/c2909/
I've created my own Test container MFC app, and lifted the core code out of
the sample.
My code (1) dynamically creates a CStatic, then (2)feeds it to the lifted
code which will subclass it.
But (1) is failing here:
pLabel->Create(
NULL,
WS_CHILD|WS_VISIBLE|SS_LEFT,
CRect(20,20,150,150),
...
CStatic::SetIcon Transparent.Hi,
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.
Thanks,
Paresh.
Can you paste the code that you have? That should help in identifying
the problem.
On Apr 22, 11:34 am, Paresh <Par...@discussions.microsoft.com> wrote:
> Hi,
>...
CStatic IconsI have an icon resource defined in the resource editor with 2 device
contexts:
Standard 32x32
48x48
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?
--
Thanks,
Chris Cranford
http://www.tkdsoftware.com
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 ObjectI 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.
Ali R.
"Smallfrogs" <super_smallfrogs@hotmail.com> wrote in message
news:eLAO92y7DHA.2832@tk2msft...