paintevent

Show a message box after usercontrol fully displayed

…衆ロ難τιáo~ 提交于 2019-12-08 12:00:47
问题 I have a control form derived from a windows User Control class . I need to show a message box based on a condition once the form displayed. I tried to use the form paint event handler to do this but it seems firing twice. As a result message box displayed twice. How can this be done? public partial class SelectAccounts : UserControl { private void SelectAccounts_Paint(object sender, PaintEventArgs e) { MessageBox.Show("something"); } } 回答1: I've deleted my previous answer you may try the

Q:PaintEvent IOS pixelating arc

a 夏天 提交于 2019-12-08 09:25:34
问题 So I have a Q::Painter which draws some circle. On windows it paints the circle perfect but on iOS it comes pixelated: and this is non pixelated image: I will be very greatfull if someone could help me with this problem. The code is exact the same but iOS renders it bad ... Here is my code: void CQtPercentCircleWidget::paintEvent(QPaintEvent *pe) { int circleX = parentWidget()->width()/2 - m_iCircleWidth/2; int circleY = m_iPenWidth; QRectF normalCircle(circleX, circleY, m_iCircleWidth, m

Draw vertical lines on QTextEdit in PyQt

≡放荡痞女 提交于 2019-12-08 07:04:10
问题 I am trying to develop a GUI that contains a QTextEdit widget. When the gui loads, it pulls in data from a file where the data is in columns of fixed widths. I want the user to be able to click at various points in the QTextEdit widget, to mark the positions where new columns start, and I want vertical lines to be drawn on the widget at those positions, to show the columns. In my GUI init () method I had the following line to intercept the paintEvent from the text widget: self.mytextviewer

Windows Form Paint equivalent event in WPF

独自空忆成欢 提交于 2019-12-04 13:53:13
I have used the PAINT event to draw a wave on a Panel in Winows Form Application. But when using it WPF, I didn't find any such element equivalent to a Panel which has a Paint Event. Googled a lot too but no great use. Well, I need to draw a waveform in WPF so suggest appropriate solutions wrt PaintArgsEvent or a new solution altogether. Thank You! Mark Hall You are looking for the DrawingVisual Class From first Link: The DrawingVisual is a lightweight drawing class that is used to render shapes, images, or text. This class is considered lightweight because it does not provide layout or event

C# show scrollbars if shape height is greater than form height

廉价感情. 提交于 2019-12-02 22:07:52
问题 I just need to show scrollbars on forms if my shape height is greater than the form height. That way, when the user scrolls down, it can show the end of the shape. This is my code: public partial class Form1: Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void Form1_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawLine(new Pen(Color.Black, 2), 100, 50, 100, 1000); //if line height > form height then show scroll bars } }

PySide2 paint on widget created by designer

放肆的年华 提交于 2019-12-02 04:56:41
This issue is with VS Code on Win10 and Python 3.6.6. I'm new both to Python and PySide2. I've read a lot of topics on this here at StackOverflow and possibly this is a duplicate of another topic, but I'm not able to get my widget painted. I understand that the paintEvent() of the widget object have to be overridden somehow. Most of the examples out there does some painting on the main window but I'm not able to transfer this on widgets from an ui.file. I've created two classes in my .py-file, MainForm and Drawer. The MainForm contains implementation of UI and I'm trying to get a widget (named

Drawing points on QPixmap on QWidget (pyqt5)

折月煮酒 提交于 2019-12-01 11:23:29
I have a QWidget with a QLayout on which there is a QLabel. I set a QPixmap on the label. Wherever the user clicks on the image, I want to draw a point. I defined mouseReleaseEvent (which works) and paintEvent (but no points are drawn). I've read all similar questions and none of the solutions worked for me. Any help? My relevant code: class ImageScroller(QtWidgets.QWidget): def __init__(self, img): QtWidgets.QWidget.__init__(self) main_layout = QtWidgets.QVBoxLayout() self._image_label = QtWidgets.QLabel() self._set_image(img) main_layout.addWidget(self._image_label) main_layout.addStretch()