一、前言

在平时的写作过程中,经常需要将一些操作动作和效果图截图成gif格式,使得涵盖的信息更全面更生动,有时候可以将整个操作过程和运行效果录制成MP4,但是文件体积比较大,而且很多网站不便于上传,基本上都支持gif动图,一般一个5秒左右的gif,800*600分辨率,可以很好的控制在500KB内,这样就比较完美的支持各大网站上传动图。

最开始使用的是ScreenGif.exe,用了很久,感觉还可以,后面一个朋友推荐用LICEcap.exe,体积更小,压缩比更高,再到后来发现有个gif.h开源的类,调用其中的方法可以实现将多张图片合并到一张gif中去,而且还是跨平台的,本人亲自在WIN+UBUNTU测试成功。

最初的代码是倪大侠给的,我在此基础上重新完善了下,使得可以直接拖动窗体大小来改变录屏区域的大小。增加了对Qt4和其他编译器的支持。

二、实现的功能

  • 1:可设置要录制屏幕的宽高,支持右下角直接拉动改变.
  • 2:可设置变宽的宽度
  • 3:可设置录屏控件的背景颜色
  • 4:可设置录制的帧数
  • 5:录制区域可自由拖动选择

三、效果图

四、头文件代码

  1. #ifndef GIFWIDGET_H
  2. #define GIFWIDGET_H
  3. /**
  4. * GIF录屏控件 作者:feiyangqingyun(QQ:517216493) 2019-4-3
  5. * 1:可设置要录制屏幕的宽高,支持右下角直接拉动改变.
  6. * 2:可设置变宽的宽度
  7. * 3:可设置录屏控件的背景颜色
  8. * 4:可设置录制的帧数
  9. * 5:录制区域可自由拖动选择
  10. */
  11. #include <QDialog>
  12. #include "gif.h"
  13. class QLineEdit;
  14. class QLabel;
  15. #ifdef quc
  16. #if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
  17. #include <QtDesigner/QDesignerExportWidget>
  18. #else
  19. #include <QtUiPlugin/QDesignerExportWidget>
  20. #endif
  21. class QDESIGNER_WIDGET_EXPORT GifWidget : public QDialog
  22. #else
  23. class GifWidget : public QDialog
  24. #endif
  25. {
  26. Q_OBJECT
  27. Q_PROPERTY(int borderWidth READ getBorderWidth WRITE setBorderWidth)
  28. Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor)
  29. public:
  30. static GifWidget *Instance();
  31. explicit GifWidget(QWidget *parent = 0);
  32. protected:
  33. bool eventFilter(QObject *watched, QEvent *event);
  34. void resizeEvent(QResizeEvent *);
  35. void paintEvent(QPaintEvent *);
  36. private:
  37. static QScopedPointer<GifWidget> self;
  38. QWidget *widgetTop; //标题栏
  39. QWidget *widgetMain; //中间部分
  40. QWidget *widgetBottom; //底部栏
  41. QLineEdit *txtFps; //帧率输入框
  42. QLineEdit *txtWidth; //宽度输入框
  43. QLineEdit *txtHeight; //高度输入框
  44. QPushButton *btnStart; //开始按钮
  45. QLabel *labStatus; //显示状态信息
  46. int fps; //帧数 100为1s
  47. int borderWidth; //边框宽度
  48. QColor bgColor; //背景颜色
  49. int count; //帧数计数
  50. QString fileName; //保存文件名称
  51. QRect rectGif; //截屏区域
  52. QTimer *timer; //截屏定时器
  53. Gif gif; //gif类对象
  54. Gif::GifWriter *gifWriter; //gif写入对象
  55. public:
  56. int getBorderWidth() const;
  57. QColor getBgColor() const;
  58. private slots:
  59. void initControl();
  60. void initForm();
  61. void saveImage();
  62. void record();
  63. void closeAll();
  64. void resizeForm();
  65. public Q_SLOTS:
  66. void setBorderWidth(int borderWidth);
  67. void setBgColor(const QColor &bgColor);
  68. };
  69. #endif // GIFWIDGET_H

