Hello,
i work on a program, using some wxFrame-windows (wx 3.1.2). The application has a dark skin. So i want to get rid of the white Win10-window-borders and elements. But there are some problems with three things:
- There stays a small white top-border if the wxFrame is drawn without title-bar.
- If they have no title-bar and are created hidden, they stay white after showing them until they are resized manually.
- The same frames are not redrawn at all, after hiding them and showing them again. Resizing leads to artefacts.
Especially concerning the first point I wonder, if there is a solution for it (for the others i've workarounds).
Thank you,
Frank
wxFrame-border & -title-bar paint Topic is solved
-
- Earned some good credits
- Posts: 147
- Joined: Mon Sep 01, 2014 10:14 am
Re: wxFrame-border & -title-bar paint
Hi,
Did you try to use wxNO_BORDER style?
Here are the default frame borders. Maybe you should get rid of wxRESIZE_BORDER?
Thank you.
Did you try to use wxNO_BORDER style?
Here are the default frame borders. Maybe you should get rid of wxRESIZE_BORDER?
Thank you.
-
- Earned some good credits
- Posts: 147
- Joined: Mon Sep 01, 2014 10:14 am
Re: wxFrame-border & -title-bar paint
I need resizing. Currently i try to use the draw-event, to draw on wxScrennDC (having some problems with coorinates at the moment). If it works, i'll post it here. I think this is interesting not only for me...
Concerning the other points:
- Resizing the frame after showing it, shows its content at the first Show()-call
- The other problem was (missing content and artefacts) was something in my code
Concerning the other points:
- Resizing the frame after showing it, shows its content at the first Show()-call
- The other problem was (missing content and artefacts) was something in my code
-
- Earned some good credits
- Posts: 147
- Joined: Mon Sep 01, 2014 10:14 am
Re: wxFrame-border & -title-bar paint
wxScreenDC won't work if the titlebar is covered by other windows. So i stop this...
Re: wxFrame-border & -title-bar paint
So i guess that means that you have wxRESIZE_BORDER set?I need resizing.
In that case get rid of wxRESIZE_BORDER and handle the resizing yourself. You can't have the OS's resize behavior without the visible resize border.
Use the source, Luke!
-
- Earned some good credits
- Posts: 147
- Joined: Mon Sep 01, 2014 10:14 am
Re: wxFrame-border & -title-bar paint
Okay...
Here is a raw programmed fix for this white top-border. It's a wxFrame covering it. It has to be created calling
Class:
It leaves one pixel on top for resizing, but it also might be easy, to connect some mouse-events, so that it's a full resize-border (but not transparent, as the others). Also it might be used as window-move-bar...
Best,
Frank
Here is a raw programmed fix for this white top-border. It's a wxFrame covering it. It has to be created calling
Code: Select all
new clsBorderHelper(this);
Code: Select all
class clsBorderHelper : public wxFrame { wxWindow *Parent ;
public:
virtual void OnParentRepos (wxEvent &event) { event.Skip();
wxSize diff(Parent->GetSize()-Parent->GetClientSize()); //unfortunately GetWindowBorderSize() returns 0...
this->SetPosition (Parent->GetPosition()+wxPoint(diff.GetWidth()/2, 1));
this->SetSize(wxSize(Parent->GetSize().GetWidth() - diff.GetWidth(), diff.GetHeight() / 2 ));
};
clsBorderHelper(wxWindow *parent) : wxFrame (parent, -1, "", wxPoint(0,0), wxSize(0,0),
wxNO_BORDER|wxFRAME_NO_TASKBAR|wxFRAME_FLOAT_ON_PARENT) {
Parent = parent;
Parent->Connect (wxEVT_MOVE, wxEventHandler(clsBorderHelper::OnParentRepos), NULL, this);
Parent->Connect (wxEVT_SIZE, wxEventHandler(clsBorderHelper::OnParentRepos), NULL, this);
SetBackgroundColour (wxColour("#330066")); //SetBackgroundColour(wxColour(Parent->GetBackgroundColour());
Show();
};
~clsBorderHelper() { // might be better to use Destroy() or smth..
Parent->Disconnect (wxEVT_MOVE, wxEventHandler(clsBorderHelper::OnParentRepos), NULL, this);
Parent->Disconnect (wxEVT_SIZE, wxEventHandler(clsBorderHelper::OnParentRepos), NULL, this);
};
} ;
Best,
Frank
-
- Earned some good credits
- Posts: 147
- Joined: Mon Sep 01, 2014 10:14 am
Re: wxFrame-border & -title-bar paint
Supplement:
Calling Update() in OnParentRepos (wxEvent &event) after this->SetSize(...); reduces the delay of the covering frame...
Calling Update() in OnParentRepos (wxEvent &event) after this->SetSize(...); reduces the delay of the covering frame...
-
- Earned some good credits
- Posts: 147
- Joined: Mon Sep 01, 2014 10:14 am
Re: wxFrame-border & -title-bar paint
And one more...
... working as resize-border (note the the destruchtor is probably not valid)...
I marked this as soved, but for the issue with the not painted content when the wxFrame without title-bar is shown first, i use a workaround.
It's maybe a wxWidgets-problem (version 3.1.2 / win10 / MingW32)...
Source updated: Parent->Update(); in OnMouseMove(wxMouseEvent &event) makes it faster...
One more update: Added "Parent->SetFocus();" in OnLeftUp (wxMouseEvent &event). 1px Border is now perfectly drawn.
... working as resize-border (note the the destruchtor is probably not valid)...
Code: Select all
class clsBorderHelper : public wxFrame {
wxWindow *Parent ;
wxPoint mp;
public:
void OnMouseMove (wxMouseEvent &event) {
wxPoint delta = event.GetPosition() - mp;
Parent->SetPosition (Parent->GetPosition() + wxPoint (0, delta.y));
Parent->SetSize (Parent->GetSize () - wxSize (0, delta.y * 1.0));
Parent->Update();
};
void OnLeftDown (wxMouseEvent &event) { CaptureMouse();
Connect (wxEVT_MOTION, wxMouseEventHandler(clsBorderHelper::OnMouseMove), NULL, this);
mp = event.GetPosition();
};
void OnLeftUp (wxMouseEvent &event) { ReleaseMouse();
Disconnect (wxEVT_MOTION, wxMouseEventHandler(clsBorderHelper::OnMouseMove), NULL, this);
Parent ->SetFocus();
};
void OnParentRepos (wxEvent &event) { event.Skip();
wxSize diff (Parent->GetSize () - Parent->GetClientSize());
SetPosition (Parent->GetPosition() + wxPoint(diff.GetWidth() / 2, 1));
SetSize (wxSize(Parent->GetSize ().GetWidth() - diff.GetWidth(), diff.GetHeight() / 2 ));
Update();
};
clsBorderHelper(wxWindow *parent, wxColour c = wxColour("#132652")) : wxFrame(parent, -1, "", wxPoint(0,0), wxSize(0,0),
wxNO_BORDER|wxFRAME_NO_TASKBAR|wxFRAME_FLOAT_ON_PARENT) {
Parent = parent;
Parent ->Connect (wxEVT_MOVE, wxEventHandler(clsBorderHelper::OnParentRepos), NULL, this);
Parent ->Connect (wxEVT_SIZE, wxEventHandler(clsBorderHelper::OnParentRepos), NULL, this);
Connect (wxEVT_LEFT_DOWN, wxMouseEventHandler(clsBorderHelper::OnLeftDown), NULL, this);
Connect (wxEVT_LEFT_UP, wxMouseEventHandler(clsBorderHelper::OnLeftUp ), NULL, this);
SetBackgroundColour (c);//Parent->GetBackgroundColour());
this->SetCursor(wxCURSOR_SIZENS );
Show ();
};
~clsBorderHelper(){};
} ;
It's maybe a wxWidgets-problem (version 3.1.2 / win10 / MingW32)...
Source updated: Parent->Update(); in OnMouseMove(wxMouseEvent &event) makes it faster...
One more update: Added "Parent->SetFocus();" in OnLeftUp (wxMouseEvent &event). 1px Border is now perfectly drawn.