五、核心代码

  1. #pragma execution_character_set("utf-8")
  2. #include "gifwidget.h"
  3. #include "qmutex.h"
  4. #include "qlabel.h"
  5. #include "qlineedit.h"
  6. #include "qpushbutton.h"
  7. #include "qlayout.h"
  8. #include "qpainter.h"
  9. #include "qevent.h"
  10. #include "qstyle.h"
  11. #include "qpixmap.h"
  12. #include "qtimer.h"
  13. #include "qdatetime.h"
  14. #include "qapplication.h"
  15. #include "qdesktopwidget.h"
  16. #include "qdesktopservices.h"
  17. #include "qfiledialog.h"
  18. #include "qurl.h"
  19. #include "qdebug.h"
  20. #if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
  21. #include "qscreen.h"
  22. #endif
  23. QScopedPointer<GifWidget> GifWidget::self;
  24. GifWidget *GifWidget::Instance()
  25. {
  26. if (self.isNull()) {
  27. static QMutex mutex;
  28. QMutexLocker locker(&mutex);
  29. if (self.isNull()) {
  30. self.reset(new GifWidget);
  31. }
  32. }
  33. return self.data();
  34. }
  35. GifWidget::GifWidget(QWidget *parent) : QDialog(parent)
  36. {
  37. this->initControl();
  38. this->initForm();
  39. }
  40. bool GifWidget::eventFilter(QObject *watched, QEvent *event)
  41. {
  42. static QPoint mousePoint;
  43. static bool mousePressed = false;
  44. QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
  45. if (mouseEvent->type() == QEvent::MouseButtonPress) {
  46. if (mouseEvent->button() == Qt::LeftButton) {
  47. mousePressed = true;
  48. mousePoint = mouseEvent->globalPos() - this->pos();
  49. return true;
  50. }
  51. } else if (mouseEvent->type() == QEvent::MouseButtonRelease) {
  52. mousePressed = false;
  53. return true;
  54. } else if (mouseEvent->type() == QEvent::MouseMove) {
  55. if (mousePressed && (mouseEvent->buttons() && Qt::LeftButton)) {
  56. this->move(mouseEvent->globalPos() - mousePoint);
  57. return true;
  58. }
  59. }
  60. return QWidget::eventFilter(watched, event);
  61. }
  62. void GifWidget::resizeEvent(QResizeEvent *e)
  63. {
  64. //拉动右下角改变大小自动赋值
  65. txtWidth->setText(QString::number(widgetMain->width()));
  66. txtHeight->setText(QString::number(widgetMain->height()));
  67. QDialog::resizeEvent(e);
  68. }
  69. void GifWidget::paintEvent(QPaintEvent *)
  70. {
  71. int width = txtWidth->text().toInt();
  72. int height = txtHeight->text().toInt();
  73. rectGif = QRect(borderWidth, widgetTop->height(), width - (borderWidth * 2), height);
  74. QPainter painter(this);
  75. painter.setPen(Qt::NoPen);
  76. painter.setBrush(bgColor);
  77. painter.drawRoundedRect(this->rect(), 5, 5);
  78. painter.setCompositionMode(QPainter::CompositionMode_Clear);
  79. painter.fillRect(rectGif, Qt::SolidPattern);
  80. }
  81. int GifWidget::getBorderWidth() const
  82. {
  83. return this->borderWidth;
  84. }
  85. QColor GifWidget::getBgColor() const
  86. {
  87. return this->bgColor;
  88. }
  89. void GifWidget::initControl()
  90. {
  91. this->setObjectName("GifWidget");
  92. this->resize(800, 600);
  93. this->setSizeGripEnabled(true);
  94. QVBoxLayout *verticalLayout = new QVBoxLayout(this);
  95. verticalLayout->setSpacing(0);
  96. verticalLayout->setContentsMargins(11, 11, 11, 11);
  97. verticalLayout->setObjectName("verticalLayout");
  98. verticalLayout->setContentsMargins(0, 0, 0, 0);
  99. widgetTop = new QWidget(this);
  100. widgetTop->setObjectName("widgetTop");
  101. widgetTop->setMinimumSize(QSize(0, 35));
  102. widgetTop->setMaximumSize(QSize(16777215, 35));
  103. QHBoxLayout *layoutTop = new QHBoxLayout(widgetTop);
  104. layoutTop->setSpacing(0);
  105. layoutTop->setContentsMargins(11, 11, 11, 11);
  106. layoutTop->setObjectName("layoutTop");
  107. layoutTop->setContentsMargins(0, 0, 0, 0);
  108. QPushButton *btnIcon = new QPushButton(widgetTop);
  109. btnIcon->setObjectName("btnIcon");
  110. QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
  111. sizePolicy.setHorizontalStretch(0);
  112. sizePolicy.setVerticalStretch(0);
  113. sizePolicy.setHeightForWidth(btnIcon->sizePolicy().hasHeightForWidth());
  114. btnIcon->setSizePolicy(sizePolicy);
  115. btnIcon->setMinimumSize(QSize(35, 0));
  116. btnIcon->setFlat(true);
  117. layoutTop->addWidget(btnIcon);
  118. QLabel *labTitle = new QLabel(widgetTop);
  119. labTitle->setObjectName("labTitle");
  120. layoutTop->addWidget(labTitle);
  121. QSpacerItem *horizontalSpacer = new QSpacerItem(87, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  122. layoutTop->addItem(horizontalSpacer);
  123. QPushButton *btnClose = new QPushButton(widgetTop);
  124. btnClose->setObjectName("btnClose");
  125. sizePolicy.setHeightForWidth(btnClose->sizePolicy().hasHeightForWidth());
  126. btnClose->setSizePolicy(sizePolicy);
  127. btnClose->setMinimumSize(QSize(35, 0));
  128. btnClose->setFocusPolicy(Qt::NoFocus);
  129. btnClose->setFlat(true);
  130. layoutTop->addWidget(btnClose);
  131. verticalLayout->addWidget(widgetTop);
  132. widgetMain = new QWidget(this);
  133. widgetMain->setObjectName("widgetMain");
  134. QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Expanding);
  135. sizePolicy1.setHorizontalStretch(0);
  136. sizePolicy1.setVerticalStretch(0);
  137. sizePolicy1.setHeightForWidth(widgetMain->sizePolicy().hasHeightForWidth());
  138. widgetMain->setSizePolicy(sizePolicy1);
  139. verticalLayout->addWidget(widgetMain);
  140. widgetBottom = new QWidget(this);
  141. widgetBottom->setObjectName("widgetBottom");
  142. widgetBottom->setMinimumSize(QSize(0, 45));
  143. widgetBottom->setMaximumSize(QSize(16777215, 45));
  144. QHBoxLayout *layoutBottom = new QHBoxLayout(widgetBottom);
  145. layoutBottom->setSpacing(6);
  146. layoutBottom->setContentsMargins(11, 11, 11, 11);
  147. layoutBottom->setObjectName("layoutBottom");
  148. layoutBottom->setContentsMargins(9, 9, -1, -1);
  149. QLabel *labFps = new QLabel(widgetBottom);
  150. labFps->setObjectName("labFps");
  151. layoutBottom->addWidget(labFps);
  152. txtFps = new QLineEdit(widgetBottom);
  153. txtFps->setObjectName("txtFps");
  154. txtFps->setMaximumSize(QSize(50, 16777215));
  155. txtFps->setAlignment(Qt::AlignCenter);
  156. layoutBottom->addWidget(txtFps);
  157. QLabel *labWidth = new QLabel(widgetBottom);
  158. labWidth->setObjectName("labWidth");
  159. layoutBottom->addWidget(labWidth);
  160. txtWidth = new QLineEdit(widgetBottom);
  161. txtWidth->setObjectName("txtWidth");
  162. txtWidth->setEnabled(true);
  163. txtWidth->setMaximumSize(QSize(50, 16777215));
  164. txtWidth->setAlignment(Qt::AlignCenter);
  165. layoutBottom->addWidget(txtWidth);
  166. QLabel *labHeight = new QLabel(widgetBottom);
  167. labHeight->setObjectName("labHeight");
  168. layoutBottom->addWidget(labHeight);
  169. txtHeight = new QLineEdit(widgetBottom);
  170. txtHeight->setObjectName("txtHeight");
  171. txtHeight->setEnabled(true);
  172. txtHeight->setMaximumSize(QSize(50, 16777215));
  173. txtHeight->setAlignment(Qt::AlignCenter);
  174. layoutBottom->addWidget(txtHeight);
  175. labStatus = new QLabel(widgetBottom);
  176. labStatus->setObjectName("labStatus");
  177. QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
  178. sizePolicy2.setHorizontalStretch(0);
  179. sizePolicy2.setVerticalStretch(0);
  180. sizePolicy2.setHeightForWidth(labStatus->sizePolicy().hasHeightForWidth());
  181. labStatus->setSizePolicy(sizePolicy2);
  182. labStatus->setAlignment(Qt::AlignCenter);
  183. layoutBottom->addWidget(labStatus);
  184. btnStart = new QPushButton(widgetBottom);
  185. btnStart->setObjectName("btnStart");
  186. sizePolicy.setHeightForWidth(btnStart->sizePolicy().hasHeightForWidth());
  187. btnStart->setSizePolicy(sizePolicy);
  188. layoutBottom->addWidget(btnStart);
  189. verticalLayout->addWidget(widgetBottom);
  190. labTitle->setText("GIF录屏工具(QQ:517216493)");
  191. labFps->setText("帧率");
  192. labWidth->setText("宽度");
  193. labHeight->setText("高度");
  194. btnStart->setText("开始");
  195. this->setWindowTitle(labTitle->text());
  196. btnIcon->setIcon(style()->standardIcon(QStyle::SP_ComputerIcon));
  197. btnClose->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
  198. connect(btnClose, SIGNAL(clicked(bool)), this, SLOT(closeAll()));
  199. connect(btnStart, SIGNAL(clicked(bool)), this, SLOT(record()));
  200. connect(txtWidth, SIGNAL(editingFinished()), this, SLOT(resizeForm()));
  201. connect(txtHeight, SIGNAL(editingFinished()), this, SLOT(resizeForm()));
  202. }
  203. void GifWidget::initForm()
  204. {
  205. borderWidth = 3;
  206. bgColor = QColor(34, 163, 169);
  207. fps = 10;
  208. txtFps->setText(QString::number(fps));
  209. gifWriter = 0;
  210. timer = new QTimer(this);
  211. timer->setInterval(100);
  212. connect(timer, SIGNAL(timeout()), this, SLOT(saveImage()));
  213. this->setAttribute(Qt::WA_TranslucentBackground);
  214. this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowStaysOnTopHint);
  215. this->installEventFilter(this);
  216. QStringList qss;
  217. qss.append("QLabel{color:#ffffff;}");
  218. qss.append("#btnClose,#btnIcon{border:none;border-radius:0px;}");
  219. qss.append("#btnClose:hover{background-color:#ff0000;}");
  220. qss.append("#btnClose{border-top-right-radius:5px;}");
  221. qss.append("#labTitle{font:bold 16px;}");
  222. qss.append("#labStatus{font:15px;}");
  223. this->setStyleSheet(qss.join(""));
  224. }
  225. void GifWidget::saveImage()
  226. {
  227. if (!gifWriter) {
  228. return;
  229. }
  230. #if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
  231. //由于qt4没有RGBA8888,采用最接近RGBA8888的是ARGB32,颜色会有点偏差
  232. QPixmap pix = QPixmap::grabWindow(0, x() + rectGif.x(), y() + rectGif.y(), rectGif.width(), rectGif.height());
  233. QImage image = pix.toImage().convertToFormat(QImage::Format_ARGB32);
  234. #else
  235. QScreen *screen = QApplication::primaryScreen();
  236. QPixmap pix = screen->grabWindow(0, x() + rectGif.x(), y() + rectGif.y(), rectGif.width(), rectGif.height());
  237. QImage image = pix.toImage().convertToFormat(QImage::Format_RGBA8888);
  238. #endif
  239. gif.GifWriteFrame(gifWriter, image.bits(), rectGif.width(), rectGif.height(), fps);
  240. count++;
  241. labStatus->setText(QString("正在录制 第 %1 帧").arg(count));
  242. }
  243. void GifWidget::record()
  244. {
  245. if (btnStart->text() == "开始") {
  246. if (0 != gifWriter) {
  247. delete gifWriter;
  248. gifWriter = 0;
  249. }
  250. //先弹出文件保存对话框
  251. //fileName = qApp->applicationDirPath() + "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm-ss.gif");
  252. fileName = QFileDialog::getSaveFileName(this, "选择保存位置", qApp->applicationDirPath() + "/", "gif图片(*.gif)");
  253. if (fileName.isEmpty()) {
  254. return;
  255. }
  256. int width = txtWidth->text().toInt();
  257. int height = txtHeight->text().toInt();
  258. fps = txtFps->text().toInt();
  259. gifWriter = new Gif::GifWriter;
  260. bool bOk = gif.GifBegin(gifWriter, fileName.toLocal8Bit().data(), width, height, fps);
  261. if (!bOk) {
  262. delete gifWriter;
  263. gifWriter = 0;
  264. return;
  265. }
  266. count = 0;
  267. labStatus->setText("开始录制...");
  268. btnStart->setText("停止");
  269. //延时启动
  270. timer->setInterval(1000 / fps);
  271. QTimer::singleShot(1000, timer, SLOT(start()));
  272. //saveImage();
  273. } else {
  274. timer->stop();
  275. gif.GifEnd(gifWriter);
  276. delete gifWriter;
  277. gifWriter = 0;
  278. labStatus->setText(QString("录制完成 共 %1 帧").arg(count));
  279. btnStart->setText("开始");
  280. QDesktopServices::openUrl(QUrl(fileName));
  281. }
  282. }
  283. void GifWidget::closeAll()
  284. {
  285. if (0 != gifWriter) {
  286. delete gifWriter;
  287. gifWriter = 0;
  288. }
  289. this->close();
  290. }
  291. void GifWidget::resizeForm()
  292. {
  293. int width = txtWidth->text().toInt();
  294. int height = txtHeight->text().toInt();
  295. this->resize(width, height + widgetTop->height() + widgetBottom->height());
  296. }
  297. void GifWidget::setBorderWidth(int borderWidth)
  298. {
  299. if (this->borderWidth != borderWidth) {
  300. this->borderWidth = borderWidth;
  301. this->update();
  302. }
  303. }
  304. void GifWidget::setBgColor(const QColor &bgColor)
  305. {
  306. if (this->bgColor != bgColor) {
  307. this->bgColor = bgColor;
  308. this->update();
  309. }
  310. }

六、控件介绍

  1. 超过149个精美控件,涵盖了各种仪表盘、进度条、进度球、指南针、曲线图、标尺、温度计、导航条、导航栏,flatui、高亮按钮、滑动选择器、农历等。远超qwt集成的控件数量。
  2. 每个类都可以独立成一个单独的控件,零耦合,每个控件一个头文件和一个实现文件,不依赖其他文件,方便单个控件以源码形式集成到项目中,较少代码量。qwt的控件类环环相扣,高度耦合,想要使用其中一个控件,必须包含所有的代码。
  3. 全部纯Qt编写,QWidget+QPainter绘制,支持Qt4.6到Qt5.12的任何Qt版本,支持mingw、msvc、gcc等编译器,支持任意操作系统比如windows+linux+mac+嵌入式linux等,不乱码,可直接集成到Qt Creator中,和自带的控件一样使用,大部分效果只要设置几个属性即可,极为方便。
  4. 每个控件都有一个对应的单独的包含该控件源码的DEMO,方便参考使用。同时还提供一个所有控件使用的集成的DEMO。
  5. 每个控件的源代码都有详细中文注释,都按照统一设计规范编写,方便学习自定义控件的编写。
  6. 每个控件默认配色和demo对应的配色都非常精美。
  7. 超过130个可见控件,6个不可见控件。
  8. 部分控件提供多种样式风格选择,多种指示器样式选择。
  9. 所有控件自适应窗体拉伸变化。
  10. 集成自定义控件属性设计器,支持拖曳设计,所见即所得,支持导入导出xml格式。
  11. 自带activex控件demo,所有控件可以直接运行在ie浏览器中。
  12. 集成fontawesome图形字体+阿里巴巴iconfont收藏的几百个图形字体,享受图形字体带来的乐趣。
  13. 所有控件最后生成一个dll动态库文件,可以直接集成到qtcreator中拖曳设计使用。
  14. 目前已经有qml版本,后期会考虑出pyqt版本,如果用户需求量很大的话。

七、SDK下载

  • SDK下载链接:https://pan.baidu.com/s/1A5Gd77kExm8Co5ckT51vvQ 提取码:877p
  • 下载链接中包含了各个版本的动态库文件,所有控件的头文件,使用demo,自定义控件+属性设计器。
  • 自定义控件插件开放动态库dll使用(永久免费),无任何后门和限制,请放心使用。
  • 目前已提供26个版本的dll,其中包括了qt5.12.3 msvc2017 32+64 mingw 32+64 的。
  • 不定期增加控件和完善控件,不定期更新SDK,欢迎各位提出建议,谢谢!
  • widget版本(QQ:517216493)qml版本(QQ:373955953)三峰驼(QQ:278969898)。
  • 涛哥的知乎专栏 Qt进阶之路 https://zhuanlan.zhihu.com/TaoQt
  • 欢迎关注微信公众号【高效程序员】,C++/Python、学习方法、写作技巧、热门技术、职场发展等内容,干货多多,福利多多!

Qt编写自定义控件35-GIF录屏控件的更多相关文章

  1. Qt编写自定义控件11-设备防区按钮控件

    前言 在很多项目应用中,需要根据数据动态生成对象显示在地图上,比如地图标注,同时还需要可拖动对象到指定位置显示,能有多种状态指示,安防领域一般用来表示防区或者设备,可以直接显示防区号,有多种状态颜色指 ...

  2. Qt编写自定义控件8-动画按钮组控件

    前言 动画按钮组控件可以用来当做各种漂亮的导航条用,既可以设置成顶部底部+左侧右侧,还自带精美的滑动效果,还可以设置悬停滑动等各种颜色,原创作者雨田哥(QQ:3246214072),驰骋Qt控件界多年 ...

  3. Qt编写自定义控件32-等待进度条控件

    一.前言 在各种各样的执行任务界面,有时候需要比较多的时间,需要给出一个直观的等待进度条表示当前正在执行的进度,而不至于懵逼在那里,用户不会觉得程序死了还是干嘛了. 等待进度条有好几种办法,比如直接叫 ...

  4. Qt编写自定义控件24-图片轮播控件

    一.前言 上一篇文章写的广告轮播控件,采用的传统widget堆积设置样式表做的,这次必须要用到更高级的QPainter来绘制了,这个才是最高效的办法,本控件参考雨田哥的轮播控件,经过大规模的改造而成, ...

  5. Qt编写自定义控件23-广告轮播控件

    一.前言 广告轮播这个控件做的比较早,是很早以前定制一个电信客户端时候用到的,该客户端需要在首页展示轮播预先设定好的图片,图片的路径可以自由设定,然后轮播的间隔速度可以自由控制,同时该控件还需要提供两 ...

  6. Qt编写的项目作品1-自定义控件大全

    一.功能特点 超过160个精美控件,涵盖了各种仪表盘.进度条.进度球.指南针.曲线图.标尺.温度计.导航条.导航栏,flatui.高亮按钮.滑动选择器.农历等.远超qwt集成的控件数量. 每个类都可以 ...

  7. Qt编写自定义控件大全

    最新版可执行文件 http://pan.baidu.com/s/1i491FQP 不定期增加控件及修正BUG和改进算法. 总图: 1:动画按钮 * 1:可设置显示的图像和底部的文字 * 2:可设置普通 ...

  8. Qt编写自定义控件二动画按钮

    现在的web发展越来越快,很多流行的布局样式,都是从web开始的,写惯了Qt widgets 项目,很多时候想改进一下现有的人机交互,尤其是在现有的按钮上加一些动画的效果,例如鼠标移上去变大,移开还原 ...

  9. Qt编写自定义控件5-柱状温度计

    前言 柱状温度计控件,可能是很多人练手控件之一,基本上都是垂直方向展示,底部一个水银柱,中间刻度尺,刻度尺可以在左侧右侧或者两侧都有,自适应分辨率改动,有时候为了美观效果,可能还会整个定时器来实现动画 ...

随机推荐

  1. java8的相关特性

    1,为什么要介绍java8的相关特性? 因为现在的企业大部分已经从java7向java8开始迈进了,用java8的公司越来越多了,java8中的一些知识还是需要了解一些的; java8具有以下特点: ...

  2. tomcat web的URL解析(web.xml)

    1.一个tomcat可以配置多个host: 2.一个host可以包含多个应用:context: 3.一个应用可以包含多个servlet:servlet-path; 4.一个servlet可以包含多个r ...

  3. flask 杂记

    参考资料:http://python.jobbole.com/84003/  https://flask-cn.readthedocs.io/en/latest/tutorial/ 加载配置: app ...

  4. Django REST framework+Vue 打造生鲜电商项目(笔记一)

    首先,这系列随笔是我个人在学习Bobby老师的Django实战项目中,记录的觉得对自己来说比较重要的知识点,不是完完整整的项目步骤过程....如果有小伙伴想找完整的教程,可以看看这个(https:// ...

  5. C语言定义数组时使用枚举作为数组的下标 ——c99功能

    部分参考了https://blog.csdn.net/wq3028/article/details/76204690 同时在电脑上进行验证 //温度,电磁阀传感器序号,方便数组定位 typedef e ...

  6. 6、组件注册-@Lazy-bean懒加载

    6.组件注册-@Lazy-bean懒加载 懒加载:单实例bean,默认是在容器启动的时候创建对象:懒加载就是启动的是不创建,在第一次使用的时候再创建对象. @Lazy // 单实例下懒加载bean

  7. harbor批量导出镜像

    工作中遇到一个问题,要把某个项目的harbor镜像库全部迁移到其他环境的harbor上,由于网络不通,只能导出来,传给同事,让同事导入到他们的harbor上: 记录下我的操作方法. 参考博客园的一篇博 ...

  8. UVA323 Jury Compromise

    思路:背包类DP 提交:3次 错因:没有注意得分的上下界导致 RE 显示 WA 题解: 我们很容易的想到把两种分数做一个差,来尽量背到 \(0\) . 那最大化总分呢?这时我们可以用两种分数的和作为物 ...

  9. sz/rz

    需要客户端的支持,CRT或者Xshell等 linux端默认是不支持的, 不用通过传输工具来传输文件 yum -y install lrzsz

  10. Luogu5339 [TJOI2019]唱、跳、rap和篮球 【生成函数,NTT】

    当时看到这道题的时候我的脑子可能是这样的: My left brain has nothing right, and my right brain has nothing left. 总之,看到&qu ...